@qwickapps/react-framework 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QUICK_START_GUIDE.md +82 -0
- package/README.md +221 -21
- package/dist/components/Html.d.ts.map +1 -1
- package/dist/components/Markdown.d.ts +1 -2
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/SafeSpan.d.ts +1 -2
- package/dist/components/SafeSpan.d.ts.map +1 -1
- package/dist/components/base/Container.d.ts +32 -0
- package/dist/components/base/Container.d.ts.map +1 -0
- package/dist/components/base/ContainerView.d.ts +65 -0
- package/dist/components/base/ContainerView.d.ts.map +1 -0
- package/dist/components/base/ModelView.d.ts +37 -46
- package/dist/components/base/ModelView.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +3 -2
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/blocks/Article.d.ts +1 -2
- package/dist/components/blocks/Article.d.ts.map +1 -1
- package/dist/components/blocks/Code-factory.d.ts +22 -0
- package/dist/components/blocks/Code-factory.d.ts.map +1 -0
- package/dist/components/blocks/Code-old.d.ts +31 -0
- package/dist/components/blocks/Code-old.d.ts.map +1 -0
- package/dist/components/blocks/Code.d.ts +30 -18
- package/dist/components/blocks/Code.d.ts.map +1 -1
- package/dist/components/blocks/HeroBlock.d.ts +1 -2
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
- package/dist/components/blocks/Image.d.ts +1 -2
- package/dist/components/blocks/Image.d.ts.map +1 -1
- package/dist/components/blocks/Section.d.ts +1 -2
- package/dist/components/blocks/Section.d.ts.map +1 -1
- package/dist/components/blocks/Text.d.ts +35 -27
- package/dist/components/blocks/Text.d.ts.map +1 -1
- package/dist/components/buttons/Button.d.ts +1 -2
- package/dist/components/buttons/Button.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/ChoiceInputField.d.ts +1 -2
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
- package/dist/components/input/HtmlInputField.d.ts +1 -2
- package/dist/components/input/HtmlInputField.d.ts.map +1 -1
- package/dist/components/input/SelectInputField.d.ts +1 -2
- package/dist/components/input/SelectInputField.d.ts.map +1 -1
- package/dist/components/pages/Page.d.ts +29 -47
- package/dist/components/pages/Page.d.ts.map +1 -1
- package/dist/components/pages/index.d.ts +2 -3
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/components/shared/createSerializableView.d.ts +68 -0
- package/dist/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/components/shared/viewProps.d.ts +37 -0
- package/dist/components/shared/viewProps.d.ts.map +1 -0
- package/dist/index.esm.js +21782 -22580
- package/dist/index.js +21782 -22579
- package/dist/qa/ConsoleWarningTest.d.ts +5 -0
- package/dist/qa/ConsoleWarningTest.d.ts.map +1 -0
- package/dist/qa/StorageKeyTest.d.ts +6 -0
- package/dist/qa/StorageKeyTest.d.ts.map +1 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts +6 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts.map +1 -0
- package/dist/schemas/CodeSchema.d.ts +2 -2
- package/dist/schemas/CodeSchema.d.ts.map +1 -1
- package/dist/schemas/ContainerSchema.d.ts +12 -0
- package/dist/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/schemas/PageTemplateSchema.d.ts +3 -3
- package/dist/schemas/PageTemplateSchema.d.ts.map +1 -1
- package/dist/schemas/ViewModelSchema.d.ts +46 -6
- package/dist/schemas/ViewModelSchema.d.ts.map +1 -1
- package/dist/schemas/ViewSchema.d.ts +65 -0
- package/dist/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/transformers/ComponentTransformer.d.ts +27 -15
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/registry.d.ts +3 -0
- package/dist/schemas/transformers/registry.d.ts.map +1 -1
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
- package/dist/src/components/AccessibilityChecker.d.ts +12 -0
- package/dist/src/components/AccessibilityChecker.d.ts.map +1 -0
- package/dist/src/components/AccessibilityProvider.d.ts +64 -0
- package/dist/src/components/AccessibilityProvider.d.ts.map +1 -0
- package/dist/src/components/Breadcrumbs.d.ts +39 -0
- package/dist/src/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/src/components/ErrorBoundary.d.ts +46 -0
- package/dist/src/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/components/Html.d.ts +58 -0
- package/dist/src/components/Html.d.ts.map +1 -0
- package/dist/src/components/Logo.d.ts +56 -0
- package/dist/src/components/Logo.d.ts.map +1 -0
- package/dist/src/components/Markdown.d.ts +51 -0
- package/dist/src/components/Markdown.d.ts.map +1 -0
- package/dist/src/components/QwickApp.d.ts +69 -0
- package/dist/src/components/QwickApp.d.ts.map +1 -0
- package/dist/src/components/QwickAppsLogo.d.ts +25 -0
- package/dist/src/components/QwickAppsLogo.d.ts.map +1 -0
- package/dist/src/components/QwickIcon.d.ts +23 -0
- package/dist/src/components/QwickIcon.d.ts.map +1 -0
- package/dist/src/components/ResponsiveMenu.d.ts +38 -0
- package/dist/src/components/ResponsiveMenu.d.ts.map +1 -0
- package/dist/src/components/SafeSpan.d.ts +29 -0
- package/dist/src/components/SafeSpan.d.ts.map +1 -0
- package/dist/src/components/Scaffold.d.ts +57 -0
- package/dist/src/components/Scaffold.d.ts.map +1 -0
- package/dist/src/components/base/Container.d.ts +33 -0
- package/dist/src/components/base/Container.d.ts.map +1 -0
- package/dist/src/components/base/ModelView.d.ts +92 -0
- package/dist/src/components/base/ModelView.d.ts.map +1 -0
- package/dist/src/components/base/index.d.ts +12 -0
- package/dist/src/components/base/index.d.ts.map +1 -0
- package/dist/src/components/blocks/Article.d.ts +32 -0
- package/dist/src/components/blocks/Article.d.ts.map +1 -0
- package/dist/src/components/blocks/CardListGrid.d.ts +23 -0
- package/dist/src/components/blocks/CardListGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Code.d.ts +37 -0
- package/dist/src/components/blocks/Code.d.ts.map +1 -0
- package/dist/src/components/blocks/Content.d.ts +24 -0
- package/dist/src/components/blocks/Content.d.ts.map +1 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts +44 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureCard.d.ts +66 -0
- package/dist/src/components/blocks/FeatureCard.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts +48 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Footer.d.ts +56 -0
- package/dist/src/components/blocks/Footer.d.ts.map +1 -0
- package/dist/src/components/blocks/HeroBlock.d.ts +55 -0
- package/dist/src/components/blocks/HeroBlock.d.ts.map +1 -0
- package/dist/src/components/blocks/Image.d.ts +40 -0
- package/dist/src/components/blocks/Image.d.ts.map +1 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts +30 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/ProductCard.d.ts +57 -0
- package/dist/src/components/blocks/ProductCard.d.ts.map +1 -0
- package/dist/src/components/blocks/Section.d.ts +45 -0
- package/dist/src/components/blocks/Section.d.ts.map +1 -0
- package/dist/src/components/blocks/Text.d.ts +34 -0
- package/dist/src/components/blocks/Text.d.ts.map +1 -0
- package/dist/src/components/blocks/index.d.ts +41 -0
- package/dist/src/components/blocks/index.d.ts.map +1 -0
- package/dist/src/components/buttons/Button.d.ts +41 -0
- package/dist/src/components/buttons/Button.d.ts.map +1 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/index.d.ts +11 -0
- package/dist/src/components/buttons/index.d.ts.map +1 -0
- package/dist/src/components/forms/FormBlock.d.ts +51 -0
- package/dist/src/components/forms/FormBlock.d.ts.map +1 -0
- package/dist/src/components/forms/index.d.ts +8 -0
- package/dist/src/components/forms/index.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +41 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/input/ChoiceInputField.d.ts +29 -0
- package/dist/src/components/input/ChoiceInputField.d.ts.map +1 -0
- package/dist/src/components/input/HtmlInputField.d.ts +33 -0
- package/dist/src/components/input/HtmlInputField.d.ts.map +1 -0
- package/dist/src/components/input/SelectInputField.d.ts +31 -0
- package/dist/src/components/input/SelectInputField.d.ts.map +1 -0
- package/dist/src/components/input/SwitchInputField.d.ts +27 -0
- package/dist/src/components/input/SwitchInputField.d.ts.map +1 -0
- package/dist/src/components/input/TextField.d.ts +18 -0
- package/dist/src/components/input/TextField.d.ts.map +1 -0
- package/dist/src/components/input/TextInputField.d.ts +34 -0
- package/dist/src/components/input/TextInputField.d.ts.map +1 -0
- package/dist/src/components/input/index.d.ts +19 -0
- package/dist/src/components/input/index.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts +34 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts +9 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts.map +1 -0
- package/dist/src/components/layout/GridCell.d.ts +32 -0
- package/dist/src/components/layout/GridCell.d.ts.map +1 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts +46 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts.map +1 -0
- package/dist/src/components/layout/GridLayout.d.ts +50 -0
- package/dist/src/components/layout/GridLayout.d.ts.map +1 -0
- package/dist/src/components/layout/index.d.ts +14 -0
- package/dist/src/components/layout/index.d.ts.map +1 -0
- package/dist/src/components/menu/Menu.d.ts +1 -0
- package/dist/src/components/menu/Menu.d.ts.map +1 -0
- package/dist/src/components/menu/MenuItem.d.ts +31 -0
- package/dist/src/components/menu/MenuItem.d.ts.map +1 -0
- package/dist/src/components/menu/index.d.ts +7 -0
- package/dist/src/components/menu/index.d.ts.map +1 -0
- package/dist/src/components/pages/FormPage.d.ts +66 -0
- package/dist/src/components/pages/FormPage.d.ts.map +1 -0
- package/dist/src/components/pages/Page.d.ts +68 -0
- package/dist/src/components/pages/Page.d.ts.map +1 -0
- package/dist/src/components/pages/index.d.ts +10 -0
- package/dist/src/components/pages/index.d.ts.map +1 -0
- package/dist/src/components/shared/createSerializableView.d.ts +81 -0
- package/dist/src/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/src/components/shared/viewProps.d.ts +37 -0
- package/dist/src/components/shared/viewProps.d.ts.map +1 -0
- package/dist/src/config/AppConfig.d.ts +49 -0
- package/dist/src/config/AppConfig.d.ts.map +1 -0
- package/dist/src/config/AppConfigBuilder.d.ts +75 -0
- package/dist/src/config/AppConfigBuilder.d.ts.map +1 -0
- package/dist/src/config/index.d.ts +13 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/types.d.ts +130 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config.d.ts +15 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/contexts/DataContext.d.ts +139 -0
- package/dist/src/contexts/DataContext.d.ts.map +1 -0
- package/dist/src/contexts/DimensionsContext.d.ts +42 -0
- package/dist/src/contexts/DimensionsContext.d.ts.map +1 -0
- package/dist/src/contexts/PaletteContext.d.ts +53 -0
- package/dist/src/contexts/PaletteContext.d.ts.map +1 -0
- package/dist/src/contexts/PrintModeContext.d.ts +27 -0
- package/dist/src/contexts/PrintModeContext.d.ts.map +1 -0
- package/dist/src/contexts/QwickAppContext.d.ts +71 -0
- package/dist/src/contexts/QwickAppContext.d.ts.map +1 -0
- package/dist/src/contexts/ThemeContext.d.ts +65 -0
- package/dist/src/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/src/contexts/index.d.ts +11 -0
- package/dist/src/contexts/index.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +12 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useBaseProps.d.ts +101 -0
- package/dist/src/hooks/useBaseProps.d.ts.map +1 -0
- package/dist/src/hooks/useDataBinding.d.ts +22 -0
- package/dist/src/hooks/useDataBinding.d.ts.map +1 -0
- package/dist/src/hooks/usePrintMode.d.ts +39 -0
- package/dist/src/hooks/usePrintMode.d.ts.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/palettes/PaletteAutumn.d.ts +10 -0
- package/dist/src/palettes/PaletteAutumn.d.ts.map +1 -0
- package/dist/src/palettes/PaletteCosmic.d.ts +10 -0
- package/dist/src/palettes/PaletteCosmic.d.ts.map +1 -0
- package/dist/src/palettes/PaletteDefault.d.ts +10 -0
- package/dist/src/palettes/PaletteDefault.d.ts.map +1 -0
- package/dist/src/palettes/PaletteOcean.d.ts +10 -0
- package/dist/src/palettes/PaletteOcean.d.ts.map +1 -0
- package/dist/src/palettes/PaletteSpring.d.ts +10 -0
- package/dist/src/palettes/PaletteSpring.d.ts.map +1 -0
- package/dist/src/palettes/PaletteWinter.d.ts +10 -0
- package/dist/src/palettes/PaletteWinter.d.ts.map +1 -0
- package/dist/src/palettes/index.d.ts +13 -0
- package/dist/src/palettes/index.d.ts.map +1 -0
- package/dist/src/schemas/ActionSchema.d.ts +21 -0
- package/dist/src/schemas/ActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/ArticleSchema.d.ts +13 -0
- package/dist/src/schemas/ArticleSchema.d.ts.map +1 -0
- package/dist/src/schemas/ButtonSchema.d.ts +19 -0
- package/dist/src/schemas/ButtonSchema.d.ts.map +1 -0
- package/dist/src/schemas/CardListGridSchema.d.ts +17 -0
- package/dist/src/schemas/CardListGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/CodeSchema.d.ts +18 -0
- package/dist/src/schemas/CodeSchema.d.ts.map +1 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts +32 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContainerSchema.d.ts +12 -0
- package/dist/src/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContentSchema.d.ts +21 -0
- package/dist/src/schemas/ContentSchema.d.ts.map +1 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts +28 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts +17 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts +16 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterItemSchema.d.ts +15 -0
- package/dist/src/schemas/FooterItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSchema.d.ts +20 -0
- package/dist/src/schemas/FooterSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts +15 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/FormBlockSchema.d.ts +19 -0
- package/dist/src/schemas/FormBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridCellSchema.d.ts +23 -0
- package/dist/src/schemas/GridCellSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts +21 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts +17 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts +22 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlSchema.d.ts +14 -0
- package/dist/src/schemas/HtmlSchema.d.ts.map +1 -0
- package/dist/src/schemas/ImageSchema.d.ts +32 -0
- package/dist/src/schemas/ImageSchema.d.ts.map +1 -0
- package/dist/src/schemas/LogoSchema.d.ts +35 -0
- package/dist/src/schemas/LogoSchema.d.ts.map +1 -0
- package/dist/src/schemas/MarkdownSchema.d.ts +14 -0
- package/dist/src/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts +13 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts +31 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts.map +1 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts +16 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts +31 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts.map +1 -0
- package/dist/src/schemas/ProductCardSchema.d.ts +39 -0
- package/dist/src/schemas/ProductCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts +13 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts.map +1 -0
- package/dist/src/schemas/SectionSchema.d.ts +16 -0
- package/dist/src/schemas/SectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts +27 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts +22 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextSchema.d.ts +37 -0
- package/dist/src/schemas/TextSchema.d.ts.map +1 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts +19 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/ViewSchema.d.ts +66 -0
- package/dist/src/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/src/schemas/index.d.ts +47 -0
- package/dist/src/schemas/index.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts +128 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/registry.d.ts +18 -0
- package/dist/src/schemas/transformers/registry.d.ts.map +1 -0
- package/dist/src/schemas/types/Serializable.d.ts +46 -0
- package/dist/src/schemas/types/Serializable.d.ts.map +1 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts +44 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts.map +1 -0
- package/dist/src/templates/TemplateResolver.d.ts +52 -0
- package/dist/src/templates/TemplateResolver.d.ts.map +1 -0
- package/dist/src/templates/index.d.ts +7 -0
- package/dist/src/templates/index.d.ts.map +1 -0
- package/dist/src/types/CacheProvider.d.ts +18 -0
- package/dist/src/types/CacheProvider.d.ts.map +1 -0
- package/dist/src/types/CollapsibleLayout.d.ts +142 -0
- package/dist/src/types/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/types/ContentProxy.d.ts +47 -0
- package/dist/src/types/ContentProxy.d.ts.map +1 -0
- package/dist/src/types/DataTypes.d.ts +185 -0
- package/dist/src/types/DataTypes.d.ts.map +1 -0
- package/dist/src/types/TemplateProvider.d.ts +10 -0
- package/dist/src/types/TemplateProvider.d.ts.map +1 -0
- package/dist/src/types/TemplateResolver.d.ts +23 -0
- package/dist/src/types/TemplateResolver.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +82 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/breakpoints.d.ts +35 -0
- package/dist/src/utils/breakpoints.d.ts.map +1 -0
- package/dist/src/utils/cssUtils.d.ts +17 -0
- package/dist/src/utils/cssUtils.d.ts.map +1 -0
- package/dist/src/utils/customPaletteManager.d.ts +8 -0
- package/dist/src/utils/customPaletteManager.d.ts.map +1 -0
- package/dist/src/utils/dimensions.d.ts +34 -0
- package/dist/src/utils/dimensions.d.ts.map +1 -0
- package/dist/src/utils/htmlTransform.d.ts +44 -0
- package/dist/src/utils/htmlTransform.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +16 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/logger.d.ts +26 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/paletteUtils.d.ts +38 -0
- package/dist/src/utils/paletteUtils.d.ts.map +1 -0
- package/dist/src/utils/persistenceUtils.d.ts +31 -0
- package/dist/src/utils/persistenceUtils.d.ts.map +1 -0
- package/dist/src/utils/reactUtils.d.ts +33 -0
- package/dist/src/utils/reactUtils.d.ts.map +1 -0
- package/dist/src/utils/spacing.d.ts +34 -0
- package/dist/src/utils/spacing.d.ts.map +1 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts +32 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts.map +1 -0
- package/dist/src/utils/themeUtils.d.ts +27 -0
- package/dist/src/utils/themeUtils.d.ts.map +1 -0
- package/dist/utils/cssUtils.d.ts +17 -0
- package/dist/utils/cssUtils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/scripts/bundle-css.cjs +27 -0
- package/scripts/create-project.sh +28 -0
- package/scripts/create-qwickapps-project.js +284 -0
- package/src/__tests__/components/base/Container.test.tsx +966 -0
- package/src/__tests__/schemas/PageTemplateSchema.test.ts +1 -1
- package/src/__tests__/schemas/ViewSchema.test.ts +805 -0
- package/src/__tests__/schemas/builders.test.ts +2 -2
- package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +19 -19
- package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +13 -13
- package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +39 -39
- package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +14 -14
- package/src/__tests__/schemas/transformers/TestAutomation.test.ts +8 -8
- package/src/__tests__/schemas/transformers/nested-serialization.test.tsx +181 -0
- package/src/__tests__/schemas/transformers/round-trip-component-serialization.test.tsx +458 -0
- package/src/__tests__/test_image_accessibility.test.tsx +226 -0
- package/src/__tests__/utils/optional-logging.test.ts +3 -3
- package/src/components/Html.tsx +24 -15
- package/src/components/Logo.tsx +2 -2
- package/src/components/Markdown.tsx +2 -7
- package/src/components/SafeSpan.tsx +2 -7
- package/src/components/base/Container.tsx +61 -0
- package/src/components/base/ModelView.tsx +225 -91
- package/src/components/base/index.ts +3 -2
- package/src/components/blocks/Article.tsx +2 -7
- package/src/components/blocks/CardListGrid.tsx +2 -2
- package/src/components/blocks/Code.tsx +91 -179
- package/src/components/blocks/Content.tsx +2 -2
- package/src/components/blocks/CoverImageHeader.tsx +2 -2
- package/src/components/blocks/HeroBlock.tsx +54 -146
- package/src/components/blocks/Image.tsx +82 -196
- package/src/components/blocks/PageBannerHeader.tsx +2 -2
- package/src/components/blocks/Section.tsx +79 -181
- package/src/components/blocks/Text.tsx +100 -198
- package/src/components/buttons/Button.tsx +85 -183
- package/src/components/buttons/PaletteSwitcher.tsx +2 -2
- package/src/components/buttons/ThemeSwitcher.tsx +2 -2
- package/src/components/forms/FormBlock.tsx +2 -2
- package/src/components/index.ts +5 -0
- package/src/components/input/ChoiceInputField.tsx +76 -160
- package/src/components/input/HtmlInputField.tsx +141 -264
- package/src/components/input/SelectInputField.tsx +48 -153
- package/src/components/input/SwitchInputField.tsx +41 -139
- package/src/components/input/TextInputField.tsx +39 -116
- package/src/components/layout/GridCell.tsx +36 -122
- package/src/components/layout/GridLayout.tsx +55 -127
- package/src/components/pages/Page.tsx +268 -276
- package/src/components/pages/index.ts +2 -3
- package/src/components/shared/createSerializableView.tsx +280 -0
- package/src/components/shared/viewProps.ts +207 -0
- package/src/config/__tests__/AppConfigBuilder.test.ts +2 -2
- package/src/contexts/DataContext.tsx +1 -1
- package/src/schemas/ButtonSchema.ts +3 -2
- package/src/schemas/CardListGridSchema.ts +3 -2
- package/src/schemas/ChoiceInputFieldSchema.ts +3 -2
- package/src/schemas/CodeSchema.ts +8 -6
- package/src/schemas/ContainerSchema.ts +25 -0
- package/src/schemas/FeatureCardSchema.ts +1 -1
- package/src/schemas/FormBlockSchema.ts +3 -2
- package/src/schemas/GridCellSchema.ts +4 -10
- package/src/schemas/GridLayoutSchema.ts +8 -14
- package/src/schemas/HeroBlockSchema.ts +3 -2
- package/src/schemas/HtmlInputFieldSchema.ts +3 -2
- package/src/schemas/ImageSchema.ts +3 -2
- package/src/schemas/PageTemplateSchema.ts +5 -5
- package/src/schemas/SectionSchema.ts +4 -12
- package/src/schemas/SelectInputFieldSchema.ts +3 -2
- package/src/schemas/SwitchInputFieldSchema.ts +2 -2
- package/src/schemas/TextInputFieldSchema.ts +3 -2
- package/src/schemas/ViewSchema.ts +570 -0
- package/src/schemas/index.ts +1 -1
- package/src/schemas/transformers/ComponentTransformer.ts +185 -163
- package/src/schemas/transformers/ReactNodeTransformer.ts +31 -28
- package/src/schemas/transformers/registry.ts +17 -10
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ChoiceInputField.stories.tsx +28 -1
- package/src/stories/Code.stories.tsx +61 -1
- package/src/stories/Container.stories.tsx +954 -0
- package/src/stories/FormBlock.stories.tsx +54 -0
- package/src/stories/FormComponents.stories.tsx +8 -13
- package/src/stories/GridCell.stories.tsx +23 -64
- package/src/stories/GridLayout.stories.tsx +22 -47
- package/src/stories/HeroBlock.stories.tsx +28 -0
- package/src/stories/HtmlInputField.stories.tsx +23 -1
- package/src/stories/Image.stories.tsx +45 -233
- package/src/stories/Markdown.stories.tsx +1 -1
- package/src/stories/Section.stories.tsx +38 -4
- package/src/stories/SelectInputField.stories.tsx +26 -1
- package/src/stories/Text.stories.tsx +22 -54
- package/src/stories/TextInputField.stories.tsx +24 -1
- package/src/stories/_templates/SerializationTemplate.tsx +165 -0
- package/src/templates/TemplateResolver.ts +2 -2
- package/src/types/CollapsibleLayout.ts +2 -2
- package/src/utils/cssUtils.ts +49 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +13 -13
- package/src/__tests__/components/base/ModelView.test.tsx +0 -220
- package/src/__tests__/schemas/ViewModelSchema.test.ts +0 -80
- package/src/components/blocks/Code.md +0 -529
- package/src/schemas/README.md +0 -661
- package/src/schemas/ViewModelSchema.ts +0 -115
- package/src/tests/ConsoleWarningTest.tsx +0 -30
- package/src/tests/StorageKeyTest.tsx +0 -110
- package/src/tests/ThemeStorageKeyTest.tsx +0 -114
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Code -
|
|
2
|
+
* Code - Content-prop leaf component for secure code display
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Uses content-prop strategy to prevent JSON deserialization vulnerabilities.
|
|
5
|
+
* Code content is serialized as data.content (string), not data.children,
|
|
6
|
+
* preventing recursive deserialization of example JSON that looks like components.
|
|
7
|
+
*
|
|
8
|
+
* Features preserved:
|
|
5
9
|
* - Syntax highlighting support
|
|
6
|
-
* - Copy to clipboard functionality
|
|
10
|
+
* - Copy to clipboard functionality
|
|
7
11
|
* - Light/dark theme support
|
|
8
12
|
* - Multiple language support
|
|
9
13
|
* - Responsive design
|
|
14
|
+
* - Line numbers support
|
|
15
|
+
* - Title display
|
|
16
|
+
* - Custom backgrounds
|
|
10
17
|
*
|
|
11
18
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
12
19
|
*/
|
|
13
20
|
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
IconButton,
|
|
22
|
-
Paper,
|
|
23
|
-
Snackbar,
|
|
24
|
-
Tooltip,
|
|
25
|
-
Typography,
|
|
26
|
-
useTheme
|
|
27
|
-
} from '@mui/material';
|
|
28
|
-
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
29
|
-
import React, { ReactElement, useState } from 'react';
|
|
30
|
-
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding } from '../../hooks';
|
|
31
|
-
import CodeModel from '../../schemas/CodeSchema';
|
|
32
|
-
import { ModelView } from '../base/ModelView';
|
|
33
|
-
import { extractTextFromReactNode } from '../../utils/reactUtils';
|
|
34
|
-
|
|
35
|
-
type CodeViewProps = ModelProps<CodeModel>;
|
|
21
|
+
import React, { useState } from 'react';
|
|
22
|
+
import { Box, Paper, Typography, Tooltip, IconButton, Snackbar, Alert, useTheme } from '@mui/material';
|
|
23
|
+
import { ContentCopy as CopyIcon, Check as CheckIcon } from '@mui/icons-material';
|
|
24
|
+
import CodeSchema from '../../schemas/CodeSchema';
|
|
25
|
+
import type { SchemaProps } from '@qwickapps/schema/src/types/ModelProps';
|
|
26
|
+
import { ViewProps } from '../shared/viewProps';
|
|
27
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
36
28
|
|
|
37
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Props interface for Code component
|
|
31
|
+
* Uses SchemaProps<typeof CodeSchema> for clean typing
|
|
32
|
+
*/
|
|
33
|
+
export type CodeProps = ViewProps & SchemaProps<typeof CodeSchema>;
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
/**
|
|
36
|
+
* CodeView - Pure view component that renders the code display
|
|
37
|
+
*
|
|
38
|
+
* This component receives fully processed props from createSerializableView
|
|
39
|
+
* and renders the code using Material-UI components with all features preserved.
|
|
40
|
+
*/
|
|
40
41
|
function CodeView({
|
|
41
|
-
|
|
42
|
+
content,
|
|
42
43
|
language = 'text',
|
|
43
44
|
showCopy = true,
|
|
44
45
|
showLineNumbers = false,
|
|
@@ -46,34 +47,29 @@ function CodeView({
|
|
|
46
47
|
wrapLines = false,
|
|
47
48
|
codeBackground,
|
|
48
49
|
...restProps
|
|
49
|
-
}:
|
|
50
|
-
const { styleProps, htmlProps, restProps: otherProps } = useBaseProps(restProps);
|
|
51
|
-
|
|
52
|
-
// Mark as QwickApp component
|
|
53
|
-
(CodeView as any)[QWICKAPP_COMPONENT] = true;
|
|
50
|
+
}: CodeProps) {
|
|
54
51
|
|
|
55
52
|
|
|
56
53
|
const theme = useTheme();
|
|
57
54
|
const [copied, setCopied] = useState(false);
|
|
58
55
|
const [showCopiedAlert, setShowCopiedAlert] = useState(false);
|
|
59
56
|
|
|
60
|
-
const codeMaxHeight =
|
|
57
|
+
const codeMaxHeight = (restProps.sx as any)?.maxHeight || 400;
|
|
61
58
|
|
|
62
|
-
//
|
|
63
|
-
const codeContent =
|
|
59
|
+
// Use content prop directly (already a string from content-prop strategy)
|
|
60
|
+
const codeContent = content || '';
|
|
64
61
|
|
|
65
62
|
// Return empty state if no code content
|
|
66
63
|
if (!codeContent?.trim()) {
|
|
67
64
|
return (
|
|
68
65
|
<Paper
|
|
69
|
-
{...
|
|
70
|
-
{...styleProps}
|
|
66
|
+
{...restProps}
|
|
71
67
|
variant="outlined"
|
|
72
68
|
sx={{
|
|
73
69
|
p: 3,
|
|
74
70
|
textAlign: 'center',
|
|
75
71
|
opacity: 0.6,
|
|
76
|
-
...
|
|
72
|
+
...restProps.sx
|
|
77
73
|
}}
|
|
78
74
|
>
|
|
79
75
|
<Typography variant="body2" color="text.secondary">
|
|
@@ -115,9 +111,7 @@ function CodeView({
|
|
|
115
111
|
|
|
116
112
|
return (
|
|
117
113
|
<Paper
|
|
118
|
-
{...
|
|
119
|
-
{...styleProps}
|
|
120
|
-
{...otherProps}
|
|
114
|
+
{...restProps}
|
|
121
115
|
variant="outlined"
|
|
122
116
|
sx={{
|
|
123
117
|
backgroundColor: getBackgroundColor(),
|
|
@@ -125,7 +119,7 @@ function CodeView({
|
|
|
125
119
|
borderRadius: 1,
|
|
126
120
|
overflow: 'hidden',
|
|
127
121
|
position: 'relative',
|
|
128
|
-
...
|
|
122
|
+
...restProps.sx
|
|
129
123
|
}}
|
|
130
124
|
>
|
|
131
125
|
{/* Header with title and copy button */}
|
|
@@ -218,7 +212,7 @@ function CodeView({
|
|
|
218
212
|
minWidth: `${String(codeLines.length).length + 1}ch`,
|
|
219
213
|
}}
|
|
220
214
|
>
|
|
221
|
-
{codeLines.map((_, index) => (
|
|
215
|
+
{codeLines.map((_: string, index: number) => (
|
|
222
216
|
<Box key={index} sx={{ textAlign: 'right' }}>
|
|
223
217
|
{index + 1}
|
|
224
218
|
</Box>
|
|
@@ -251,150 +245,68 @@ function CodeView({
|
|
|
251
245
|
);
|
|
252
246
|
}
|
|
253
247
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Create Code component using the factory pattern
|
|
250
|
+
*/
|
|
251
|
+
export const Code: SerializableComponent<CodeProps> = createSerializableView<CodeProps>({
|
|
252
|
+
tagName: 'Code',
|
|
253
|
+
version: '1.0.0',
|
|
254
|
+
role: 'view',
|
|
255
|
+
View: CodeView,
|
|
256
|
+
childrenStrategy: { mode: 'content-prop', propName: 'content' }
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Register HTML patterns that Code component can handle
|
|
260
|
+
(Code as any).registerPatternHandlers = (registry: any): void => {
|
|
261
|
+
// Register pre + code pattern
|
|
262
|
+
if (!registry.hasPattern('pre code')) {
|
|
263
|
+
registry.registerPattern('pre code', (Code as any).transformPreCode);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
//
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
language: this.props.language,
|
|
269
|
-
showCopy: this.props.showCopy,
|
|
270
|
-
showLineNumbers: this.props.showLineNumbers,
|
|
271
|
-
title: this.props.title,
|
|
272
|
-
wrapLines: this.props.wrapLines,
|
|
273
|
-
codeBackground: this.props.codeBackground
|
|
274
|
-
};
|
|
266
|
+
// Register standalone code pattern for complex code blocks
|
|
267
|
+
if (!registry.hasPattern('code.highlight')) {
|
|
268
|
+
registry.registerPattern('code.highlight', (Code as any).transformCodeHighlight);
|
|
275
269
|
}
|
|
270
|
+
};
|
|
276
271
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
272
|
+
// Transform pre + code elements to Code component
|
|
273
|
+
(Code as any).transformPreCode = (element: Element): any => {
|
|
274
|
+
const codeChild = element.querySelector('code');
|
|
275
|
+
if (!codeChild) return null;
|
|
282
276
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
277
|
+
const language = Array.from(codeChild.classList)
|
|
278
|
+
.find(cls => cls.startsWith('language-'))
|
|
279
|
+
?.replace('language-', '') || 'text';
|
|
287
280
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
// Register standalone code pattern for complex code blocks
|
|
296
|
-
if (!registry.hasPattern('code.highlight')) {
|
|
297
|
-
registry.registerPattern('code.highlight', Code.transformCodeHighlight);
|
|
281
|
+
return {
|
|
282
|
+
tagName: 'Code',
|
|
283
|
+
props: {
|
|
284
|
+
language,
|
|
285
|
+
showCopy: true,
|
|
286
|
+
showLineNumbers: false,
|
|
287
|
+
content: codeChild.textContent || ''
|
|
298
288
|
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Transform pre + code elements to Code component
|
|
302
|
-
private static transformPreCode(element: Element): any {
|
|
303
|
-
const codeChild = element.querySelector('code');
|
|
304
|
-
if (!codeChild) return null;
|
|
305
|
-
|
|
306
|
-
const language = Array.from(codeChild.classList)
|
|
307
|
-
.find(cls => cls.startsWith('language-'))
|
|
308
|
-
?.replace('language-', '') || 'text';
|
|
309
|
-
|
|
310
|
-
return {
|
|
311
|
-
tagName: 'Code',
|
|
312
|
-
props: {
|
|
313
|
-
language,
|
|
314
|
-
showCopy: true,
|
|
315
|
-
showLineNumbers: false,
|
|
316
|
-
children: codeChild.textContent || ''
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Transform highlighted code elements to Code component
|
|
322
|
-
private static transformCodeHighlight(element: Element): any {
|
|
323
|
-
const language = Array.from(element.classList)
|
|
324
|
-
.find(cls => cls.startsWith('language-'))
|
|
325
|
-
?.replace('language-', '') || 'text';
|
|
326
|
-
|
|
327
|
-
return {
|
|
328
|
-
tagName: 'Code',
|
|
329
|
-
props: {
|
|
330
|
-
language,
|
|
331
|
-
showCopy: true,
|
|
332
|
-
showLineNumbers: false,
|
|
333
|
-
children: element.textContent || ''
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Helper component to handle data binding with hooks (since we can't use hooks in class components)
|
|
340
|
-
function CodeWithDataBinding(props: CodeProps) {
|
|
341
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
342
|
-
|
|
343
|
-
// Use data binding
|
|
344
|
-
const { dataSource: _source, loading, error, cached, ...rawCodeProps } = useDataBinding<CodeModel>(
|
|
345
|
-
dataSource!,
|
|
346
|
-
restProps as Partial<CodeModel>,
|
|
347
|
-
CodeModel.getSchema(),
|
|
348
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
349
|
-
);
|
|
350
|
-
|
|
351
|
-
// Use props directly since new serialization system handles component-level transformation
|
|
352
|
-
const codeProps = rawCodeProps;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
353
291
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
sx={{
|
|
360
|
-
p: 3,
|
|
361
|
-
textAlign: 'center'
|
|
362
|
-
}}
|
|
363
|
-
>
|
|
364
|
-
<Typography variant="body2">Loading Code...</Typography>
|
|
365
|
-
<Typography variant="caption" color="text.secondary">
|
|
366
|
-
Loading
|
|
367
|
-
</Typography>
|
|
368
|
-
</Paper>
|
|
369
|
-
);
|
|
370
|
-
}
|
|
292
|
+
// Transform highlighted code elements to Code component
|
|
293
|
+
(Code as any).transformCodeHighlight = (element: Element): any => {
|
|
294
|
+
const language = Array.from(element.classList)
|
|
295
|
+
.find(cls => cls.startsWith('language-'))
|
|
296
|
+
?.replace('language-', '') || 'text';
|
|
371
297
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
p: 3,
|
|
380
|
-
textAlign: 'center',
|
|
381
|
-
borderColor: 'error.main'
|
|
382
|
-
}}
|
|
383
|
-
>
|
|
384
|
-
<Typography variant="body2" color="error">
|
|
385
|
-
Error Loading Code
|
|
386
|
-
</Typography>
|
|
387
|
-
<Typography variant="caption" color="text.secondary">
|
|
388
|
-
{error.message}
|
|
389
|
-
</Typography>
|
|
390
|
-
</Paper>
|
|
391
|
-
);
|
|
298
|
+
return {
|
|
299
|
+
tagName: 'Code',
|
|
300
|
+
props: {
|
|
301
|
+
language,
|
|
302
|
+
showCopy: true,
|
|
303
|
+
showLineNumbers: false,
|
|
304
|
+
content: element.textContent || ''
|
|
392
305
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
console.log('Resolved props for Code:', codeProps);
|
|
397
|
-
return <CodeView {...codeProps} />;
|
|
398
|
-
}
|
|
306
|
+
};
|
|
307
|
+
};
|
|
399
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Export the component as default
|
|
311
|
+
*/
|
|
400
312
|
export default Code;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Box, Paper, Stack, SxProps, Theme, Typography, useTheme } from '@mui/material';
|
|
18
|
-
import { WithDataBinding,
|
|
18
|
+
import { WithDataBinding, SchemaProps } from '@qwickapps/schema';
|
|
19
19
|
import React from 'react';
|
|
20
20
|
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding } from '../../hooks';
|
|
21
21
|
import ContentModel from '../../schemas/ContentSchema';
|
|
@@ -24,7 +24,7 @@ import { mapToMUIBreakpoint } from '../../utils/breakpoints';
|
|
|
24
24
|
import { Button } from '../buttons/Button';
|
|
25
25
|
import Html from '../Html';
|
|
26
26
|
|
|
27
|
-
type ContentViewProps =
|
|
27
|
+
type ContentViewProps = SchemaProps<ContentModel>;
|
|
28
28
|
|
|
29
29
|
export interface ContentProps extends ContentViewProps, WithDataBinding {}
|
|
30
30
|
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
Paper,
|
|
22
22
|
Typography,
|
|
23
23
|
} from '@mui/material';
|
|
24
|
-
import { WithDataBinding,
|
|
24
|
+
import { WithDataBinding, SchemaProps } from '@qwickapps/schema';
|
|
25
25
|
import React, { useState } from 'react';
|
|
26
26
|
import { useBaseProps, useDataBinding, WithBaseProps } from '../../hooks';
|
|
27
27
|
import CoverImageHeaderModel from '../../schemas/CoverImageHeaderSchema';
|
|
@@ -44,7 +44,7 @@ export interface HeaderAction {
|
|
|
44
44
|
priority?: number;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
type CoverImageHeaderViewProps = Omit<
|
|
47
|
+
type CoverImageHeaderViewProps = Omit<SchemaProps<CoverImageHeaderModel>, 'actions' | 'tags' | 'image'> & WithBaseProps & {
|
|
48
48
|
/** Image URL or React component (extended from schema string) */
|
|
49
49
|
image?: string | React.ReactNode;
|
|
50
50
|
/** Array of tag strings or JSX elements (extended from schema string[]) */
|
|
@@ -1,44 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HeroBlock Component -
|
|
2
|
+
* HeroBlock Component - Factory-based implementation using createSerializableView
|
|
3
|
+
*
|
|
4
|
+
* Migrated from class-based ModelView to factory pattern for better
|
|
5
|
+
* schema-driven architecture while preserving all functionality.
|
|
3
6
|
*
|
|
4
7
|
* Features:
|
|
5
8
|
* - Responsive headline, subtitle, and actions
|
|
6
9
|
* - Supports background images, gradients, and theme colors
|
|
7
10
|
* - Overlay for image backgrounds
|
|
8
11
|
* - Customizable height, alignment, and overlay opacity
|
|
9
|
-
* - Full serialization support
|
|
10
|
-
* - Nested Button component
|
|
12
|
+
* - Full serialization support
|
|
13
|
+
* - Nested Button component support
|
|
11
14
|
*
|
|
12
15
|
* Usage:
|
|
13
16
|
* - Traditional: <HeroBlock title="Welcome" subtitle="Get started" actions={[...]} />
|
|
14
17
|
* - Data-driven: <HeroBlock dataSource="pages.home.hero" />
|
|
15
|
-
* - Serializable: ComponentTransformer.serialize(<HeroBlock ... />)
|
|
16
18
|
*
|
|
17
19
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
18
20
|
*/
|
|
19
21
|
|
|
20
22
|
import { Box, Container, Stack, Typography, useTheme } from '@mui/material';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import HeroBlockModel from '../../schemas/HeroBlockSchema';
|
|
25
|
-
import { ModelView } from '../base/ModelView';
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
25
|
+
import { ViewProps } from '../shared/viewProps';
|
|
26
26
|
import { Button, ButtonProps } from '../buttons/Button';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Props interface for HeroBlock component - extends ViewProps
|
|
30
|
+
*/
|
|
31
|
+
export interface HeroBlockProps extends ViewProps {
|
|
32
|
+
/** Main headline text */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** Subtitle or description text */
|
|
35
|
+
subtitle?: string;
|
|
36
|
+
/** Background image URL */
|
|
37
|
+
backgroundImage?: string;
|
|
38
|
+
/** Background gradient CSS value */
|
|
39
|
+
backgroundGradient?: string;
|
|
40
|
+
/** Background color theme variant */
|
|
41
|
+
backgroundColor?: 'default' | 'primary' | 'secondary' | 'surface';
|
|
29
42
|
/** Action buttons (data-driven) */
|
|
30
43
|
actions?: ButtonProps[];
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface HeroBlockProps extends HeroBlockViewProps, WithDataBinding {}
|
|
44
|
+
/** Text alignment */
|
|
45
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
46
|
+
/** Block height preset */
|
|
47
|
+
blockHeight?: 'small' | 'medium' | 'large' | 'viewport';
|
|
48
|
+
/** Custom overlay opacity (0-1) when using background images */
|
|
49
|
+
overlayOpacity?: number;
|
|
50
|
+
}
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
/**
|
|
53
|
+
* HeroBlockView - Pure view component that renders the actual hero block
|
|
54
|
+
*
|
|
55
|
+
* This component receives fully processed props from createSerializableView
|
|
56
|
+
* and renders the hero block using Material-UI components with all styling applied.
|
|
57
|
+
*/
|
|
42
58
|
function HeroBlockView({
|
|
43
59
|
title = '',
|
|
44
60
|
subtitle,
|
|
@@ -50,12 +66,9 @@ function HeroBlockView({
|
|
|
50
66
|
textAlign = 'center',
|
|
51
67
|
blockHeight = 'medium',
|
|
52
68
|
overlayOpacity = 0.5,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// Mark as QwickApp component
|
|
58
|
-
(HeroBlockView as any)[QWICKAPP_COMPONENT] = true;
|
|
69
|
+
gridProps,
|
|
70
|
+
...props
|
|
71
|
+
}: HeroBlockProps & { gridProps?: any }) {
|
|
59
72
|
const theme = useTheme();
|
|
60
73
|
|
|
61
74
|
// Map height variants to actual heights
|
|
@@ -113,16 +126,8 @@ function HeroBlockView({
|
|
|
113
126
|
return (
|
|
114
127
|
<Box
|
|
115
128
|
component="section"
|
|
116
|
-
{...
|
|
117
|
-
{...
|
|
118
|
-
{...(gridProps && {
|
|
119
|
-
'data-grid-span': gridProps.span,
|
|
120
|
-
'data-grid-xs': gridProps.xs,
|
|
121
|
-
'data-grid-sm': gridProps.sm,
|
|
122
|
-
'data-grid-md': gridProps.md,
|
|
123
|
-
'data-grid-lg': gridProps.lg,
|
|
124
|
-
'data-grid-xl': gridProps.xl,
|
|
125
|
-
})}
|
|
129
|
+
{...props}
|
|
130
|
+
{...(gridProps && { 'data-grid': JSON.stringify(gridProps) })}
|
|
126
131
|
sx={{
|
|
127
132
|
position: 'relative',
|
|
128
133
|
display: 'flex',
|
|
@@ -136,7 +141,7 @@ function HeroBlockView({
|
|
|
136
141
|
backgroundPosition: backgroundImage ? 'center' : 'initial',
|
|
137
142
|
backgroundRepeat: 'no-repeat',
|
|
138
143
|
overflow: 'hidden',
|
|
139
|
-
...
|
|
144
|
+
...props.sx,
|
|
140
145
|
}}
|
|
141
146
|
>
|
|
142
147
|
{/* Overlay for background images */}
|
|
@@ -234,114 +239,17 @@ function HeroBlockView({
|
|
|
234
239
|
);
|
|
235
240
|
}
|
|
236
241
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Component-specific serialization properties
|
|
249
|
-
protected getComponentSpecificProps(): any {
|
|
250
|
-
return {
|
|
251
|
-
title: this.props.title,
|
|
252
|
-
subtitle: this.props.subtitle,
|
|
253
|
-
backgroundImage: this.props.backgroundImage,
|
|
254
|
-
backgroundGradient: this.props.backgroundGradient,
|
|
255
|
-
backgroundColor: this.props.backgroundColor,
|
|
256
|
-
textAlign: this.props.textAlign,
|
|
257
|
-
blockHeight: this.props.blockHeight,
|
|
258
|
-
overlayOpacity: this.props.overlayOpacity,
|
|
259
|
-
// Serialize actions array (ButtonProps)
|
|
260
|
-
actions: this.props.actions
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Override serializeChildren to handle nested Button components
|
|
265
|
-
protected serializeChildren(children: ReactNode): any {
|
|
266
|
-
if (typeof children === 'string') {
|
|
267
|
-
return children;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// HeroBlock can contain complex nested content, but not necessarily other serializable components
|
|
271
|
-
// Handle the children as-is for now, since HeroBlock typically contains MUI Typography and Box elements
|
|
272
|
-
// The actions prop is handled separately in getComponentSpecificProps
|
|
273
|
-
if (children) {
|
|
274
|
-
// For HeroBlock, children are typically additional content (Typography, Box)
|
|
275
|
-
// These don't need component serialization, just text extraction
|
|
276
|
-
const { extractTextFromReactNode } = require('../../utils/reactUtils');
|
|
277
|
-
return extractTextFromReactNode(children);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return undefined;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// Indicate that HeroBlock doesn't contain nested serializable components in children
|
|
284
|
-
// (actions are handled separately via props)
|
|
285
|
-
protected hasNestedComponents(children: ReactNode): boolean {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// HeroBlock component renders traditional props view
|
|
290
|
-
protected renderView(): React.ReactElement {
|
|
291
|
-
const { dataSource, bindingOptions, ...restProps } = this.props;
|
|
292
|
-
return <HeroBlockView {...restProps} />;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// HeroBlock component renders data-bound view
|
|
296
|
-
protected renderWithDataBinding(): React.ReactElement {
|
|
297
|
-
return <HeroBlockWithDataBinding {...this.props} />;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Helper component to handle data binding with hooks (since we can't use hooks in class components)
|
|
302
|
-
function HeroBlockWithDataBinding(props: HeroBlockProps) {
|
|
303
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
304
|
-
|
|
305
|
-
// Use data binding
|
|
306
|
-
const { dataSource: _source, loading, error, cached, ...heroProps } = useDataBinding<HeroBlockModel>(
|
|
307
|
-
dataSource!,
|
|
308
|
-
restProps as Partial<HeroBlockModel>,
|
|
309
|
-
HeroBlockModel.getSchema(),
|
|
310
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
311
|
-
);
|
|
312
|
-
|
|
313
|
-
// Show loading state
|
|
314
|
-
if (loading) {
|
|
315
|
-
return (
|
|
316
|
-
<HeroBlockView
|
|
317
|
-
title="Loading Hero..."
|
|
318
|
-
backgroundColor="default"
|
|
319
|
-
blockHeight="medium"
|
|
320
|
-
textAlign="center"
|
|
321
|
-
/>
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (error) {
|
|
326
|
-
console.error('Error loading hero block:', error);
|
|
327
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
328
|
-
return (
|
|
329
|
-
<HeroBlockView
|
|
330
|
-
title="Error Loading Hero"
|
|
331
|
-
subtitle={error.message}
|
|
332
|
-
backgroundColor="default"
|
|
333
|
-
blockHeight="medium"
|
|
334
|
-
textAlign="center"
|
|
335
|
-
/>
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return <HeroBlockView {...heroProps} />;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Mark as QwickApp component
|
|
345
|
-
(HeroBlock as any)[QWICKAPP_COMPONENT] = true;
|
|
242
|
+
/**
|
|
243
|
+
* Create HeroBlock component using the factory pattern
|
|
244
|
+
*/
|
|
245
|
+
export const HeroBlock: SerializableComponent<HeroBlockProps> = createSerializableView<HeroBlockProps>({
|
|
246
|
+
tagName: 'HeroBlock',
|
|
247
|
+
version: '1.0.0',
|
|
248
|
+
role: 'container',
|
|
249
|
+
View: HeroBlockView
|
|
250
|
+
});
|
|
346
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Export the component as default
|
|
254
|
+
*/
|
|
347
255
|
export default HeroBlock;
|