@hanzogui/kitchen-sink 3.0.5
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/.detoxrc.js +130 -0
- package/.env.production +2 -0
- package/.maestro/config.yaml +4 -0
- package/.maestro/flows/shorthand-variables.yaml +23 -0
- package/.watchmanconfig +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/app.json +43 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +25 -0
- package/e2e/CompilerExtraction.test.ts +147 -0
- package/e2e/GroupPressNative.test.ts +167 -0
- package/e2e/MediaQueryGtMd.test.ts +71 -0
- package/e2e/NativePortal.test.ts +113 -0
- package/e2e/PointerEvents.test.ts +116 -0
- package/e2e/PressStyleNative.noRngh.test.ts +191 -0
- package/e2e/PressStyleNative.test.ts +231 -0
- package/e2e/SafeArea.test.ts +57 -0
- package/e2e/SelectAndroidOnPress.test.ts +181 -0
- package/e2e/SelectRemount.test.ts +137 -0
- package/e2e/SheetDragResist.test.ts +370 -0
- package/e2e/SheetKeyboardDrag.test.ts +249 -0
- package/e2e/SheetScrollableDrag.test.ts +560 -0
- package/e2e/ShorthandVariables.test.ts +53 -0
- package/e2e/ThemeChangeBasic.test.ts +123 -0
- package/e2e/ThemeMutation.test.ts +80 -0
- package/e2e/check-rngh-status.test.ts +31 -0
- package/e2e/jest.config.js +19 -0
- package/e2e/utils/colors.ts +75 -0
- package/e2e/utils/navigation.ts +53 -0
- package/eas.json +22 -0
- package/flows/AlertDialog.yaml +17 -0
- package/flows/OpenApp.yaml +25 -0
- package/flows/Select.yaml +13 -0
- package/flows/Sheet.yaml +12 -0
- package/flows/Tabs.yaml +13 -0
- package/flows/Toast.yaml +14 -0
- package/flows/WarmUp.yaml +24 -0
- package/index.html +21 -0
- package/index.js +17 -0
- package/metro.config.js +64 -0
- package/next-router-shim.ts +9 -0
- package/package.json +118 -0
- package/plans/toast-2.md +471 -0
- package/playwright.config.ts +71 -0
- package/plugins/expo-modules-core-swift6.js +76 -0
- package/pod-install.sh +7 -0
- package/public/favicon.svg +70 -0
- package/public/fonts/inter.css +15 -0
- package/public/fonts/noto-cn.otf +0 -0
- package/public/gui-icon.svg +68 -0
- package/run-detox.sh +230 -0
- package/run-native-tests.sh +4 -0
- package/run-tests-parallel.ts +195 -0
- package/screenshots/Screenshotter.test.tsx +48 -0
- package/src/AnimationDemos.tsx +131 -0
- package/src/App.native.tsx +121 -0
- package/src/App.tsx +121 -0
- package/src/Navigation.tsx +98 -0
- package/src/Sandbox.tsx +87 -0
- package/src/TestDynamicEval.tsx +33 -0
- package/src/TestNativeSheet.tsx +100 -0
- package/src/components/TimedRender.tsx +18 -0
- package/src/constants/test-ids.ts +52 -0
- package/src/features/demos/demo-screen.tsx +72 -0
- package/src/features/home/ColorSchemeListItem.tsx +41 -0
- package/src/features/home/TestBuildAButton.tsx +102 -0
- package/src/features/home/TestSeparator.tsx +0 -0
- package/src/features/home/screen.tsx +285 -0
- package/src/features/testcases/screen.tsx +59 -0
- package/src/features/testcases/test-screen.tsx +50 -0
- package/src/generatedV5Theme.ts +112 -0
- package/src/gui.config.ts +411 -0
- package/src/guy.png +0 -0
- package/src/index.tsx +6 -0
- package/src/provider/index.tsx +18 -0
- package/src/test-gui-stack.tsx +11 -0
- package/src/test.tsx +3 -0
- package/src/useKitchenSinkTheme.tsx +15 -0
- package/src/usecases/ActionsSheetComparison.tsx +194 -0
- package/src/usecases/AnimatePresenceEnterExitCase.tsx +255 -0
- package/src/usecases/AnimatePresenceExitTest.tsx +69 -0
- package/src/usecases/AnimatedByProp.tsx +39 -0
- package/src/usecases/AnimationComprehensiveCase.tsx +2515 -0
- package/src/usecases/AnimationValueLoggingCase.tsx +526 -0
- package/src/usecases/AnimationsWithMediaQueriesCase.tsx +110 -0
- package/src/usecases/Benchmark.tsx +148 -0
- package/src/usecases/BenchmarkSelect.tsx +34 -0
- package/src/usecases/ButtonCircular.tsx +3 -0
- package/src/usecases/ButtonCustom.tsx +33 -0
- package/src/usecases/ButtonIconColor.tsx +18 -0
- package/src/usecases/ButtonInverse.tsx +30 -0
- package/src/usecases/ButtonUnstyled.tsx +31 -0
- package/src/usecases/CheckboxDisabledOnPress.tsx +62 -0
- package/src/usecases/ClickDuringEnterCase.tsx +59 -0
- package/src/usecases/CodeExamplesInput.tsx +9 -0
- package/src/usecases/ColorTokenFallback.tsx +52 -0
- package/src/usecases/CompilerExtraction.tsx +380 -0
- package/src/usecases/ComplexVariants.tsx +164 -0
- package/src/usecases/CrashAdaptSheet.tsx +98 -0
- package/src/usecases/CustomStyledAnimatedPopover.tsx +42 -0
- package/src/usecases/CustomStyledAnimatedTooltip.tsx +72 -0
- package/src/usecases/DOMNodeAPIs.tsx +154 -0
- package/src/usecases/DialogFocusScopeCase.tsx +277 -0
- package/src/usecases/DialogFocusScopeDebug.tsx +85 -0
- package/src/usecases/DialogNestedCase.tsx +121 -0
- package/src/usecases/DialogOpenControlled.tsx +49 -0
- package/src/usecases/DialogPointerEventsCase.tsx +58 -0
- package/src/usecases/DialogScopedCase.tsx +106 -0
- package/src/usecases/DialogSheetAdaptCase.tsx +178 -0
- package/src/usecases/DialogSheetAdaptResizeCase.tsx +98 -0
- package/src/usecases/DismissLayerStackingCase.tsx +223 -0
- package/src/usecases/DriverDisableAnimationPropsCase.tsx +44 -0
- package/src/usecases/Example.tsx +10 -0
- package/src/usecases/ExitCompletionCase.tsx +713 -0
- package/src/usecases/FocusVisibleButton.tsx +14 -0
- package/src/usecases/FocusVisibleButtonPointer.tsx +13 -0
- package/src/usecases/FocusVisibleButtonWithFocusStyle.tsx +16 -0
- package/src/usecases/FocusWithinCase.tsx +55 -0
- package/src/usecases/FontTokensInVariants.tsx +14 -0
- package/src/usecases/FormButtonTypeCase.tsx +34 -0
- package/src/usecases/GlobalScopedTriggerIsolationCase.tsx +178 -0
- package/src/usecases/GroupHoverMobile.tsx +39 -0
- package/src/usecases/GroupPressInVariant.tsx +92 -0
- package/src/usecases/GroupPressNative.tsx +200 -0
- package/src/usecases/GroupProp.tsx +96 -0
- package/src/usecases/GroupPseudoVariantOverride.tsx +56 -0
- package/src/usecases/GroupUseCases.tsx +94 -0
- package/src/usecases/HeightMediaQueryOverrideCase.tsx +183 -0
- package/src/usecases/InputAutoFocusAfterMenuCase.tsx +105 -0
- package/src/usecases/InputAutoFocusStyledCase.tsx +39 -0
- package/src/usecases/KeyboardControllerTest.tsx +146 -0
- package/src/usecases/ListItem.tsx +123 -0
- package/src/usecases/MediaQueriesV5.tsx +137 -0
- package/src/usecases/MediaQueryGtMd.tsx +73 -0
- package/src/usecases/MenuAboveDialogCase.tsx +75 -0
- package/src/usecases/MenuAccessibilityCase.tsx +133 -0
- package/src/usecases/MenuAnimatePositionCase.tsx +41 -0
- package/src/usecases/MenuArrowAnimatePresenceCase.tsx +98 -0
- package/src/usecases/MenuAsChildPositionCase.tsx +24 -0
- package/src/usecases/MenuAutoResizeCase.tsx +57 -0
- package/src/usecases/MenuBottomCase.tsx +55 -0
- package/src/usecases/MenuFocusLeaveCase.tsx +135 -0
- package/src/usecases/MenuHighlightCase.tsx +44 -0
- package/src/usecases/MenuItemFocusCase.tsx +79 -0
- package/src/usecases/MenuItemPseudoOverrideCase.tsx +270 -0
- package/src/usecases/MenuMultiTriggerCase.tsx +47 -0
- package/src/usecases/MenuOverflowCase.tsx +60 -0
- package/src/usecases/MenuSubCase.tsx +223 -0
- package/src/usecases/MenuSubLeftCase.tsx +178 -0
- package/src/usecases/MenuSubNestedPositionCase.tsx +171 -0
- package/src/usecases/MenuSubStyledCase.tsx +145 -0
- package/src/usecases/MenuThemeCase.tsx +50 -0
- package/src/usecases/MenuUnstyledCase.tsx +52 -0
- package/src/usecases/MultiDriverAnimation.tsx +118 -0
- package/src/usecases/NativePortalTest.tsx +179 -0
- package/src/usecases/NewInputBasic.tsx +16 -0
- package/src/usecases/NewInputEvents.tsx +29 -0
- package/src/usecases/NonGuiTextStyledType.tsx +23 -0
- package/src/usecases/OnLayoutCase.tsx +134 -0
- package/src/usecases/OnLayoutScaleCase.tsx +88 -0
- package/src/usecases/OnLayoutStressCase.tsx +353 -0
- package/src/usecases/OpacityModifierCase.tsx +113 -0
- package/src/usecases/OverlayStyled.tsx +66 -0
- package/src/usecases/ParagraphSpanFontInheritance.tsx +53 -0
- package/src/usecases/PlaceholderTextColor.tsx +20 -0
- package/src/usecases/PointerEventsCase.tsx +100 -0
- package/src/usecases/PopoverAndMenuMultiTriggerCase.tsx +138 -0
- package/src/usecases/PopoverCase.tsx +222 -0
- package/src/usecases/PopoverContentStyledPlusAnimations.tsx +44 -0
- package/src/usecases/PopoverFocusScopeCase.tsx +171 -0
- package/src/usecases/PopoverHoverableCase.tsx +167 -0
- package/src/usecases/PopoverHoverableDisableClickCase.tsx +118 -0
- package/src/usecases/PopoverHoverableRapidCase.tsx +103 -0
- package/src/usecases/PopoverHoverableScopedCase.tsx +135 -0
- package/src/usecases/PopoverScopedCase.tsx +76 -0
- package/src/usecases/PopoverTriggerIsolationCase.tsx +80 -0
- package/src/usecases/PressStyleNative.tsx +143 -0
- package/src/usecases/PseudoStyleMerge.tsx +25 -0
- package/src/usecases/PseudoTransitionCase.tsx +174 -0
- package/src/usecases/RawAnimatedValueCase.tsx +231 -0
- package/src/usecases/RemoveScrollCase.tsx +66 -0
- package/src/usecases/RenderPropCase.tsx +263 -0
- package/src/usecases/SafeAreaCase.tsx +236 -0
- package/src/usecases/ScrollViewRefCase.tsx +88 -0
- package/src/usecases/SecondPage.tsx +5 -0
- package/src/usecases/SelectAndroidOnPress.tsx +129 -0
- package/src/usecases/SelectFocusScopeCase.tsx +270 -0
- package/src/usecases/SelectRemount.tsx +136 -0
- package/src/usecases/Shadows.tsx +5 -0
- package/src/usecases/SheetAnimationCase.tsx +155 -0
- package/src/usecases/SheetDragCase.tsx +183 -0
- package/src/usecases/SheetDragResistCase.tsx +433 -0
- package/src/usecases/SheetDragResistCase.web.tsx +359 -0
- package/src/usecases/SheetKeyboardDragCase.tsx +328 -0
- package/src/usecases/SheetKeyboardFitContentCase.tsx +165 -0
- package/src/usecases/SheetOnAnimationCompleteCase.tsx +54 -0
- package/src/usecases/SheetScrollLockCase.tsx +166 -0
- package/src/usecases/SheetScrollableDrag.tsx +249 -0
- package/src/usecases/SheetSnapPointsFitCase.tsx +393 -0
- package/src/usecases/ShorthandVariables.tsx +49 -0
- package/src/usecases/SlowThemeReRender.tsx +48 -0
- package/src/usecases/SpinnerCustomColors.tsx +34 -0
- package/src/usecases/StackZIndex.tsx +82 -0
- package/src/usecases/StressPage.tsx +301 -0
- package/src/usecases/StylePlatform.tsx +30 -0
- package/src/usecases/StyleProp.tsx +29 -0
- package/src/usecases/StyledAnchor.tsx +27 -0
- package/src/usecases/StyledButtonAnimationAuto.tsx +99 -0
- package/src/usecases/StyledButtonTheme.tsx +63 -0
- package/src/usecases/StyledButtonVariantPseudo.tsx +25 -0
- package/src/usecases/StyledButtonVariantPseudoMerge.tsx +77 -0
- package/src/usecases/StyledCheckboxTheme.tsx +23 -0
- package/src/usecases/StyledContextColor.tsx +246 -0
- package/src/usecases/StyledContextTokens.tsx +147 -0
- package/src/usecases/StyledHOCNamed.tsx +20 -0
- package/src/usecases/StyledHtmlCase.tsx +144 -0
- package/src/usecases/StyledIconColor.tsx +19 -0
- package/src/usecases/StyledInputFocusStyle.tsx +21 -0
- package/src/usecases/StyledInputOnFocus.tsx +30 -0
- package/src/usecases/StyledMediaQueryMerge.tsx +95 -0
- package/src/usecases/StyledOverridePsuedo.tsx +26 -0
- package/src/usecases/StyledRNW.tsx +61 -0
- package/src/usecases/StyledStyleableInputOnFocus.tsx +34 -0
- package/src/usecases/StyledStyleableInputVariant.tsx +48 -0
- package/src/usecases/StyledStyledStyleableInputOnFocus.tsx +36 -0
- package/src/usecases/StyledVariantTextColor.tsx +25 -0
- package/src/usecases/StyledViewOnFocus.tsx +32 -0
- package/src/usecases/TabHoverAnimationCase.tsx +212 -0
- package/src/usecases/TextNestedInheritance.tsx +80 -0
- package/src/usecases/ThemeChange.tsx +100 -0
- package/src/usecases/ThemeChangeBasic.tsx +52 -0
- package/src/usecases/ThemeComponentResolution.tsx +119 -0
- package/src/usecases/ThemeConditionalName.tsx +31 -0
- package/src/usecases/ThemeMediaAnimationCase.tsx +39 -0
- package/src/usecases/ThemeMutation.tsx +86 -0
- package/src/usecases/ThemeNested.tsx +103 -0
- package/src/usecases/ThemeReset.tsx +62 -0
- package/src/usecases/ThemeShallowCase.tsx +83 -0
- package/src/usecases/ToastCase.tsx +46 -0
- package/src/usecases/ToggleGroupActiveProps.tsx +40 -0
- package/src/usecases/ToggleGroupXGroupCase.tsx +104 -0
- package/src/usecases/TooltipAnimationCase.tsx +99 -0
- package/src/usecases/TooltipCase.tsx +32 -0
- package/src/usecases/TooltipGlobalPatternCase.tsx +83 -0
- package/src/usecases/TooltipGroupCase.tsx +102 -0
- package/src/usecases/TooltipMultiTriggerCase.tsx +88 -0
- package/src/usecases/TooltipPositionJumpCase.tsx +91 -0
- package/src/usecases/TooltipTriggerInlineCase.tsx +60 -0
- package/src/usecases/TransformMediaQueryMerge.tsx +98 -0
- package/src/usecases/UseCases.tsx +409 -0
- package/src/usecases/UseTheme.tsx +41 -0
- package/src/usecases/V5ThemeBuilderOutput.tsx +231 -0
- package/src/usecases/VariantFontFamily.tsx +25 -0
- package/src/usecases/VariantsOrder.tsx +117 -0
- package/src/usecases/ZIndex.tsx +155 -0
- package/src/usecases/helpers.tsx +44 -0
- package/src/usecases/index.native.ts +122 -0
- package/src/usecases/index.ts +3 -0
- package/src/usecases/index.web.ts +177 -0
- package/tests/AnimatePresenceEnterExit.animated.test.tsx +176 -0
- package/tests/AnimatedByProp.animated.test.tsx +138 -0
- package/tests/AnimationBehavior.animated.test.tsx +543 -0
- package/tests/AnimationTiming.animated.test.tsx +195 -0
- package/tests/AnimationsWithMediaQueries.animated.test.tsx +154 -0
- package/tests/BuildAButton.test.tsx +87 -0
- package/tests/ButtonCircular.test.tsx +17 -0
- package/tests/ButtonCustom.test.tsx +17 -0
- package/tests/ButtonIconColor.test.tsx +23 -0
- package/tests/ButtonUnstyled.test.tsx +56 -0
- package/tests/ClickDuringEnter.animated.test.tsx +174 -0
- package/tests/ColorTokenFallback.test.tsx +45 -0
- package/tests/DOMNodeAPIs.test.tsx +161 -0
- package/tests/DialogFocusScope.animated.test.tsx +309 -0
- package/tests/DialogNested.test.tsx +128 -0
- package/tests/DialogOpenControlled.test.tsx +42 -0
- package/tests/DialogPointerEvents.animated.test.tsx +108 -0
- package/tests/DialogScoped.test.tsx +137 -0
- package/tests/DialogSheetAdapt.test.tsx +68 -0
- package/tests/DialogSheetAdaptResize.test.tsx +161 -0
- package/tests/DismissLayerStacking.test.tsx +292 -0
- package/tests/DriverDisableAnimationProps.animated.test.tsx +157 -0
- package/tests/ExitCompletion.animated.test.tsx +425 -0
- package/tests/ExitTimingCheck.animated.test.ts +34 -0
- package/tests/FocusVisibleButton.test.tsx +41 -0
- package/tests/FocusVisibleButtonPointerFocus.test.tsx +23 -0
- package/tests/FocusVisibleButtonPointerFocusWithFocusStyle.test.tsx +40 -0
- package/tests/FocusWithinStyle.animated.test.tsx +66 -0
- package/tests/FocusWithinStyle.test.tsx +60 -0
- package/tests/FormButtonType.test.tsx +42 -0
- package/tests/GlobalScopedTriggerIsolation.test.tsx +89 -0
- package/tests/GroupHoverMobile.test.tsx +52 -0
- package/tests/GroupPressInVariant.test.tsx +82 -0
- package/tests/GroupProp.test.tsx +30 -0
- package/tests/GroupPseudoVariantOverride.test.tsx +57 -0
- package/tests/GroupUseCases.test.tsx +111 -0
- package/tests/GuiSiteMotion.test.ts +481 -0
- package/tests/HeightMediaQueryOverride.test.tsx +112 -0
- package/tests/InputAutoFocusAfterMenu.test.tsx +55 -0
- package/tests/InputAutoFocusStyled.test.tsx +22 -0
- package/tests/ListItem.test.tsx +129 -0
- package/tests/MediaQueriesV5.test.tsx +113 -0
- package/tests/MediaQueryGtMd.test.tsx +84 -0
- package/tests/MenuAboveDialog.test.tsx +108 -0
- package/tests/MenuAccessibility.test.tsx +346 -0
- package/tests/MenuAnimatePosition.animated.test.tsx +57 -0
- package/tests/MenuArrowAnimatePresence.animated.test.tsx +71 -0
- package/tests/MenuAsChildPosition.test.tsx +16 -0
- package/tests/MenuAutoResize.test.tsx +54 -0
- package/tests/MenuFocusLeave.test.tsx +181 -0
- package/tests/MenuHighlight.test.tsx +165 -0
- package/tests/MenuHoverKeyboardBugs.test.tsx +252 -0
- package/tests/MenuItemFocus.test.tsx +59 -0
- package/tests/MenuItemPseudoOverride.test.tsx +231 -0
- package/tests/MenuMultiTrigger.test.tsx +101 -0
- package/tests/MenuOverflow.test.tsx +93 -0
- package/tests/MenuStayInFrame.test.tsx +102 -0
- package/tests/MenuSubKeyboardFocus.test.tsx +220 -0
- package/tests/MenuSubLeftSafePolygon.test.tsx +88 -0
- package/tests/MenuSubNestedPosition.test.tsx +48 -0
- package/tests/MenuSubSafePolygon.test.tsx +97 -0
- package/tests/MenuSubStyled.test.tsx +40 -0
- package/tests/MenuTheme.test.tsx +34 -0
- package/tests/MenuUnstyled.test.tsx +56 -0
- package/tests/MultiDriverAnimation.test.tsx +207 -0
- package/tests/NewInputBasic.test.tsx +50 -0
- package/tests/NewInputEvents.test.tsx +55 -0
- package/tests/OnLayout.test.tsx +163 -0
- package/tests/OnLayoutScale.test.tsx +100 -0
- package/tests/OnLayoutStress.test.tsx +304 -0
- package/tests/ParagraphSpanFontInheritance.test.tsx +73 -0
- package/tests/PointerEvents.test.tsx +123 -0
- package/tests/Popover.animated.test.tsx +234 -0
- package/tests/PopoverAndMenuMultiTrigger.test.tsx +184 -0
- package/tests/PopoverAnimatePosition.animated.test.tsx +51 -0
- package/tests/PopoverClickDuringEnter.animated.test.tsx +197 -0
- package/tests/PopoverFocusScope.test.tsx +242 -0
- package/tests/PopoverHoverable.test.tsx +383 -0
- package/tests/PopoverHoverableDisableClick.test.tsx +106 -0
- package/tests/PopoverHoverableRapid.test.tsx +129 -0
- package/tests/PopoverHoverableReposition.test.tsx +111 -0
- package/tests/PopoverHoverableScoped.animated.test.tsx +103 -0
- package/tests/PopoverHoverableStress.test.tsx +169 -0
- package/tests/PopoverInitialPosition.animated.test.tsx +82 -0
- package/tests/PopoverMiddlewareSkipRegression.animated.test.tsx +221 -0
- package/tests/PopoverScoped.test.tsx +128 -0
- package/tests/PopoverScopedPositionGlitch.animated.test.tsx +184 -0
- package/tests/PopoverTriggerIsolation.test.tsx +62 -0
- package/tests/PseudoTransition.animated.test.tsx +319 -0
- package/tests/RawAnimatedValue.test.tsx +147 -0
- package/tests/RemoveScroll.test.tsx +223 -0
- package/tests/RenderProp.test.tsx +293 -0
- package/tests/ScrollViewRef.test.tsx +39 -0
- package/tests/SelectClickHold.test.tsx +147 -0
- package/tests/SelectFocusScope.test.tsx +176 -0
- package/tests/SelectInnerPositioning.test.tsx +82 -0
- package/tests/SelectKeyboardNav.test.tsx +173 -0
- package/tests/SelectPositioning.test.tsx +56 -0
- package/tests/SelectTypeahead.test.tsx +63 -0
- package/tests/Shadows.test.tsx +14 -0
- package/tests/SheetAnimation.animated.test.tsx +413 -0
- package/tests/SheetDrag.animated.test.tsx +223 -0
- package/tests/SheetDragResist.animated.test.tsx +393 -0
- package/tests/SheetOnAnimationComplete.animated.test.tsx +62 -0
- package/tests/SheetScrollLock.animated.test.tsx +287 -0
- package/tests/SheetScrollableDrag.animated.test.tsx +1264 -0
- package/tests/SheetSnapPointsFit.animated.test.tsx +259 -0
- package/tests/ShorthandVariables.test.tsx +44 -0
- package/tests/SpinnerCustomColors.test.tsx +67 -0
- package/tests/StackZIndex.test.tsx +51 -0
- package/tests/StressPagePerf.test.tsx +76 -0
- package/tests/StylePlatform.test.tsx +38 -0
- package/tests/StyleProp.test.tsx +20 -0
- package/tests/StyledAnchor.test.tsx +17 -0
- package/tests/StyledButtonTheme.test.tsx +22 -0
- package/tests/StyledButtonVariantPseudo.test.tsx +20 -0
- package/tests/StyledButtonVariantPseudoMerge.animated.test.tsx +33 -0
- package/tests/StyledCheckboxTheme.test.tsx +16 -0
- package/tests/StyledContextColor.test.tsx +119 -0
- package/tests/StyledContextTokens.test.tsx +56 -0
- package/tests/StyledHOCNamed.test.tsx +16 -0
- package/tests/StyledHtml.test.tsx +161 -0
- package/tests/StyledIconColor.test.tsx +32 -0
- package/tests/StyledInputFocusStyle.test.tsx +19 -0
- package/tests/StyledInputOnFocus.test.tsx +27 -0
- package/tests/StyledMediaQueryMerge.test.tsx +66 -0
- package/tests/StyledRNW.test.tsx +17 -0
- package/tests/StyledStyleableInputOnFocus.test.tsx +27 -0
- package/tests/StyledStyleableInputVariant.test.tsx +22 -0
- package/tests/StyledStyledStyleableInputOnFocus.test.tsx +27 -0
- package/tests/StyledVariantTextColor.test.tsx +24 -0
- package/tests/StyledViewOnFocus.test.tsx +27 -0
- package/tests/TabHoverAnimation.animated.test.tsx +468 -0
- package/tests/TabHoverPositionSmooth.animated.test.tsx +129 -0
- package/tests/TextNestedInheritance.test.tsx +93 -0
- package/tests/ThemeChange.test.tsx +70 -0
- package/tests/ThemeComponentResolution.test.tsx +82 -0
- package/tests/ThemeConditionalName.test.tsx +34 -0
- package/tests/ThemeMediaAnimation.test.tsx +65 -0
- package/tests/ThemeNested.test.tsx +141 -0
- package/tests/ThemeReset.test.tsx +63 -0
- package/tests/ThemeShallow.test.tsx +95 -0
- package/tests/Toast.test.tsx +106 -0
- package/tests/ToggleGroup.test.tsx +61 -0
- package/tests/ToggleGroupActiveProps.test.tsx +38 -0
- package/tests/ToggleGroupXGroup.test.tsx +172 -0
- package/tests/TooltipAnimation.animated.test.tsx +260 -0
- package/tests/TooltipEnterInterrupt.animated.test.tsx +76 -0
- package/tests/TooltipGlobalPattern.animated.test.tsx +208 -0
- package/tests/TooltipGroup.animated.test.tsx +79 -0
- package/tests/TooltipMultiTrigger.test.tsx +116 -0
- package/tests/TooltipPositionJump.animated.test.tsx +229 -0
- package/tests/TooltipPositionJumpNotes.md +219 -0
- package/tests/TooltipRapidSwitch.animated.test.tsx +399 -0
- package/tests/TooltipTriggerInline.test.tsx +65 -0
- package/tests/TransformMediaQueryMerge.test.tsx +104 -0
- package/tests/TransitionEnterExit.animated.test.tsx +311 -0
- package/tests/UseTheme.test.tsx +16 -0
- package/tests/V5ThemeBuilderOutput.test.tsx +164 -0
- package/tests/VariantFontFamily.test.tsx +11 -0
- package/tests/VariantsOrder.test.tsx +53 -0
- package/tests/_debug_position.mjs +52 -0
- package/tests/test-utils.ts +106 -0
- package/tests/utils.tsx +54 -0
- package/tsconfig.json +45 -0
- package/vite-env.d.ts +1 -0
- package/vite.config.ts +14 -0
- package/webpack.config.js +139 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button, Card, Square, Theme, YStack, Text } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
import { TEST_IDS } from '../constants/test-ids'
|
|
5
|
+
|
|
6
|
+
export function ThemeChange() {
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<Inner level={0}>
|
|
10
|
+
<Inner level={1}>
|
|
11
|
+
<Card width={100} height={100} />
|
|
12
|
+
</Inner>
|
|
13
|
+
</Inner>
|
|
14
|
+
</>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function Inner({
|
|
19
|
+
children,
|
|
20
|
+
level,
|
|
21
|
+
}: {
|
|
22
|
+
children?: React.ReactNode
|
|
23
|
+
level: number
|
|
24
|
+
}) {
|
|
25
|
+
const themes = [
|
|
26
|
+
'yellow',
|
|
27
|
+
'blue',
|
|
28
|
+
'orange',
|
|
29
|
+
'green',
|
|
30
|
+
'purple',
|
|
31
|
+
'pink',
|
|
32
|
+
'red',
|
|
33
|
+
'gray',
|
|
34
|
+
] as const
|
|
35
|
+
const [themeIndex, setThemeIndex] = React.useState(0)
|
|
36
|
+
const theme = themes[themeIndex]
|
|
37
|
+
|
|
38
|
+
const cycleTheme = () => {
|
|
39
|
+
setThemeIndex((prevIndex) => (prevIndex + 1) % themes.length)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<YStack
|
|
44
|
+
borderWidth={1}
|
|
45
|
+
borderColor="red"
|
|
46
|
+
padding="$4"
|
|
47
|
+
alignItems="center"
|
|
48
|
+
justifyContent="center"
|
|
49
|
+
gap="$5"
|
|
50
|
+
>
|
|
51
|
+
<Text id={`${TEST_IDS.themeInfo}-${level}`}>
|
|
52
|
+
<Text fontWeight="bold">Inner</Text> {JSON.stringify({ theme })}
|
|
53
|
+
</Text>
|
|
54
|
+
|
|
55
|
+
<Button
|
|
56
|
+
id={`${TEST_IDS.changeThemeButton}-${level}`}
|
|
57
|
+
onPress={() => {
|
|
58
|
+
cycleTheme()
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
Change Theme
|
|
62
|
+
</Button>
|
|
63
|
+
|
|
64
|
+
<Theme name={theme}>
|
|
65
|
+
<SandboxThemeChildStatic level={level} />
|
|
66
|
+
<SandboxThemeChildDynamic level={level} />
|
|
67
|
+
<YStack gap="$2">
|
|
68
|
+
<Theme name="accent">
|
|
69
|
+
<Button>Accent</Button>
|
|
70
|
+
</Theme>
|
|
71
|
+
<Button>Normal</Button>
|
|
72
|
+
</YStack>
|
|
73
|
+
|
|
74
|
+
{children}
|
|
75
|
+
</Theme>
|
|
76
|
+
</YStack>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const SandboxThemeChildStatic = React.memo(({ level }: { level: number }) => {
|
|
81
|
+
return (
|
|
82
|
+
<Square
|
|
83
|
+
id={`${TEST_IDS.staticSquare}-${level}`}
|
|
84
|
+
size={20}
|
|
85
|
+
backgroundColor="$color10"
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const SandboxThemeChildDynamic = React.memo(({ level }: { level: number }) => {
|
|
91
|
+
return (
|
|
92
|
+
<Square
|
|
93
|
+
id={`${TEST_IDS.dynamicSquare}-${level}`}
|
|
94
|
+
transition="bouncy"
|
|
95
|
+
size={20}
|
|
96
|
+
backgroundColor="$color10"
|
|
97
|
+
animateOnly={['backgroundColor']}
|
|
98
|
+
/>
|
|
99
|
+
)
|
|
100
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, Text, Theme, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Basic theme change test - no animations involved.
|
|
6
|
+
* Tests that <Theme name="X"> correctly updates child styling when X changes.
|
|
7
|
+
*
|
|
8
|
+
* This is the simplest possible theme change scenario:
|
|
9
|
+
* 1. View with bg="$color4" inside Theme
|
|
10
|
+
* 2. Button to toggle theme between "red" and "blue"
|
|
11
|
+
* 3. View color should change accordingly
|
|
12
|
+
*
|
|
13
|
+
* Bug report: with react-native and reanimated animation drivers,
|
|
14
|
+
* the theme change does not visually update. The verbose log shows:
|
|
15
|
+
* useTheme(«id») getNextState => null needsUpdate false shouldRerender false
|
|
16
|
+
*/
|
|
17
|
+
export function ThemeChangeBasic() {
|
|
18
|
+
const [themeName, setThemeName] = useState<'red' | 'blue'>('red')
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<YStack padding="$4" gap="$4" alignItems="center" testID="theme-change-basic-root">
|
|
22
|
+
<Text testID="theme-change-basic-label">Current theme: {themeName}</Text>
|
|
23
|
+
|
|
24
|
+
<Button
|
|
25
|
+
testID="theme-change-basic-toggle"
|
|
26
|
+
onPress={() => setThemeName((t) => (t === 'red' ? 'blue' : 'red'))}
|
|
27
|
+
>
|
|
28
|
+
Toggle Theme
|
|
29
|
+
</Button>
|
|
30
|
+
|
|
31
|
+
<Theme name={themeName}>
|
|
32
|
+
{/*
|
|
33
|
+
This exact pattern was reported as broken with native/reanimated drivers.
|
|
34
|
+
The YStack's bg="$color4" should change color when theme changes.
|
|
35
|
+
*/}
|
|
36
|
+
<YStack
|
|
37
|
+
testID="theme-change-basic-square"
|
|
38
|
+
width={200}
|
|
39
|
+
height={200}
|
|
40
|
+
alignItems="center"
|
|
41
|
+
justifyContent="center"
|
|
42
|
+
backgroundColor="$color4"
|
|
43
|
+
borderRadius={14}
|
|
44
|
+
>
|
|
45
|
+
<Text color="$color12" fontWeight="bold">
|
|
46
|
+
{themeName.toUpperCase()}
|
|
47
|
+
</Text>
|
|
48
|
+
</YStack>
|
|
49
|
+
</Theme>
|
|
50
|
+
</YStack>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Square, Text, Theme, useThemeName, YStack } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
import { TEST_IDS } from '../constants/test-ids'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Test cases for theme component resolution (commit 5839319146 goals)
|
|
7
|
+
*
|
|
8
|
+
* These tests verify that the theme resolution algorithm correctly handles:
|
|
9
|
+
* 1. Explicit scheme overrides (e.g., dark_green inside blue parent)
|
|
10
|
+
* 2. Inheriting scheme from parent for component themes
|
|
11
|
+
* 3. Preserving sub-themes when only componentName is provided (no backtracking)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function ThemeNameDisplay({ id }: { id: string }) {
|
|
15
|
+
const themeName = useThemeName()
|
|
16
|
+
return (
|
|
17
|
+
<Square
|
|
18
|
+
id={id}
|
|
19
|
+
bg="$background"
|
|
20
|
+
size={100}
|
|
21
|
+
alignItems="center"
|
|
22
|
+
justifyContent="center"
|
|
23
|
+
>
|
|
24
|
+
<Text fontSize="$2" color="$color">
|
|
25
|
+
{themeName}
|
|
26
|
+
</Text>
|
|
27
|
+
</Square>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function ThemeComponentResolution() {
|
|
32
|
+
return (
|
|
33
|
+
<YStack gap="$4" padding="$4">
|
|
34
|
+
<Text fontWeight="bold" fontSize="$6">
|
|
35
|
+
Theme Component Resolution Tests
|
|
36
|
+
</Text>
|
|
37
|
+
|
|
38
|
+
{/* Goal 1a: Explicit scheme override */}
|
|
39
|
+
<YStack gap="$2">
|
|
40
|
+
<Text fontWeight="bold">Goal 1a: Explicit scheme override</Text>
|
|
41
|
+
<Text fontSize="$2">
|
|
42
|
+
When theme="dark_green" is set explicitly, it should be used even inside a blue
|
|
43
|
+
parent
|
|
44
|
+
</Text>
|
|
45
|
+
|
|
46
|
+
{/* Direct: dark_green theme */}
|
|
47
|
+
<YStack gap="$1">
|
|
48
|
+
<Text>Direct dark_green:</Text>
|
|
49
|
+
<Theme name="dark_green">
|
|
50
|
+
<ThemeNameDisplay id={TEST_IDS.themeExplicitSchemeDirect} />
|
|
51
|
+
</Theme>
|
|
52
|
+
</YStack>
|
|
53
|
+
|
|
54
|
+
{/* Nested: blue parent, dark_green child */}
|
|
55
|
+
<YStack gap="$1">
|
|
56
|
+
<Text>Nested: blue → dark_green (should match above):</Text>
|
|
57
|
+
<Theme name="blue">
|
|
58
|
+
<Theme name="dark_green">
|
|
59
|
+
<ThemeNameDisplay id={TEST_IDS.themeExplicitSchemeNested} />
|
|
60
|
+
</Theme>
|
|
61
|
+
</Theme>
|
|
62
|
+
</YStack>
|
|
63
|
+
</YStack>
|
|
64
|
+
|
|
65
|
+
{/* Goal 1b: Inherit scheme for component */}
|
|
66
|
+
<YStack gap="$2">
|
|
67
|
+
<Text fontWeight="bold">Goal 1b: Inherit scheme from parent</Text>
|
|
68
|
+
<Text fontSize="$2">
|
|
69
|
+
When theme="green" (no scheme), it should inherit light/dark from parent
|
|
70
|
+
</Text>
|
|
71
|
+
|
|
72
|
+
{/* Direct: light_green theme */}
|
|
73
|
+
<YStack gap="$1">
|
|
74
|
+
<Text>Direct light_green:</Text>
|
|
75
|
+
<Theme name="light_green">
|
|
76
|
+
<ThemeNameDisplay id={TEST_IDS.themeInheritSchemeDirect} />
|
|
77
|
+
</Theme>
|
|
78
|
+
</YStack>
|
|
79
|
+
|
|
80
|
+
{/* Nested: light → green should become light_green */}
|
|
81
|
+
<YStack gap="$1">
|
|
82
|
+
<Text>Nested: light → green (should become light_green):</Text>
|
|
83
|
+
<Theme name="light">
|
|
84
|
+
<Theme name="green">
|
|
85
|
+
<ThemeNameDisplay id={TEST_IDS.themeInheritSchemeNested} />
|
|
86
|
+
</Theme>
|
|
87
|
+
</Theme>
|
|
88
|
+
</YStack>
|
|
89
|
+
</YStack>
|
|
90
|
+
|
|
91
|
+
{/* Goal 2: Component-only preserves sub-theme */}
|
|
92
|
+
<YStack gap="$2">
|
|
93
|
+
<Text fontWeight="bold">Goal 2: Sub-theme preservation</Text>
|
|
94
|
+
<Text fontSize="$2">
|
|
95
|
+
When inside surface1 sub-theme, components should NOT backtrack to find a
|
|
96
|
+
component theme
|
|
97
|
+
</Text>
|
|
98
|
+
|
|
99
|
+
{/* Direct: light_blue_surface1 */}
|
|
100
|
+
<YStack gap="$1">
|
|
101
|
+
<Text>Direct light_blue_surface1:</Text>
|
|
102
|
+
<Theme name="light_blue_surface1">
|
|
103
|
+
<ThemeNameDisplay id={TEST_IDS.themeSurface1Direct} />
|
|
104
|
+
</Theme>
|
|
105
|
+
</YStack>
|
|
106
|
+
|
|
107
|
+
{/* Nested: blue → surface1, then a Button (should stay on surface1, not get Button theme) */}
|
|
108
|
+
<YStack gap="$1">
|
|
109
|
+
<Text>Nested: blue → surface1 (component should stay on surface1):</Text>
|
|
110
|
+
<Theme name="blue">
|
|
111
|
+
<Theme name="surface1">
|
|
112
|
+
<ThemeNameDisplay id={TEST_IDS.themeSurface1WithComponent} />
|
|
113
|
+
</Theme>
|
|
114
|
+
</Theme>
|
|
115
|
+
</YStack>
|
|
116
|
+
</YStack>
|
|
117
|
+
</YStack>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button, Square, Text, Theme, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tests that <Theme name={active ? 'accent' : undefined}> correctly
|
|
6
|
+
* reverts to the parent theme when the condition becomes false.
|
|
7
|
+
*
|
|
8
|
+
* Regression test for: commit c85f5e72ecbc6599bb164f702edcaef147214e87
|
|
9
|
+
* The optimization in getNextState incorrectly returned stale theme state
|
|
10
|
+
* when name changed from a value to undefined.
|
|
11
|
+
*/
|
|
12
|
+
export function ThemeConditionalName() {
|
|
13
|
+
const [active, setActive] = useState(false)
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<YStack padding="$4" gap="$4" alignItems="center">
|
|
17
|
+
<Text id="theme-conditional-label">active: {String(active)}</Text>
|
|
18
|
+
|
|
19
|
+
<Button id="theme-conditional-toggle" onPress={() => setActive((a) => !a)}>
|
|
20
|
+
Toggle
|
|
21
|
+
</Button>
|
|
22
|
+
|
|
23
|
+
{/* parent theme square for color comparison */}
|
|
24
|
+
<Square id="theme-conditional-parent" size={60} backgroundColor="$background" />
|
|
25
|
+
|
|
26
|
+
<Theme name={active ? 'accent' : undefined}>
|
|
27
|
+
<Square id="theme-conditional-child" size={60} backgroundColor="$background" />
|
|
28
|
+
</Theme>
|
|
29
|
+
</YStack>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Square, YStack, Text } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Test case for $theme-dark/$theme-light with animation drivers.
|
|
5
|
+
*
|
|
6
|
+
* Bug: When using an inline animation driver (e.g., motion), base styles are
|
|
7
|
+
* applied as inline styles which override theme media CSS classes due to
|
|
8
|
+
* CSS specificity. This means $theme-dark and $theme-light have no effect.
|
|
9
|
+
*/
|
|
10
|
+
export function ThemeMediaAnimationCase() {
|
|
11
|
+
return (
|
|
12
|
+
<YStack p="$4" gap="$4">
|
|
13
|
+
<Text fontSize="$5" fontWeight="bold">
|
|
14
|
+
Theme Media + Animation
|
|
15
|
+
</Text>
|
|
16
|
+
|
|
17
|
+
<Square
|
|
18
|
+
testID="theme-media-animated"
|
|
19
|
+
data-testid="theme-media-animated"
|
|
20
|
+
size={100}
|
|
21
|
+
bg="$color1"
|
|
22
|
+
transition="quick"
|
|
23
|
+
$theme-dark={{
|
|
24
|
+
bg: '$color3',
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<Square
|
|
29
|
+
testID="theme-media-static"
|
|
30
|
+
data-testid="theme-media-static"
|
|
31
|
+
size={100}
|
|
32
|
+
bg="$color1"
|
|
33
|
+
$theme-dark={{
|
|
34
|
+
bg: '$color3',
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
</YStack>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { addTheme, updateTheme } from '@hanzogui/theme'
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Square,
|
|
6
|
+
Text,
|
|
7
|
+
Theme,
|
|
8
|
+
YStack,
|
|
9
|
+
useIsomorphicLayoutEffect,
|
|
10
|
+
} from '@hanzo/gui'
|
|
11
|
+
|
|
12
|
+
import { TEST_IDS } from '../constants/test-ids'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Test case for theme mutation with DynamicColorIOS optimization.
|
|
16
|
+
*
|
|
17
|
+
* This tests that when updateTheme() is called, components correctly
|
|
18
|
+
* re-render to show the new theme values - even when using DynamicColorIOS
|
|
19
|
+
* optimization on iOS (which normally avoids tracking theme keys).
|
|
20
|
+
*
|
|
21
|
+
* The fix ensures forceUpdateThemes() properly triggers re-renders
|
|
22
|
+
* regardless of whether theme keys were tracked.
|
|
23
|
+
*/
|
|
24
|
+
export function ThemeMutation() {
|
|
25
|
+
const [themeName, setThemeName] = React.useState<string | null>(null)
|
|
26
|
+
const [currentColor, setCurrentColor] = React.useState('red')
|
|
27
|
+
|
|
28
|
+
// Create the custom theme on mount
|
|
29
|
+
useIsomorphicLayoutEffect(() => {
|
|
30
|
+
addTheme({
|
|
31
|
+
name: 'mutation-test',
|
|
32
|
+
insertCSS: true,
|
|
33
|
+
theme: {
|
|
34
|
+
background: 'red',
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
setThemeName('mutation-test')
|
|
38
|
+
}, [])
|
|
39
|
+
|
|
40
|
+
const colors = ['red', 'blue', 'green', 'purple', 'orange'] as const
|
|
41
|
+
|
|
42
|
+
const cycleColor = () => {
|
|
43
|
+
const currentIndex = colors.indexOf(currentColor as (typeof colors)[number])
|
|
44
|
+
const nextIndex = (currentIndex + 1) % colors.length
|
|
45
|
+
const nextColor = colors[nextIndex]
|
|
46
|
+
|
|
47
|
+
updateTheme({
|
|
48
|
+
name: 'mutation-test',
|
|
49
|
+
theme: {
|
|
50
|
+
background: nextColor,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
// Update state to track what color we expect
|
|
55
|
+
// Note: We do NOT call useForceUpdate() here - the fix should make
|
|
56
|
+
// forceUpdateThemes() (called internally by updateTheme) work properly
|
|
57
|
+
setCurrentColor(nextColor)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!themeName) {
|
|
61
|
+
return (
|
|
62
|
+
<YStack padding="$4" alignItems="center" gap="$4">
|
|
63
|
+
<Text>Loading theme...</Text>
|
|
64
|
+
</YStack>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<YStack padding="$4" alignItems="center" gap="$4">
|
|
70
|
+
<Text testID={TEST_IDS.themeMutationColorText}>Expected color: {currentColor}</Text>
|
|
71
|
+
|
|
72
|
+
<Theme name={themeName as any}>
|
|
73
|
+
<Square
|
|
74
|
+
testID={TEST_IDS.themeMutationSquare}
|
|
75
|
+
size={100}
|
|
76
|
+
backgroundColor="$background"
|
|
77
|
+
borderRadius="$4"
|
|
78
|
+
/>
|
|
79
|
+
</Theme>
|
|
80
|
+
|
|
81
|
+
<Button testID={TEST_IDS.themeMutationButton} onPress={cycleColor}>
|
|
82
|
+
Change Theme Color
|
|
83
|
+
</Button>
|
|
84
|
+
</YStack>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Square, Theme, YStack, Text } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
import { TEST_IDS } from '../constants/test-ids'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Test case for GitHub issue #3673: Nested theme regression
|
|
8
|
+
*
|
|
9
|
+
* When using nested themes like <Theme name="blue"><Theme name="surface3">,
|
|
10
|
+
* the parent color context (blue) should be preserved, resulting in
|
|
11
|
+
* light_blue_surface3 theme being applied.
|
|
12
|
+
*
|
|
13
|
+
* The bug causes the nested theme to lose the color context, resulting in
|
|
14
|
+
* just light_surface3 being applied instead.
|
|
15
|
+
*/
|
|
16
|
+
export function ThemeNested() {
|
|
17
|
+
return (
|
|
18
|
+
<YStack gap="$4" padding="$4">
|
|
19
|
+
<Text fontWeight="bold" fontSize="$6">
|
|
20
|
+
Nested Theme Test (Issue #3673)
|
|
21
|
+
</Text>
|
|
22
|
+
|
|
23
|
+
{/* Test Case 1: Direct theme vs nested theme comparison */}
|
|
24
|
+
<YStack gap="$2">
|
|
25
|
+
<Text fontWeight="bold">Case 1: Direct light_blue_surface3</Text>
|
|
26
|
+
<Theme name="light_blue_surface3">
|
|
27
|
+
<Square id={TEST_IDS.nestedThemeDirect} bg="$background" size={100} />
|
|
28
|
+
</Theme>
|
|
29
|
+
</YStack>
|
|
30
|
+
|
|
31
|
+
<YStack gap="$2">
|
|
32
|
+
<Text fontWeight="bold">
|
|
33
|
+
Case 2: Nested blue → surface3 (should match Case 1)
|
|
34
|
+
</Text>
|
|
35
|
+
<Theme name="blue">
|
|
36
|
+
<Theme name="surface3">
|
|
37
|
+
<Square id={TEST_IDS.nestedThemeNested} bg="$background" size={100} />
|
|
38
|
+
</Theme>
|
|
39
|
+
</Theme>
|
|
40
|
+
</YStack>
|
|
41
|
+
|
|
42
|
+
{/* Test Case 2: With explicit light parent */}
|
|
43
|
+
<YStack gap="$2">
|
|
44
|
+
<Text fontWeight="bold">Case 3: Nested light → blue → surface3</Text>
|
|
45
|
+
<Theme name="light">
|
|
46
|
+
<Theme name="blue">
|
|
47
|
+
<Theme name="surface3">
|
|
48
|
+
<Square id={TEST_IDS.nestedThemeWithParent} bg="$background" size={100} />
|
|
49
|
+
</Theme>
|
|
50
|
+
</Theme>
|
|
51
|
+
</Theme>
|
|
52
|
+
</YStack>
|
|
53
|
+
|
|
54
|
+
{/* Test Case 3: Different color - red */}
|
|
55
|
+
<YStack gap="$2">
|
|
56
|
+
<Text fontWeight="bold">Case 4: Direct light_red_surface3</Text>
|
|
57
|
+
<Theme name="light_red_surface3">
|
|
58
|
+
<Square id={TEST_IDS.nestedThemeRedDirect} bg="$background" size={100} />
|
|
59
|
+
</Theme>
|
|
60
|
+
</YStack>
|
|
61
|
+
|
|
62
|
+
<YStack gap="$2">
|
|
63
|
+
<Text fontWeight="bold">Case 5: Nested red → surface3 (should match Case 4)</Text>
|
|
64
|
+
<Theme name="red">
|
|
65
|
+
<Theme name="surface3">
|
|
66
|
+
<Square id={TEST_IDS.nestedThemeRedNested} bg="$background" size={100} />
|
|
67
|
+
</Theme>
|
|
68
|
+
</Theme>
|
|
69
|
+
</YStack>
|
|
70
|
+
|
|
71
|
+
{/* Test Case 4: Verify blue and red are different */}
|
|
72
|
+
<YStack gap="$2">
|
|
73
|
+
<Text fontWeight="bold">Case 6: Direct light_surface3 (no color - baseline)</Text>
|
|
74
|
+
<Theme name="light_surface3">
|
|
75
|
+
<Square id={TEST_IDS.nestedThemeNoColor} bg="$background" size={100} />
|
|
76
|
+
</Theme>
|
|
77
|
+
</YStack>
|
|
78
|
+
|
|
79
|
+
{/* Test Case 5: Exact reproduction from issue #3673 - surface1 → surface3 */}
|
|
80
|
+
<YStack gap="$2">
|
|
81
|
+
<Text fontWeight="bold">
|
|
82
|
+
Case 7: Direct light_blue_surface3 (expected result)
|
|
83
|
+
</Text>
|
|
84
|
+
<Theme name="light_blue_surface3">
|
|
85
|
+
<Square id={TEST_IDS.nestedSurface1To3Direct} bg="$background" size={100} />
|
|
86
|
+
</Theme>
|
|
87
|
+
</YStack>
|
|
88
|
+
|
|
89
|
+
<YStack gap="$2">
|
|
90
|
+
<Text fontWeight="bold">
|
|
91
|
+
Case 8: Nested blue → surface1 → surface3 (should match Case 7)
|
|
92
|
+
</Text>
|
|
93
|
+
<Theme name="blue">
|
|
94
|
+
<Theme name="surface1">
|
|
95
|
+
<Theme name="surface3">
|
|
96
|
+
<Square id={TEST_IDS.nestedSurface1To3Nested} bg="$background" size={100} />
|
|
97
|
+
</Theme>
|
|
98
|
+
</Theme>
|
|
99
|
+
</Theme>
|
|
100
|
+
</YStack>
|
|
101
|
+
</YStack>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Button, Square, Theme, YStack, Text } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
import { TEST_IDS } from '../constants/test-ids'
|
|
4
|
+
|
|
5
|
+
export function ThemeReset() {
|
|
6
|
+
return (
|
|
7
|
+
<YStack gap="$4" padding="$4">
|
|
8
|
+
<Text fontWeight="bold" fontSize="$6">
|
|
9
|
+
Theme Reset Test Cases
|
|
10
|
+
</Text>
|
|
11
|
+
|
|
12
|
+
{/* Test Case 1: Reset from nested themes */}
|
|
13
|
+
<YStack gap="$2">
|
|
14
|
+
<Text fontWeight="bold">Case 1: Reset from dark → pink → blue</Text>
|
|
15
|
+
<Theme name="dark">
|
|
16
|
+
<Theme name="pink">
|
|
17
|
+
<Theme name="blue">
|
|
18
|
+
<Theme reset>
|
|
19
|
+
<Button id={TEST_IDS.resetButton1}>
|
|
20
|
+
Button should be dark (grandparent)
|
|
21
|
+
</Button>
|
|
22
|
+
</Theme>
|
|
23
|
+
</Theme>
|
|
24
|
+
</Theme>
|
|
25
|
+
</Theme>
|
|
26
|
+
</YStack>
|
|
27
|
+
|
|
28
|
+
{/* Test Case 2: Reset from dark → pink (documentation example) */}
|
|
29
|
+
<YStack gap="$2">
|
|
30
|
+
<Text fontWeight="bold">Case 2: Reset from dark → pink (doc example)</Text>
|
|
31
|
+
<Theme name="dark">
|
|
32
|
+
<Theme name="pink">
|
|
33
|
+
<Theme reset>
|
|
34
|
+
<Square id={TEST_IDS.resetSquare1} bg="$background" size={50} />
|
|
35
|
+
</Theme>
|
|
36
|
+
</Theme>
|
|
37
|
+
</Theme>
|
|
38
|
+
</YStack>
|
|
39
|
+
|
|
40
|
+
{/* Test Case 3: Reset from dark only */}
|
|
41
|
+
<YStack gap="$2">
|
|
42
|
+
<Text fontWeight="bold">Case 3: Reset from dark only</Text>
|
|
43
|
+
<Theme name="dark">
|
|
44
|
+
<Theme reset>
|
|
45
|
+
<Square id={TEST_IDS.resetSquare2} bg="$background" size={50} />
|
|
46
|
+
</Theme>
|
|
47
|
+
</Theme>
|
|
48
|
+
</YStack>
|
|
49
|
+
|
|
50
|
+
{/* Test Case 4: Reset from dark with button */}
|
|
51
|
+
<YStack gap="$2">
|
|
52
|
+
<Text fontWeight="bold">Case 4: Reset from dark with button</Text>
|
|
53
|
+
<Theme name="dark">
|
|
54
|
+
<Button id={TEST_IDS.darkButton}>I was born in the dark</Button>
|
|
55
|
+
<Theme reset>
|
|
56
|
+
<Button id={TEST_IDS.resetButton2}>I want to go back to the light</Button>
|
|
57
|
+
</Theme>
|
|
58
|
+
</Theme>
|
|
59
|
+
</YStack>
|
|
60
|
+
</YStack>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Square, View, Text, Theme, YStack } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
import { TEST_IDS } from '../constants/test-ids'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Test case for themeShallow prop behavior
|
|
7
|
+
*
|
|
8
|
+
* The themeShallow prop should NOT affect DOM structure (span wrapping).
|
|
9
|
+
* It only affects whether grandchildren inherit the theme change.
|
|
10
|
+
*
|
|
11
|
+
* This test verifies that toggling themeShallow doesn't cause DOM reparenting.
|
|
12
|
+
*/
|
|
13
|
+
export function ThemeShallowCase() {
|
|
14
|
+
return (
|
|
15
|
+
<YStack gap="$4" padding="$4">
|
|
16
|
+
<Text fontWeight="bold" fontSize="$6">
|
|
17
|
+
Theme Shallow DOM Structure Test
|
|
18
|
+
</Text>
|
|
19
|
+
|
|
20
|
+
{/* Test Case 1: Without themeShallow - normal theme wrapping */}
|
|
21
|
+
<YStack gap="$2">
|
|
22
|
+
<Text fontWeight="bold">Without themeShallow (normal)</Text>
|
|
23
|
+
<Theme name="dark">
|
|
24
|
+
<View
|
|
25
|
+
id={TEST_IDS.themeShallowNormal}
|
|
26
|
+
backgroundColor="$background"
|
|
27
|
+
padding="$4"
|
|
28
|
+
>
|
|
29
|
+
<Text color="$color">Normal theme - children get dark theme</Text>
|
|
30
|
+
<Theme name="light">
|
|
31
|
+
<Square backgroundColor="$background" size={50}>
|
|
32
|
+
<Text color="$color" fontSize="$1">
|
|
33
|
+
Light
|
|
34
|
+
</Text>
|
|
35
|
+
</Square>
|
|
36
|
+
</Theme>
|
|
37
|
+
</View>
|
|
38
|
+
</Theme>
|
|
39
|
+
</YStack>
|
|
40
|
+
|
|
41
|
+
{/* Test Case 2: With themeShallow - theme doesn't propagate to grandchildren */}
|
|
42
|
+
<YStack gap="$2">
|
|
43
|
+
<Text fontWeight="bold">With themeShallow</Text>
|
|
44
|
+
<Theme name="dark">
|
|
45
|
+
<View
|
|
46
|
+
id={TEST_IDS.themeShallowEnabled}
|
|
47
|
+
themeShallow
|
|
48
|
+
backgroundColor="$background"
|
|
49
|
+
padding="$4"
|
|
50
|
+
>
|
|
51
|
+
<Text color="$color">
|
|
52
|
+
Shallow theme - grandchildren reset to parent theme
|
|
53
|
+
</Text>
|
|
54
|
+
<Theme name="light">
|
|
55
|
+
<Square backgroundColor="$background" size={50}>
|
|
56
|
+
<Text color="$color" fontSize="$1">
|
|
57
|
+
Light
|
|
58
|
+
</Text>
|
|
59
|
+
</Square>
|
|
60
|
+
</Theme>
|
|
61
|
+
</View>
|
|
62
|
+
</Theme>
|
|
63
|
+
</YStack>
|
|
64
|
+
|
|
65
|
+
{/* Test Case 3: Component with themeShallow for DOM structure comparison */}
|
|
66
|
+
<YStack gap="$2">
|
|
67
|
+
<Text fontWeight="bold">DOM structure comparison container</Text>
|
|
68
|
+
<View id={TEST_IDS.themeShallowContainer}>
|
|
69
|
+
<Theme name="dark">
|
|
70
|
+
<View
|
|
71
|
+
id={TEST_IDS.themeShallowInner}
|
|
72
|
+
themeShallow
|
|
73
|
+
backgroundColor="$background"
|
|
74
|
+
padding="$2"
|
|
75
|
+
>
|
|
76
|
+
<Text color="$color">Inner content</Text>
|
|
77
|
+
</View>
|
|
78
|
+
</Theme>
|
|
79
|
+
</View>
|
|
80
|
+
</YStack>
|
|
81
|
+
</YStack>
|
|
82
|
+
)
|
|
83
|
+
}
|