@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,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests compiler extraction with various scenarios:
|
|
3
|
+
* - Simple extraction (static values)
|
|
4
|
+
* - Advanced extraction ($color tokens)
|
|
5
|
+
* - Light/dark mode switching
|
|
6
|
+
* - Sub-theme changes
|
|
7
|
+
* - Performance benchmark (20 views opt vs no-opt)
|
|
8
|
+
*
|
|
9
|
+
* Add a "// debug" comment for extraction debug output during build.
|
|
10
|
+
* If extraction is working, the build output will show optimized styles.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useLayoutEffect, useRef, useState } from 'react'
|
|
14
|
+
import { Button, Text, Theme, XStack, YStack, useThemeName } from '@hanzo/gui'
|
|
15
|
+
|
|
16
|
+
// simple extracted component - static values only
|
|
17
|
+
function SimpleBox() {
|
|
18
|
+
return (
|
|
19
|
+
<YStack
|
|
20
|
+
testID="compiler-simple-box"
|
|
21
|
+
width={44}
|
|
22
|
+
height={44}
|
|
23
|
+
padding="$4"
|
|
24
|
+
borderRadius={8}
|
|
25
|
+
backgroundColor="$background"
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// non-optimized version for comparison
|
|
31
|
+
function SimpleBoxNoOpt() {
|
|
32
|
+
return (
|
|
33
|
+
<YStack
|
|
34
|
+
disableOptimization
|
|
35
|
+
testID="compiler-simple-box-noopt"
|
|
36
|
+
width={44}
|
|
37
|
+
height={44}
|
|
38
|
+
padding="$4"
|
|
39
|
+
borderRadius={8}
|
|
40
|
+
backgroundColor="$background"
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// advanced extracted component - uses $colorN tokens
|
|
46
|
+
function AdvancedBox() {
|
|
47
|
+
return (
|
|
48
|
+
<YStack
|
|
49
|
+
testID="compiler-advanced-box"
|
|
50
|
+
width={44}
|
|
51
|
+
height={44}
|
|
52
|
+
padding="$4"
|
|
53
|
+
borderRadius={8}
|
|
54
|
+
backgroundColor="$color4"
|
|
55
|
+
borderColor="$color8"
|
|
56
|
+
borderWidth={2}
|
|
57
|
+
>
|
|
58
|
+
<Text testID="compiler-advanced-text" color="$color12" fontSize="$3">
|
|
59
|
+
Token
|
|
60
|
+
</Text>
|
|
61
|
+
</YStack>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// non-optimized version for comparison
|
|
66
|
+
function AdvancedBoxNoOpt() {
|
|
67
|
+
return (
|
|
68
|
+
<YStack
|
|
69
|
+
disableOptimization
|
|
70
|
+
testID="compiler-advanced-box-noopt"
|
|
71
|
+
width={44}
|
|
72
|
+
height={44}
|
|
73
|
+
padding="$4"
|
|
74
|
+
borderRadius={8}
|
|
75
|
+
backgroundColor="$color4"
|
|
76
|
+
borderColor="$color8"
|
|
77
|
+
borderWidth={2}
|
|
78
|
+
>
|
|
79
|
+
<Text
|
|
80
|
+
disableOptimization
|
|
81
|
+
testID="compiler-advanced-text-noopt"
|
|
82
|
+
color="$color12"
|
|
83
|
+
fontSize="$3"
|
|
84
|
+
>
|
|
85
|
+
Token
|
|
86
|
+
</Text>
|
|
87
|
+
</YStack>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// sub-themed component
|
|
92
|
+
function SubThemedBox({ themeName }: { themeName: string }) {
|
|
93
|
+
return (
|
|
94
|
+
<Theme name={themeName as any}>
|
|
95
|
+
<YStack
|
|
96
|
+
testID="compiler-subtheme-box"
|
|
97
|
+
width={44}
|
|
98
|
+
height={44}
|
|
99
|
+
padding="$4"
|
|
100
|
+
borderRadius={8}
|
|
101
|
+
backgroundColor="$color4"
|
|
102
|
+
>
|
|
103
|
+
<Text testID="compiler-subtheme-text" color="$color12" fontSize="$2">
|
|
104
|
+
{themeName}
|
|
105
|
+
</Text>
|
|
106
|
+
</YStack>
|
|
107
|
+
</Theme>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// non-optimized version for comparison
|
|
112
|
+
function SubThemedBoxNoOpt({ themeName }: { themeName: string }) {
|
|
113
|
+
return (
|
|
114
|
+
<Theme name={themeName as any}>
|
|
115
|
+
<YStack
|
|
116
|
+
disableOptimization
|
|
117
|
+
testID="compiler-subtheme-box-noopt"
|
|
118
|
+
width={44}
|
|
119
|
+
height={44}
|
|
120
|
+
padding="$4"
|
|
121
|
+
borderRadius={8}
|
|
122
|
+
backgroundColor="$color4"
|
|
123
|
+
>
|
|
124
|
+
<Text
|
|
125
|
+
disableOptimization
|
|
126
|
+
testID="compiler-subtheme-text-noopt"
|
|
127
|
+
color="$color12"
|
|
128
|
+
fontSize="$2"
|
|
129
|
+
>
|
|
130
|
+
{themeName}
|
|
131
|
+
</Text>
|
|
132
|
+
</YStack>
|
|
133
|
+
</Theme>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// displays current theme info
|
|
138
|
+
function ThemeInfo() {
|
|
139
|
+
const themeName = useThemeName()
|
|
140
|
+
return (
|
|
141
|
+
<Text testID="compiler-theme-name" fontSize="$4">
|
|
142
|
+
Theme: {themeName}
|
|
143
|
+
</Text>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// benchmark views - 20 each
|
|
148
|
+
function BenchViews({
|
|
149
|
+
optimized,
|
|
150
|
+
onMeasure,
|
|
151
|
+
}: {
|
|
152
|
+
optimized: boolean
|
|
153
|
+
onMeasure: (ms: number) => void
|
|
154
|
+
}) {
|
|
155
|
+
const startTime = useRef(performance.now())
|
|
156
|
+
const measured = useRef(false)
|
|
157
|
+
|
|
158
|
+
useLayoutEffect(() => {
|
|
159
|
+
if (!measured.current) {
|
|
160
|
+
measured.current = true
|
|
161
|
+
onMeasure(performance.now() - startTime.current)
|
|
162
|
+
}
|
|
163
|
+
}, [onMeasure])
|
|
164
|
+
|
|
165
|
+
if (optimized) {
|
|
166
|
+
return (
|
|
167
|
+
<YStack testID="bench-views" flexDirection="row" flexWrap="wrap" gap={2}>
|
|
168
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
169
|
+
<YStack
|
|
170
|
+
key={i}
|
|
171
|
+
width={16}
|
|
172
|
+
height={16}
|
|
173
|
+
backgroundColor="$color4"
|
|
174
|
+
borderColor="$color8"
|
|
175
|
+
borderWidth={1}
|
|
176
|
+
borderRadius={2}
|
|
177
|
+
/>
|
|
178
|
+
))}
|
|
179
|
+
</YStack>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<YStack testID="bench-views" flexDirection="row" flexWrap="wrap" gap={2}>
|
|
185
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
186
|
+
<YStack
|
|
187
|
+
disableOptimization
|
|
188
|
+
key={i}
|
|
189
|
+
width={16}
|
|
190
|
+
height={16}
|
|
191
|
+
backgroundColor="$color4"
|
|
192
|
+
borderColor="$color8"
|
|
193
|
+
borderWidth={1}
|
|
194
|
+
borderRadius={2}
|
|
195
|
+
/>
|
|
196
|
+
))}
|
|
197
|
+
</YStack>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
type BenchMode = 'off' | 'opt' | 'noopt'
|
|
202
|
+
|
|
203
|
+
function PerfBenchmark() {
|
|
204
|
+
const [mode, setMode] = useState<BenchMode>('off')
|
|
205
|
+
const [optTimes, setOptTimes] = useState<number[]>([])
|
|
206
|
+
const [noOptTimes, setNoOptTimes] = useState<number[]>([])
|
|
207
|
+
const [runKey, setRunKey] = useState(0)
|
|
208
|
+
|
|
209
|
+
const runOpt = () => {
|
|
210
|
+
setMode('opt')
|
|
211
|
+
setRunKey((k) => k + 1)
|
|
212
|
+
}
|
|
213
|
+
const runNoOpt = () => {
|
|
214
|
+
setMode('noopt')
|
|
215
|
+
setRunKey((k) => k + 1)
|
|
216
|
+
}
|
|
217
|
+
const reset = () => {
|
|
218
|
+
setMode('off')
|
|
219
|
+
setOptTimes([])
|
|
220
|
+
setNoOptTimes([])
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const handleMeasure = (ms: number) => {
|
|
224
|
+
if (mode === 'opt') {
|
|
225
|
+
setOptTimes((t) => [...t, ms])
|
|
226
|
+
} else if (mode === 'noopt') {
|
|
227
|
+
setNoOptTimes((t) => [...t, ms])
|
|
228
|
+
}
|
|
229
|
+
setMode('off')
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const bestOpt = optTimes.length ? Math.min(...optTimes) : null
|
|
233
|
+
const bestNoOpt = noOptTimes.length ? Math.min(...noOptTimes) : null
|
|
234
|
+
const pctDiff = bestOpt && bestNoOpt ? ((bestNoOpt - bestOpt) / bestNoOpt) * 100 : null
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<YStack gap="$2" padding="$2" backgroundColor="$background" borderRadius={8}>
|
|
238
|
+
<Text fontSize="$3" fontWeight="bold">
|
|
239
|
+
Perf Benchmark (20 views, best of 3)
|
|
240
|
+
</Text>
|
|
241
|
+
|
|
242
|
+
<XStack gap="$2">
|
|
243
|
+
<Button
|
|
244
|
+
size="$2"
|
|
245
|
+
testID="bench-run-opt"
|
|
246
|
+
onPress={runOpt}
|
|
247
|
+
disabled={mode !== 'off'}
|
|
248
|
+
>
|
|
249
|
+
Run Opt ({optTimes.length}/3)
|
|
250
|
+
</Button>
|
|
251
|
+
<Button
|
|
252
|
+
size="$2"
|
|
253
|
+
testID="bench-run-noopt"
|
|
254
|
+
onPress={runNoOpt}
|
|
255
|
+
disabled={mode !== 'off'}
|
|
256
|
+
>
|
|
257
|
+
Run NoOpt ({noOptTimes.length}/3)
|
|
258
|
+
</Button>
|
|
259
|
+
<Button size="$2" testID="bench-reset" onPress={reset}>
|
|
260
|
+
Reset
|
|
261
|
+
</Button>
|
|
262
|
+
</XStack>
|
|
263
|
+
|
|
264
|
+
{mode !== 'off' && (
|
|
265
|
+
<BenchViews key={runKey} optimized={mode === 'opt'} onMeasure={handleMeasure} />
|
|
266
|
+
)}
|
|
267
|
+
|
|
268
|
+
<YStack gap="$1">
|
|
269
|
+
<Text
|
|
270
|
+
testID="bench-opt-result"
|
|
271
|
+
accessibilityLabel={
|
|
272
|
+
bestOpt !== null ? `opt:${bestOpt.toFixed(4)}` : 'opt:pending'
|
|
273
|
+
}
|
|
274
|
+
fontSize="$2"
|
|
275
|
+
>
|
|
276
|
+
Opt best: {bestOpt !== null ? `${bestOpt.toFixed(2)}ms` : '-'} (
|
|
277
|
+
{optTimes.length} runs)
|
|
278
|
+
</Text>
|
|
279
|
+
<Text
|
|
280
|
+
testID="bench-noopt-result"
|
|
281
|
+
accessibilityLabel={
|
|
282
|
+
bestNoOpt !== null ? `noopt:${bestNoOpt.toFixed(4)}` : 'noopt:pending'
|
|
283
|
+
}
|
|
284
|
+
fontSize="$2"
|
|
285
|
+
>
|
|
286
|
+
NoOpt best: {bestNoOpt !== null ? `${bestNoOpt.toFixed(2)}ms` : '-'} (
|
|
287
|
+
{noOptTimes.length} runs)
|
|
288
|
+
</Text>
|
|
289
|
+
{pctDiff !== null && (
|
|
290
|
+
<Text
|
|
291
|
+
testID="bench-pct"
|
|
292
|
+
accessibilityLabel={`pct:${pctDiff.toFixed(2)}`}
|
|
293
|
+
fontSize="$2"
|
|
294
|
+
fontWeight="bold"
|
|
295
|
+
color={pctDiff > 0 ? '$green10' : '$red10'}
|
|
296
|
+
>
|
|
297
|
+
{pctDiff > 0
|
|
298
|
+
? `Opt ${pctDiff.toFixed(1)}% faster`
|
|
299
|
+
: `NoOpt ${Math.abs(pctDiff).toFixed(1)}% faster`}
|
|
300
|
+
</Text>
|
|
301
|
+
)}
|
|
302
|
+
</YStack>
|
|
303
|
+
</YStack>
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function CompilerExtraction() {
|
|
308
|
+
const [isDark, setIsDark] = useState(false)
|
|
309
|
+
const [subTheme, setSubTheme] = useState<'red' | 'blue' | 'green'>('red')
|
|
310
|
+
const [showBenchmark, setShowBenchmark] = useState(false)
|
|
311
|
+
|
|
312
|
+
const toggleTheme = () => setIsDark((d) => !d)
|
|
313
|
+
const cycleSubTheme = () => {
|
|
314
|
+
setSubTheme((t) => {
|
|
315
|
+
if (t === 'red') return 'blue'
|
|
316
|
+
if (t === 'blue') return 'green'
|
|
317
|
+
return 'red'
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<Theme name={isDark ? 'dark' : 'light'}>
|
|
323
|
+
<YStack
|
|
324
|
+
testID="compiler-extraction-root"
|
|
325
|
+
flex={1}
|
|
326
|
+
padding="$4"
|
|
327
|
+
gap="$4"
|
|
328
|
+
backgroundColor="$background"
|
|
329
|
+
>
|
|
330
|
+
<ThemeInfo />
|
|
331
|
+
|
|
332
|
+
<Text testID="compiler-mode-label" fontSize="$3">
|
|
333
|
+
Mode: {isDark ? 'dark' : 'light'}
|
|
334
|
+
</Text>
|
|
335
|
+
|
|
336
|
+
<XStack gap="$2" flexWrap="wrap">
|
|
337
|
+
<Button size="$2" testID="compiler-toggle-mode" onPress={toggleTheme}>
|
|
338
|
+
Toggle Mode
|
|
339
|
+
</Button>
|
|
340
|
+
<Button size="$2" testID="compiler-cycle-subtheme" onPress={cycleSubTheme}>
|
|
341
|
+
Cycle Theme
|
|
342
|
+
</Button>
|
|
343
|
+
<Button
|
|
344
|
+
size="$2"
|
|
345
|
+
testID="compiler-toggle-bench"
|
|
346
|
+
onPress={() => setShowBenchmark((s) => !s)}
|
|
347
|
+
>
|
|
348
|
+
{showBenchmark ? 'Hide' : 'Show'} Bench
|
|
349
|
+
</Button>
|
|
350
|
+
</XStack>
|
|
351
|
+
|
|
352
|
+
<Text fontSize="$3" marginTop="$2">
|
|
353
|
+
Simple (opt | no-opt):
|
|
354
|
+
</Text>
|
|
355
|
+
<XStack gap="$2">
|
|
356
|
+
<SimpleBox />
|
|
357
|
+
<SimpleBoxNoOpt />
|
|
358
|
+
</XStack>
|
|
359
|
+
|
|
360
|
+
<Text fontSize="$3" marginTop="$2">
|
|
361
|
+
Advanced $colorN (opt | no-opt):
|
|
362
|
+
</Text>
|
|
363
|
+
<XStack gap="$2">
|
|
364
|
+
<AdvancedBox />
|
|
365
|
+
<AdvancedBoxNoOpt />
|
|
366
|
+
</XStack>
|
|
367
|
+
|
|
368
|
+
<Text testID="compiler-subtheme-label" fontSize="$3" marginTop="$2">
|
|
369
|
+
Sub-theme {subTheme} (opt | no-opt):
|
|
370
|
+
</Text>
|
|
371
|
+
<XStack gap="$2">
|
|
372
|
+
<SubThemedBox themeName={subTheme} />
|
|
373
|
+
<SubThemedBoxNoOpt themeName={subTheme} />
|
|
374
|
+
</XStack>
|
|
375
|
+
|
|
376
|
+
{showBenchmark && <PerfBenchmark />}
|
|
377
|
+
</YStack>
|
|
378
|
+
</Theme>
|
|
379
|
+
)
|
|
380
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { GetProps, GuiElement } from '@hanzo/gui'
|
|
3
|
+
import {
|
|
4
|
+
Paragraph,
|
|
5
|
+
Separator,
|
|
6
|
+
View,
|
|
7
|
+
Text,
|
|
8
|
+
XStack,
|
|
9
|
+
YStack,
|
|
10
|
+
createStyledContext,
|
|
11
|
+
styled,
|
|
12
|
+
useProps,
|
|
13
|
+
withStaticProperties,
|
|
14
|
+
} from '@hanzo/gui'
|
|
15
|
+
|
|
16
|
+
const StyledContext = createStyledContext({
|
|
17
|
+
isInvalid: false,
|
|
18
|
+
isError: false,
|
|
19
|
+
isFocused: false,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const Frame = styled(View, {
|
|
23
|
+
context: StyledContext,
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
gap: '$1',
|
|
28
|
+
width: 100,
|
|
29
|
+
height: 100,
|
|
30
|
+
bg: '$blue10',
|
|
31
|
+
|
|
32
|
+
paddingVertical: '$2',
|
|
33
|
+
paddingHorizontal: '$4',
|
|
34
|
+
|
|
35
|
+
outlineWidth: 0,
|
|
36
|
+
|
|
37
|
+
// this fixes a flex bug where it overflows container
|
|
38
|
+
minWidth: 0,
|
|
39
|
+
|
|
40
|
+
borderWidth: 5,
|
|
41
|
+
borderRadius: '$10',
|
|
42
|
+
variants: {
|
|
43
|
+
isError: {
|
|
44
|
+
true: {
|
|
45
|
+
borderColor: '$red10',
|
|
46
|
+
borderBottomRightRadius: 0,
|
|
47
|
+
borderBottomLeftRadius: 0,
|
|
48
|
+
borderBottomWidth: 0,
|
|
49
|
+
|
|
50
|
+
hoverStyle: {
|
|
51
|
+
borderColor: '$red10',
|
|
52
|
+
borderBottomWidth: 0,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
isInvalid: {
|
|
58
|
+
true: {
|
|
59
|
+
borderColor: '$yellow10',
|
|
60
|
+
borderWidth: 5,
|
|
61
|
+
|
|
62
|
+
hoverStyle: {
|
|
63
|
+
borderColor: '$yellow10',
|
|
64
|
+
borderWidth: 5,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
isFocused: {
|
|
70
|
+
true: {
|
|
71
|
+
borderColor: '$green10',
|
|
72
|
+
borderWidth: 10,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
} as const,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const FrameContainer = Frame.styleable((propsIn, ref) => {
|
|
79
|
+
const props = useProps(propsIn)
|
|
80
|
+
return <Frame ref={ref} {...props} />
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const ForwardRefContainer = React.forwardRef<GuiElement, GetProps<typeof Frame>>(
|
|
84
|
+
(propsIn, ref) => {
|
|
85
|
+
return (
|
|
86
|
+
<View>
|
|
87
|
+
<Frame ref={ref} {...propsIn} />
|
|
88
|
+
</View>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
const ContainerWithStaticProperty = withStaticProperties(ForwardRefContainer, {})
|
|
94
|
+
|
|
95
|
+
export function ComplexVariants() {
|
|
96
|
+
return (
|
|
97
|
+
<View>
|
|
98
|
+
{[
|
|
99
|
+
[false, false, false],
|
|
100
|
+
[true, false, false],
|
|
101
|
+
[false, true, false],
|
|
102
|
+
[false, false, true],
|
|
103
|
+
[true, true, true],
|
|
104
|
+
].map(([isFocus, isInvalid, isError], index) => (
|
|
105
|
+
<YStack mt="$8" key={index}>
|
|
106
|
+
<Separator />
|
|
107
|
+
<XStack gap="$4">
|
|
108
|
+
<Paragraph color="#fff" fontWeight="800" bg={isFocus ? '$green10' : '$red10'}>
|
|
109
|
+
isFocus
|
|
110
|
+
</Paragraph>
|
|
111
|
+
<Paragraph
|
|
112
|
+
color="#fff"
|
|
113
|
+
fontWeight="800"
|
|
114
|
+
bg={isInvalid ? '$green10' : '$red10'}
|
|
115
|
+
>
|
|
116
|
+
isInvalid
|
|
117
|
+
</Paragraph>
|
|
118
|
+
<Paragraph color="#fff" fontWeight="800" bg={isError ? '$green10' : '$red10'}>
|
|
119
|
+
isError
|
|
120
|
+
</Paragraph>
|
|
121
|
+
</XStack>
|
|
122
|
+
<>
|
|
123
|
+
<Text>With Styled Context</Text>
|
|
124
|
+
<StyledContext.Provider
|
|
125
|
+
isFocused={isFocus}
|
|
126
|
+
isInvalid={isInvalid}
|
|
127
|
+
isError={isError}
|
|
128
|
+
>
|
|
129
|
+
<XStack>
|
|
130
|
+
<FrameContainer />
|
|
131
|
+
<ContainerWithStaticProperty />
|
|
132
|
+
<Frame />
|
|
133
|
+
<ForwardRefContainer />
|
|
134
|
+
</XStack>
|
|
135
|
+
</StyledContext.Provider>
|
|
136
|
+
</>
|
|
137
|
+
<View>
|
|
138
|
+
<Text>Without Styled Context</Text>
|
|
139
|
+
<XStack>
|
|
140
|
+
<FrameContainer
|
|
141
|
+
isFocused={isFocus}
|
|
142
|
+
isInvalid={isInvalid}
|
|
143
|
+
isError={isError}
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<ContainerWithStaticProperty
|
|
147
|
+
isFocused={isFocus}
|
|
148
|
+
isInvalid={isInvalid}
|
|
149
|
+
isError={isError}
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<Frame isFocused={isFocus} isInvalid={isInvalid} isError={isError} />
|
|
153
|
+
<ForwardRefContainer
|
|
154
|
+
isFocused={isFocus}
|
|
155
|
+
isInvalid={isInvalid}
|
|
156
|
+
isError={isError}
|
|
157
|
+
/>
|
|
158
|
+
</XStack>
|
|
159
|
+
</View>
|
|
160
|
+
</YStack>
|
|
161
|
+
))}
|
|
162
|
+
</View>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useWindowDimensions } from 'react-native'
|
|
2
|
+
import { Button, H1, Dialog as TDialog, Sheet, YStack } from '@hanzo/gui'
|
|
3
|
+
|
|
4
|
+
/* Minimal test case for reproducing crashes */
|
|
5
|
+
export function TestModal() {
|
|
6
|
+
const { width: windowWidth, height: windowHeight } = useWindowDimensions()
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<TDialog>
|
|
10
|
+
<TDialog.Trigger asChild>
|
|
11
|
+
<Button>hi2</Button>
|
|
12
|
+
</TDialog.Trigger>
|
|
13
|
+
|
|
14
|
+
<TDialog.Adapt when="md">
|
|
15
|
+
<Sheet modal snapPoints={[20, 40, 80]}>
|
|
16
|
+
<Sheet.Handle
|
|
17
|
+
h={10}
|
|
18
|
+
bg="$background"
|
|
19
|
+
o={1} // Uncommenting this causes a rare crash on native iOS Safari
|
|
20
|
+
width="25%"
|
|
21
|
+
m="$0"
|
|
22
|
+
mb="$1"
|
|
23
|
+
mt="$5"
|
|
24
|
+
alignSelf="center"
|
|
25
|
+
pos="absolute"
|
|
26
|
+
t={-40}
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<Sheet.Overlay height={windowHeight} width={windowWidth} bg="$background" />
|
|
30
|
+
|
|
31
|
+
{/* Uncommenting this causes a rare crash on native iOS Safari */}
|
|
32
|
+
<Sheet.Frame theme="red">
|
|
33
|
+
<Sheet.ScrollView>
|
|
34
|
+
<TDialog.Adapt.Contents />
|
|
35
|
+
</Sheet.ScrollView>
|
|
36
|
+
</Sheet.Frame>
|
|
37
|
+
</Sheet>
|
|
38
|
+
</TDialog.Adapt>
|
|
39
|
+
|
|
40
|
+
<TDialog.Portal>
|
|
41
|
+
<TDialog.Content>
|
|
42
|
+
<YStack gap="$4" p="$4">
|
|
43
|
+
<H1>
|
|
44
|
+
Esse nulla magna reprehenderit sunt ea elit. Voluptate amet elit
|
|
45
|
+
reprehenderit tempor duis duis. Nostrud adipisicing duis in sunt adipisicing
|
|
46
|
+
nulla culpa. Est cillum esse reprehenderit officia incididunt ea aliquip
|
|
47
|
+
aliqua quis ex cillum.
|
|
48
|
+
</H1>
|
|
49
|
+
|
|
50
|
+
<H1>
|
|
51
|
+
Esse nulla magna reprehenderit sunt ea elit. Voluptate amet elit
|
|
52
|
+
reprehenderit tempor duis duis. Nostrud adipisicing duis in sunt adipisicing
|
|
53
|
+
nulla culpa. Est cillum esse reprehenderit officia incididunt ea aliquip
|
|
54
|
+
aliqua quis ex cillum.
|
|
55
|
+
</H1>
|
|
56
|
+
</YStack>
|
|
57
|
+
</TDialog.Content>
|
|
58
|
+
</TDialog.Portal>
|
|
59
|
+
</TDialog>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Minimal test case for reproducing crashes */
|
|
64
|
+
function TestModal10() {
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<TestModal />
|
|
68
|
+
<TestModal />
|
|
69
|
+
<TestModal />
|
|
70
|
+
<TestModal />
|
|
71
|
+
<TestModal />
|
|
72
|
+
<TestModal />
|
|
73
|
+
<TestModal />
|
|
74
|
+
<TestModal />
|
|
75
|
+
<TestModal />
|
|
76
|
+
<TestModal />
|
|
77
|
+
</>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Minimal test case for reproducing crashes */
|
|
82
|
+
export function CrashAdaptSheet() {
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<TestModal10 />
|
|
86
|
+
<TestModal10 />
|
|
87
|
+
<TestModal10 />
|
|
88
|
+
<TestModal10 />
|
|
89
|
+
<TestModal10 />
|
|
90
|
+
|
|
91
|
+
<TestModal10 />
|
|
92
|
+
<TestModal10 />
|
|
93
|
+
<TestModal10 />
|
|
94
|
+
<TestModal10 />
|
|
95
|
+
<TestModal10 />
|
|
96
|
+
</>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Popover, View, Text, Theme, styled } from '@hanzo/gui'
|
|
2
|
+
|
|
3
|
+
export const Content = styled(Popover.Content, {
|
|
4
|
+
padding: 0,
|
|
5
|
+
zIndex: 1_000_000,
|
|
6
|
+
enterStyle: { x: 0, y: 5, opacity: 0, scale: 0.9 },
|
|
7
|
+
exitStyle: { x: 0, y: 5, opacity: 0, scale: 0.9 },
|
|
8
|
+
scale: 1,
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0,
|
|
11
|
+
opacity: 1,
|
|
12
|
+
transition: [
|
|
13
|
+
'quick',
|
|
14
|
+
{
|
|
15
|
+
opacity: {
|
|
16
|
+
overshootClamping: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export function CustomStyledAnimatedPopover() {
|
|
23
|
+
return (
|
|
24
|
+
<View flex={1} items="center" justify="center" gap="$5">
|
|
25
|
+
<View theme="red">
|
|
26
|
+
<Popover>
|
|
27
|
+
<Popover.Trigger>
|
|
28
|
+
<Text>No animation with styled()</Text>
|
|
29
|
+
</Popover.Trigger>
|
|
30
|
+
|
|
31
|
+
<Theme name="accent">
|
|
32
|
+
<Content>
|
|
33
|
+
<Text theme="red" color="$color11">
|
|
34
|
+
Hey there!
|
|
35
|
+
</Text>
|
|
36
|
+
</Content>
|
|
37
|
+
</Theme>
|
|
38
|
+
</Popover>
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
)
|
|
42
|
+
}
|