@qwickapps/react-framework 1.4.1 → 1.4.3
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 +8 -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,199 +1,333 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ModelView - Abstract Base Class
|
|
2
|
+
* ModelView - Abstract Base Class implementing ViewSchema
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* This abstract base class processes ViewSchema props and provides them
|
|
5
|
+
* to subclasses through processed props. All concrete components should
|
|
6
|
+
* extend this class to get consistent ViewSchema prop handling.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Processes all ViewSchema properties (grid, spacing, styling, etc.)
|
|
10
|
+
* - Provides processed props to subclasses via getProcessedProps()
|
|
11
|
+
* - Maintains abstract pattern for component-specific rendering
|
|
12
|
+
* - Handles serialization and data binding
|
|
15
13
|
*/
|
|
16
14
|
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
15
|
+
import { Serializable } from "@/schemas";
|
|
16
|
+
import { SchemaProps, WithDataBinding } from "@qwickapps/schema";
|
|
17
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
18
|
+
import { WithBaseProps } from '../../hooks';
|
|
19
|
+
import ViewSchema from '../../schemas/ViewSchema';
|
|
20
20
|
import { extractTextFromReactNode } from '../../utils/reactUtils';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
|
|
23
|
+
* Convert ViewSchema props to BaseComponentProps format
|
|
24
|
+
*/
|
|
25
|
+
function convertSchemaToBaseProps(schema: Partial<ViewSchema>): WithBaseProps {
|
|
26
|
+
const {
|
|
27
|
+
// Grid props - convert strings to proper types
|
|
28
|
+
span,
|
|
29
|
+
xs,
|
|
30
|
+
sm,
|
|
31
|
+
md,
|
|
32
|
+
lg,
|
|
33
|
+
xl,
|
|
34
|
+
|
|
35
|
+
// Style props - convert JSON strings to objects
|
|
36
|
+
sx,
|
|
37
|
+
style,
|
|
38
|
+
|
|
39
|
+
// All other props pass through directly
|
|
40
|
+
...restProps
|
|
41
|
+
} = schema;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
// Convert grid span values
|
|
45
|
+
span: span === 'auto' ? 'auto' : span === 'grow' ? 'grow' : (span && typeof span === 'string') ? parseInt(span, 10) : span,
|
|
46
|
+
xs: xs === 'auto' ? 'auto' : (xs && typeof xs === 'string') ? parseInt(xs, 10) : xs,
|
|
47
|
+
sm: sm === 'auto' ? 'auto' : (sm && typeof sm === 'string') ? parseInt(sm, 10) : sm,
|
|
48
|
+
md: md === 'auto' ? 'auto' : (md && typeof md === 'string') ? parseInt(md, 10) : md,
|
|
49
|
+
lg: lg === 'auto' ? 'auto' : (lg && typeof lg === 'string') ? parseInt(lg, 10) : lg,
|
|
50
|
+
xl: xl === 'auto' ? 'auto' : (xl && typeof xl === 'string') ? parseInt(xl, 10) : xl,
|
|
51
|
+
|
|
52
|
+
// Parse JSON strings for sx and style
|
|
53
|
+
sx: typeof sx === 'string' ? (() => {
|
|
54
|
+
try { return JSON.parse(sx); } catch { return sx; }
|
|
55
|
+
})() : sx,
|
|
56
|
+
|
|
57
|
+
style: typeof style === 'string' ? (() => {
|
|
58
|
+
try { return JSON.parse(style); } catch { return style; }
|
|
59
|
+
})() : style,
|
|
60
|
+
|
|
61
|
+
// Convert event handlers from strings to functions
|
|
62
|
+
onClick: typeof schema.onClick === 'string' ? convertEventHandler(schema.onClick) : schema.onClick,
|
|
63
|
+
onMouseEnter: typeof schema.onMouseEnter === 'string' ? convertEventHandler(schema.onMouseEnter) : schema.onMouseEnter,
|
|
64
|
+
onMouseLeave: typeof schema.onMouseLeave === 'string' ? convertEventHandler(schema.onMouseLeave) : schema.onMouseLeave,
|
|
65
|
+
onFocus: typeof schema.onFocus === 'string' ? convertEventHandler(schema.onFocus) : schema.onFocus,
|
|
66
|
+
onBlur: typeof schema.onBlur === 'string' ? convertEventHandler(schema.onBlur) : schema.onBlur,
|
|
67
|
+
|
|
68
|
+
// Pass through all other props directly
|
|
69
|
+
...restProps
|
|
70
|
+
} as WithBaseProps;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Convert string event handler to function
|
|
75
|
+
*/
|
|
76
|
+
function convertEventHandler(handlerStr?: string): ((event: any) => void) | undefined {
|
|
77
|
+
if (!handlerStr || typeof handlerStr !== 'string') {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
// Create function from string - handle both function declarations and expressions
|
|
83
|
+
let func: Function;
|
|
84
|
+
if (handlerStr.trim().startsWith('function')) {
|
|
85
|
+
func = new Function(`return (${handlerStr})`)();
|
|
86
|
+
} else {
|
|
87
|
+
func = new Function('event', handlerStr);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return (event: any) => func(event);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('Error parsing event handler:', error);
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Processed props that subclasses receive
|
|
25
99
|
*/
|
|
26
|
-
export
|
|
27
|
-
|
|
100
|
+
export interface ProcessedProps {
|
|
101
|
+
gridProps: any;
|
|
102
|
+
styleProps: any;
|
|
103
|
+
htmlProps: any;
|
|
104
|
+
restProps: any;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Abstract base class implementing ViewSchema
|
|
109
|
+
* All concrete components should extend this class
|
|
110
|
+
*/
|
|
111
|
+
export abstract class ModelView<TProps = any, TModel = any>
|
|
112
|
+
extends React.Component<TProps & SchemaProps<ViewSchema> & WithDataBinding>
|
|
28
113
|
implements Serializable {
|
|
29
|
-
|
|
114
|
+
|
|
30
115
|
// Static properties - must be overridden by subclasses
|
|
31
|
-
// Note: TypeScript doesn't support abstract static members, so we provide defaults
|
|
32
116
|
static readonly tagName: string = '';
|
|
33
117
|
static readonly version: string = '';
|
|
34
|
-
|
|
118
|
+
|
|
35
119
|
/**
|
|
36
120
|
* Common fromJson implementation
|
|
37
|
-
* Subclasses can override this if they need custom deserialization logic
|
|
38
121
|
*/
|
|
39
122
|
static fromJson(jsonData: any): ReactElement {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
123
|
+
const { tagName, version, data } = jsonData;
|
|
124
|
+
if (tagName !== this.tagName) {
|
|
125
|
+
throw new Error(`Cannot deserialize: Expected tagName '${this.tagName}' but got '${tagName}'`);
|
|
126
|
+
}
|
|
127
|
+
if (version !== this.version) {
|
|
128
|
+
console.warn(`Version mismatch: Expected ${this.version} but got ${version}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return React.createElement(this as any, data || {});
|
|
43
132
|
}
|
|
44
|
-
|
|
133
|
+
|
|
45
134
|
/**
|
|
46
135
|
* Common toJson implementation with hooks for customization
|
|
47
|
-
* Combines base serializable props with component-specific props
|
|
48
136
|
*/
|
|
49
137
|
toJson(): any {
|
|
50
138
|
const baseProps = this.getBaseSerializableProps();
|
|
51
139
|
const componentProps = this.getComponentSpecificProps();
|
|
52
|
-
|
|
53
140
|
return {
|
|
54
|
-
|
|
55
|
-
|
|
141
|
+
tagName: (this.constructor as typeof ModelView).tagName,
|
|
142
|
+
version: (this.constructor as typeof ModelView).version,
|
|
143
|
+
data: {
|
|
144
|
+
...baseProps,
|
|
145
|
+
...componentProps
|
|
146
|
+
}
|
|
56
147
|
};
|
|
57
148
|
}
|
|
58
|
-
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get processed props for subclasses to use
|
|
152
|
+
* This converts ViewSchema props and processes them through useBaseProps
|
|
153
|
+
*/
|
|
154
|
+
protected getProcessedProps(): ProcessedProps {
|
|
155
|
+
const { dataSource, bindingOptions, ...schemaProps } = this.props;
|
|
156
|
+
|
|
157
|
+
// Convert ViewSchema props to BaseComponentProps format
|
|
158
|
+
const convertedProps = convertSchemaToBaseProps(schemaProps);
|
|
159
|
+
|
|
160
|
+
// Process through useBaseProps utility (this is a bit of a hack since we're in a class component)
|
|
161
|
+
// We'll simulate what useBaseProps does
|
|
162
|
+
const mockProps = {
|
|
163
|
+
gridProps: {
|
|
164
|
+
span: convertedProps.span,
|
|
165
|
+
xs: convertedProps.xs,
|
|
166
|
+
sm: convertedProps.sm,
|
|
167
|
+
md: convertedProps.md,
|
|
168
|
+
lg: convertedProps.lg,
|
|
169
|
+
xl: convertedProps.xl,
|
|
170
|
+
},
|
|
171
|
+
styleProps: {
|
|
172
|
+
className: convertedProps.className,
|
|
173
|
+
sx: convertedProps.sx,
|
|
174
|
+
style: convertedProps.style,
|
|
175
|
+
},
|
|
176
|
+
htmlProps: {
|
|
177
|
+
id: convertedProps.id,
|
|
178
|
+
role: convertedProps.role,
|
|
179
|
+
'aria-label': convertedProps['aria-label'],
|
|
180
|
+
'aria-labelledby': convertedProps['aria-labelledby'],
|
|
181
|
+
'aria-describedby': convertedProps['aria-describedby'],
|
|
182
|
+
'data-testid': convertedProps['data-testid'],
|
|
183
|
+
onClick: convertedProps.onClick,
|
|
184
|
+
onMouseEnter: convertedProps.onMouseEnter,
|
|
185
|
+
onMouseLeave: convertedProps.onMouseLeave,
|
|
186
|
+
onFocus: convertedProps.onFocus,
|
|
187
|
+
onBlur: convertedProps.onBlur,
|
|
188
|
+
},
|
|
189
|
+
restProps: {
|
|
190
|
+
// All the spacing, dimension, and background props
|
|
191
|
+
width: convertedProps.width,
|
|
192
|
+
height: convertedProps.height,
|
|
193
|
+
minWidth: convertedProps.minWidth,
|
|
194
|
+
minHeight: convertedProps.minHeight,
|
|
195
|
+
maxWidth: convertedProps.maxWidth,
|
|
196
|
+
maxHeight: convertedProps.maxHeight,
|
|
197
|
+
padding: convertedProps.padding,
|
|
198
|
+
paddingTop: convertedProps.paddingTop,
|
|
199
|
+
paddingRight: convertedProps.paddingRight,
|
|
200
|
+
paddingBottom: convertedProps.paddingBottom,
|
|
201
|
+
paddingLeft: convertedProps.paddingLeft,
|
|
202
|
+
paddingX: convertedProps.paddingX,
|
|
203
|
+
paddingY: convertedProps.paddingY,
|
|
204
|
+
margin: convertedProps.margin,
|
|
205
|
+
marginTop: convertedProps.marginTop,
|
|
206
|
+
marginRight: convertedProps.marginRight,
|
|
207
|
+
marginBottom: convertedProps.marginBottom,
|
|
208
|
+
marginLeft: convertedProps.marginLeft,
|
|
209
|
+
marginX: convertedProps.marginX,
|
|
210
|
+
marginY: convertedProps.marginY,
|
|
211
|
+
background: convertedProps.background,
|
|
212
|
+
backgroundImage: convertedProps.backgroundImage,
|
|
213
|
+
backgroundGradient: convertedProps.backgroundGradient,
|
|
214
|
+
textAlign: convertedProps.textAlign,
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
return mockProps;
|
|
219
|
+
}
|
|
220
|
+
|
|
59
221
|
/**
|
|
60
222
|
* Common base props that all components serialize
|
|
61
|
-
* Handles ReactNode children, data binding, and common styling props
|
|
62
223
|
*/
|
|
63
224
|
protected getBaseSerializableProps(): any {
|
|
64
225
|
const props = this.props as any;
|
|
65
226
|
return {
|
|
66
|
-
// Handle ReactNode children conversion
|
|
67
227
|
children: props.children ? this.serializeChildren(props.children) : undefined,
|
|
68
|
-
// Preserve data binding
|
|
69
228
|
dataSource: props.dataSource,
|
|
70
229
|
bindingOptions: props.bindingOptions,
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
id: props.id
|
|
230
|
+
// Include all ViewSchema props in serialization
|
|
231
|
+
...props,
|
|
74
232
|
};
|
|
75
233
|
}
|
|
76
|
-
|
|
234
|
+
|
|
77
235
|
/**
|
|
78
236
|
* Hook for subclasses to add component-specific serialization
|
|
79
|
-
* Must be implemented by each component to include its specific props
|
|
80
237
|
*/
|
|
81
238
|
protected abstract getComponentSpecificProps(): any;
|
|
82
|
-
|
|
239
|
+
|
|
83
240
|
/**
|
|
84
241
|
* Common children serialization logic
|
|
85
|
-
* Handles different children types based on component capabilities
|
|
86
242
|
*/
|
|
87
243
|
protected serializeChildren(children: ReactNode): any {
|
|
88
244
|
if (typeof children === 'string') {
|
|
89
245
|
return children;
|
|
90
246
|
}
|
|
91
|
-
|
|
92
|
-
// For complex components (Section), we'll let the specific component handle serialization
|
|
93
|
-
// to avoid circular dependencies. The Section component can override this method.
|
|
247
|
+
|
|
94
248
|
if (this.hasNestedComponents(children)) {
|
|
95
|
-
// This should be overridden by components that support nested components
|
|
96
249
|
throw new Error('Components with nested components must override serializeChildren method');
|
|
97
250
|
}
|
|
98
|
-
|
|
99
|
-
// For simple components (Code, Button), extract text
|
|
251
|
+
|
|
100
252
|
return extractTextFromReactNode(children);
|
|
101
253
|
}
|
|
102
|
-
|
|
254
|
+
|
|
103
255
|
/**
|
|
104
256
|
* Helper to determine if children contain other serializable components
|
|
105
|
-
* Override in subclasses that support nested components (like Section)
|
|
106
257
|
*/
|
|
107
258
|
protected hasNestedComponents(children: ReactNode): boolean {
|
|
108
|
-
// Default: false for simple components
|
|
109
259
|
return false;
|
|
110
260
|
}
|
|
111
|
-
|
|
261
|
+
|
|
112
262
|
/**
|
|
113
263
|
* Common render pattern
|
|
114
|
-
* Determines whether to use data binding or traditional props rendering
|
|
115
264
|
*/
|
|
116
265
|
render() {
|
|
117
266
|
const props = this.props as any;
|
|
118
|
-
|
|
267
|
+
|
|
119
268
|
if (props.dataSource) {
|
|
120
269
|
return this.renderWithDataBinding();
|
|
121
270
|
}
|
|
122
|
-
|
|
271
|
+
|
|
123
272
|
return this.renderView();
|
|
124
273
|
}
|
|
125
|
-
|
|
274
|
+
|
|
126
275
|
/**
|
|
127
276
|
* Hook for subclasses to implement traditional props rendering
|
|
128
|
-
* This is where the component renders using props directly
|
|
129
277
|
*/
|
|
130
278
|
protected abstract renderView(): React.ReactElement;
|
|
131
|
-
|
|
279
|
+
|
|
132
280
|
/**
|
|
133
281
|
* Hook for subclasses to implement data binding rendering
|
|
134
|
-
* This should render the data-bound version of the component
|
|
135
282
|
*/
|
|
136
283
|
protected abstract renderWithDataBinding(): React.ReactElement;
|
|
137
284
|
|
|
138
285
|
/**
|
|
139
286
|
* Register HTML pattern handlers for this component
|
|
140
|
-
* Override this method to register patterns that this component can handle
|
|
141
|
-
* @param registry - ComponentTransformer to register patterns with
|
|
142
287
|
*/
|
|
143
|
-
static registerPatternHandlers(
|
|
288
|
+
static registerPatternHandlers(_registry: any): void {
|
|
144
289
|
// Default: no patterns to register
|
|
145
|
-
// Subclasses should override this to register their HTML patterns
|
|
146
290
|
}
|
|
147
291
|
}
|
|
148
292
|
|
|
149
293
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*/
|
|
153
|
-
export interface ModelViewConstructor<TProps = any, TModel = any> {
|
|
154
|
-
new (props: TProps & WithDataBinding): ModelView<TProps, TModel>;
|
|
155
|
-
readonly tagName: string;
|
|
156
|
-
readonly version: string;
|
|
157
|
-
fromJson(jsonData: any): ReactElement;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Helper function to create a ModelView component class
|
|
162
|
-
* Provides better TypeScript inference for component registration
|
|
294
|
+
* Helper function for creating ModelView component classes with ViewSchema support
|
|
295
|
+
* Updated to work with the new ViewSchema processing system
|
|
163
296
|
*/
|
|
164
297
|
export function createModelViewClass<TProps, TModel>(
|
|
165
298
|
config: {
|
|
166
299
|
tagName: string;
|
|
167
300
|
version: string;
|
|
168
|
-
getComponentSpecificProps: (props: TProps) => any;
|
|
301
|
+
getComponentSpecificProps: (props: TProps, processedProps: ProcessedProps) => any;
|
|
169
302
|
hasNestedComponents?: (children: ReactNode) => boolean;
|
|
170
|
-
renderView: (props: TProps) => React.ReactElement;
|
|
171
|
-
renderWithDataBinding: (props: TProps & WithDataBinding) => React.ReactElement;
|
|
303
|
+
renderView: (props: TProps, processedProps: ProcessedProps) => React.ReactElement;
|
|
304
|
+
renderWithDataBinding: (props: TProps & WithDataBinding, processedProps: ProcessedProps) => React.ReactElement;
|
|
172
305
|
}
|
|
173
|
-
):
|
|
174
|
-
|
|
306
|
+
): any {
|
|
307
|
+
|
|
175
308
|
class DynamicModelView extends ModelView<TProps, TModel> {
|
|
176
309
|
static readonly tagName = config.tagName;
|
|
177
310
|
static readonly version = config.version;
|
|
178
|
-
|
|
311
|
+
|
|
179
312
|
protected getComponentSpecificProps(): any {
|
|
180
|
-
|
|
313
|
+
const processedProps = this.getProcessedProps();
|
|
314
|
+
return config.getComponentSpecificProps(this.props as TProps, processedProps);
|
|
181
315
|
}
|
|
182
|
-
|
|
316
|
+
|
|
183
317
|
protected hasNestedComponents(children: ReactNode): boolean {
|
|
184
318
|
return config.hasNestedComponents ? config.hasNestedComponents(children) : false;
|
|
185
319
|
}
|
|
186
|
-
|
|
320
|
+
|
|
187
321
|
protected renderView(): React.ReactElement {
|
|
188
|
-
|
|
322
|
+
const processedProps = this.getProcessedProps();
|
|
323
|
+
return config.renderView(this.props as TProps, processedProps);
|
|
189
324
|
}
|
|
190
|
-
|
|
325
|
+
|
|
191
326
|
protected renderWithDataBinding(): React.ReactElement {
|
|
192
|
-
|
|
327
|
+
const processedProps = this.getProcessedProps();
|
|
328
|
+
return config.renderWithDataBinding(this.props as TProps & WithDataBinding, processedProps);
|
|
193
329
|
}
|
|
194
330
|
}
|
|
195
|
-
|
|
196
|
-
return DynamicModelView as ModelViewConstructor<TProps, TModel>;
|
|
197
|
-
}
|
|
198
331
|
|
|
199
|
-
|
|
332
|
+
return DynamicModelView;
|
|
333
|
+
}
|
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
10
|
+
export { ModelView, createModelViewClass } from './ModelView';
|
|
11
|
+
export { default as Container, } from './Container';
|
|
12
|
+
export type { ContainerProps } from './Container';
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { Box, Typography } from '@mui/material';
|
|
17
|
-
import { WithDataBinding,
|
|
17
|
+
import { WithDataBinding, SchemaProps } from '@qwickapps/schema';
|
|
18
18
|
import React, { ReactElement } from 'react';
|
|
19
19
|
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding } from '../../hooks';
|
|
20
20
|
import ArticleModel from '../../schemas/ArticleSchema';
|
|
21
21
|
import { ModelView } from '../base/ModelView';
|
|
22
22
|
import Html from '../Html';
|
|
23
23
|
|
|
24
|
-
type ArticleViewProps =
|
|
24
|
+
type ArticleViewProps = SchemaProps<ArticleModel>;
|
|
25
25
|
|
|
26
26
|
export interface ArticleProps extends ArticleViewProps, WithDataBinding {
|
|
27
27
|
}
|
|
@@ -125,11 +125,6 @@ export class Article extends ModelView<ArticleProps, ArticleModel> {
|
|
|
125
125
|
static readonly tagName = 'Article';
|
|
126
126
|
static readonly version = '1.0.0';
|
|
127
127
|
|
|
128
|
-
// Deserialization: JSON data → React element
|
|
129
|
-
static fromJson(jsonData: any): ReactElement {
|
|
130
|
-
return <Article {...jsonData} />;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
128
|
// Component-specific serialization properties
|
|
134
129
|
protected getComponentSpecificProps(): any {
|
|
135
130
|
return {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { WithDataBinding,
|
|
12
|
+
import { WithDataBinding, SchemaProps } from '@qwickapps/schema';
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { useBaseProps, useDataBinding } from '../../hooks';
|
|
15
15
|
import CardListGridModel from '../../schemas/CardListGridSchema';
|
|
@@ -17,7 +17,7 @@ import { GridLayout } from '../layout';
|
|
|
17
17
|
import { FeatureCard } from './FeatureCard';
|
|
18
18
|
import { ProductCard } from './ProductCard';
|
|
19
19
|
|
|
20
|
-
type CardListGridViewProps =
|
|
20
|
+
type CardListGridViewProps = SchemaProps<CardListGridModel> & {
|
|
21
21
|
/** Render function for each item (traditional usage) */
|
|
22
22
|
renderItem?: (item: any, index: number) => React.ReactNode;
|
|
23
23
|
};
|