@qwickapps/react-framework 1.4.0 → 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 +231 -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
package/src/schemas/README.md
DELETED
|
@@ -1,661 +0,0 @@
|
|
|
1
|
-
# QwickApps React Framework - Schema System
|
|
2
|
-
|
|
3
|
-
**Component Serialization & Data Binding Architecture**
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The QwickApps Schema System provides comprehensive component serialization and data binding capabilities, enabling "WebView for React" functionality. This system allows React components to be serialized to JSON, transmitted across boundaries, and reconstructed while preserving full functionality and data binding.
|
|
8
|
-
|
|
9
|
-
## Table of Contents
|
|
10
|
-
|
|
11
|
-
1. [Architecture Overview](#architecture-overview)
|
|
12
|
-
2. [Serialization System](#serialization-system)
|
|
13
|
-
3. [Data Binding Integration](#data-binding-integration)
|
|
14
|
-
4. [Component Schemas](#component-schemas)
|
|
15
|
-
5. [Transformers](#transformers)
|
|
16
|
-
6. [Usage Examples](#usage-examples)
|
|
17
|
-
7. [Performance Characteristics](#performance-characteristics)
|
|
18
|
-
8. [Testing](#testing)
|
|
19
|
-
|
|
20
|
-
## Architecture Overview
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
Schema System Architecture
|
|
24
|
-
├── Serialization Layer
|
|
25
|
-
│ ├── Serializable Interface (types/Serializable.ts)
|
|
26
|
-
│ ├── ComponentTransformer (transformers/ComponentTransformer.ts)
|
|
27
|
-
│ ├── ReactNodeTransformer (transformers/ReactNodeTransformer.ts)
|
|
28
|
-
│ └── Registry System
|
|
29
|
-
├── Data Binding Layer
|
|
30
|
-
│ ├── Schema Models (CodeSchema.ts, etc.)
|
|
31
|
-
│ ├── Model Base Classes
|
|
32
|
-
│ └── Binding Integration
|
|
33
|
-
└── Component Integration
|
|
34
|
-
├── Class-Based Components
|
|
35
|
-
├── View Delegation Pattern
|
|
36
|
-
└── Automatic Registration
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Serialization System
|
|
40
|
-
|
|
41
|
-
### Core Interfaces
|
|
42
|
-
|
|
43
|
-
#### Serializable Interface
|
|
44
|
-
```typescript
|
|
45
|
-
// types/Serializable.ts
|
|
46
|
-
interface Serializable {
|
|
47
|
-
toJson(): any; // Component instance → JSON data
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface SerializableConstructor {
|
|
51
|
-
readonly tagName: string; // Unique component identifier
|
|
52
|
-
readonly version: string; // Semantic version
|
|
53
|
-
fromJson(jsonData: any): ReactElement; // JSON data → React element
|
|
54
|
-
new (...args: any[]): Serializable;
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#### Data Format
|
|
59
|
-
Serialized components use a standardized structure:
|
|
60
|
-
```json
|
|
61
|
-
{
|
|
62
|
-
"tag": "ComponentName",
|
|
63
|
-
"version": "1.0.0",
|
|
64
|
-
"data": {
|
|
65
|
-
"prop1": "value1",
|
|
66
|
-
"prop2": "value2",
|
|
67
|
-
"dataSource": "api/data/source",
|
|
68
|
-
"bindingOptions": { "cache": true }
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Component Self-Declaration Pattern
|
|
74
|
-
|
|
75
|
-
Components declare their own serialization identity:
|
|
76
|
-
```typescript
|
|
77
|
-
export class MyComponent extends React.Component<MyComponentProps> implements Serializable {
|
|
78
|
-
// Self-declaration
|
|
79
|
-
static readonly tagName = 'MyComponent';
|
|
80
|
-
static readonly version = '1.0.0';
|
|
81
|
-
|
|
82
|
-
// Deserialization
|
|
83
|
-
static fromJson(jsonData: any): ReactElement {
|
|
84
|
-
return <MyComponent {...jsonData} />;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Serialization
|
|
88
|
-
toJson(): any {
|
|
89
|
-
return {
|
|
90
|
-
title: this.props.title,
|
|
91
|
-
dataSource: this.props.dataSource,
|
|
92
|
-
bindingOptions: this.props.bindingOptions
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Transformers
|
|
99
|
-
|
|
100
|
-
### ComponentTransformer - Primary Serialization Engine
|
|
101
|
-
|
|
102
|
-
Located: `transformers/ComponentTransformer.ts`
|
|
103
|
-
|
|
104
|
-
**Key Features:**
|
|
105
|
-
- Component registration and discovery
|
|
106
|
-
- Bidirectional transformation (serialize/deserialize)
|
|
107
|
-
- Fallback handling for unregistered components
|
|
108
|
-
- Performance optimization with caching
|
|
109
|
-
|
|
110
|
-
**Primary Methods:**
|
|
111
|
-
```typescript
|
|
112
|
-
class ComponentTransformer {
|
|
113
|
-
// Register component for serialization
|
|
114
|
-
static registerComponent(componentClass: SerializableConstructor): void
|
|
115
|
-
|
|
116
|
-
// Serialize React nodes to JSON string
|
|
117
|
-
static serialize(node: ReactNode | ReactNode[]): string
|
|
118
|
-
|
|
119
|
-
// Deserialize JSON to React nodes
|
|
120
|
-
static deserialize(input: string | object | object[]): ReactNode | ReactNode[]
|
|
121
|
-
|
|
122
|
-
// Registry management
|
|
123
|
-
static getRegisteredComponents(): string[]
|
|
124
|
-
static clearRegistry(): void
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Usage Example:**
|
|
129
|
-
```typescript
|
|
130
|
-
import { ComponentTransformer } from './transformers/ComponentTransformer';
|
|
131
|
-
|
|
132
|
-
// Serialize component
|
|
133
|
-
const component = <Code language="javascript">console.log('Hello');</Code>;
|
|
134
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
135
|
-
|
|
136
|
-
// Deserialize back to component
|
|
137
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### ReactNodeTransformer - Fallback System
|
|
141
|
-
|
|
142
|
-
Located: `transformers/ReactNodeTransformer.ts`
|
|
143
|
-
|
|
144
|
-
**Purpose:**
|
|
145
|
-
Handles serialization of unregistered components, HTML elements, and standard React content.
|
|
146
|
-
|
|
147
|
-
**Capabilities:**
|
|
148
|
-
- Primitive value serialization (strings, numbers, booleans)
|
|
149
|
-
- Array and object handling
|
|
150
|
-
- React element metadata preservation
|
|
151
|
-
- HTML element reconstruction
|
|
152
|
-
- Graceful fallback rendering
|
|
153
|
-
|
|
154
|
-
**Data Structures:**
|
|
155
|
-
```typescript
|
|
156
|
-
// Primitive values
|
|
157
|
-
{ type: 'primitive', value: 'Hello World' }
|
|
158
|
-
|
|
159
|
-
// React elements
|
|
160
|
-
{
|
|
161
|
-
type: 'react-element',
|
|
162
|
-
elementType: 'div',
|
|
163
|
-
props: { className: 'example', children: 'Content' },
|
|
164
|
-
key: 'unique-key'
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Arrays
|
|
168
|
-
{ type: 'array', children: [/* serialized items */] }
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Data Binding Integration
|
|
172
|
-
|
|
173
|
-
### Schema Models
|
|
174
|
-
|
|
175
|
-
Component schemas define data structures for binding:
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
// Example: CodeSchema.ts
|
|
179
|
-
@Schema('Code', '1.0.0')
|
|
180
|
-
export class CodeModel extends Model {
|
|
181
|
-
children?: string;
|
|
182
|
-
language?: string;
|
|
183
|
-
showCopy?: boolean;
|
|
184
|
-
showLineNumbers?: boolean;
|
|
185
|
-
title?: string;
|
|
186
|
-
wrapLines?: boolean;
|
|
187
|
-
codeBackground?: string;
|
|
188
|
-
|
|
189
|
-
static getSchema() {
|
|
190
|
-
return {
|
|
191
|
-
type: 'object',
|
|
192
|
-
properties: {
|
|
193
|
-
children: { type: 'string' },
|
|
194
|
-
language: { type: 'string', default: 'text' },
|
|
195
|
-
showCopy: { type: 'boolean', default: true },
|
|
196
|
-
// ... other properties
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Data Binding Preservation
|
|
204
|
-
|
|
205
|
-
Serializable components must preserve data binding configuration:
|
|
206
|
-
```typescript
|
|
207
|
-
toJson(): any {
|
|
208
|
-
return {
|
|
209
|
-
// Component-specific props
|
|
210
|
-
title: this.props.title,
|
|
211
|
-
language: this.props.language,
|
|
212
|
-
|
|
213
|
-
// CRITICAL: Always preserve data binding
|
|
214
|
-
dataSource: this.props.dataSource,
|
|
215
|
-
bindingOptions: this.props.bindingOptions
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Binding Integration Pattern
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
// Component with data binding support
|
|
224
|
-
export interface ComponentProps extends WithDataBinding {
|
|
225
|
-
title: string;
|
|
226
|
-
// ... other props
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export class Component extends React.Component<ComponentProps> implements Serializable {
|
|
230
|
-
render() {
|
|
231
|
-
// Route based on data binding presence
|
|
232
|
-
return this.props.dataSource ?
|
|
233
|
-
<ComponentWithDataBinding {...this.props} /> :
|
|
234
|
-
<ComponentView {...this.props} />;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Data binding wrapper
|
|
239
|
-
function ComponentWithDataBinding(props: ComponentProps) {
|
|
240
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
241
|
-
|
|
242
|
-
const { loading, error, ...boundProps } = useDataBinding(
|
|
243
|
-
dataSource!,
|
|
244
|
-
restProps,
|
|
245
|
-
ComponentModel.getSchema(),
|
|
246
|
-
{ cache: true, ...bindingOptions }
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
if (loading) return <LoadingState />;
|
|
250
|
-
if (error) return <ErrorState error={error} />;
|
|
251
|
-
|
|
252
|
-
return <ComponentView {...boundProps} />;
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Component Schemas
|
|
257
|
-
|
|
258
|
-
### Schema Definition Pattern
|
|
259
|
-
|
|
260
|
-
```typescript
|
|
261
|
-
// Base schema structure for all components
|
|
262
|
-
@Schema('ComponentName', '1.0.0')
|
|
263
|
-
export class ComponentModel extends Model {
|
|
264
|
-
// Core component properties
|
|
265
|
-
title?: string;
|
|
266
|
-
visible?: boolean;
|
|
267
|
-
|
|
268
|
-
// Data binding properties (inherited from WithDataBinding)
|
|
269
|
-
dataSource?: string;
|
|
270
|
-
bindingOptions?: BindingOptions;
|
|
271
|
-
|
|
272
|
-
// Component-specific properties
|
|
273
|
-
customProp?: string;
|
|
274
|
-
|
|
275
|
-
static getSchema() {
|
|
276
|
-
return {
|
|
277
|
-
type: 'object',
|
|
278
|
-
properties: {
|
|
279
|
-
title: { type: 'string' },
|
|
280
|
-
visible: { type: 'boolean', default: true },
|
|
281
|
-
customProp: { type: 'string' },
|
|
282
|
-
// Data binding schema included automatically
|
|
283
|
-
},
|
|
284
|
-
required: ['title']
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Schema Versioning
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
// Handle schema evolution with version migrations
|
|
294
|
-
@Schema('Component', '2.0.0')
|
|
295
|
-
export class ComponentModelV2 extends Model {
|
|
296
|
-
// New property structure
|
|
297
|
-
config?: ComponentConfig;
|
|
298
|
-
|
|
299
|
-
static migrateFromV1(v1Data: any): ComponentModelV2 {
|
|
300
|
-
return new ComponentModelV2({
|
|
301
|
-
title: v1Data.title,
|
|
302
|
-
config: {
|
|
303
|
-
theme: v1Data.oldThemeProp || 'default',
|
|
304
|
-
layout: v1Data.oldLayoutProp || 'standard'
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
## Usage Examples
|
|
312
|
-
|
|
313
|
-
### Basic Serialization
|
|
314
|
-
|
|
315
|
-
```typescript
|
|
316
|
-
import { Code } from '../components/blocks/Code';
|
|
317
|
-
import { ComponentTransformer } from './transformers/ComponentTransformer';
|
|
318
|
-
|
|
319
|
-
// Create component
|
|
320
|
-
const codeBlock = (
|
|
321
|
-
<Code language="typescript" showCopy={true}>
|
|
322
|
-
const example: string = 'Hello World';
|
|
323
|
-
console.log(example);
|
|
324
|
-
</Code>
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
// Serialize
|
|
328
|
-
const serializedJson = ComponentTransformer.serialize(codeBlock);
|
|
329
|
-
console.log('Serialized:', serializedJson);
|
|
330
|
-
|
|
331
|
-
// Deserialize
|
|
332
|
-
const reconstructed = ComponentTransformer.deserialize(serializedJson);
|
|
333
|
-
// reconstructed is a fully functional React component
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### CMS Integration
|
|
337
|
-
|
|
338
|
-
```typescript
|
|
339
|
-
// CMS provides serialized component data
|
|
340
|
-
const cmsResponse = {
|
|
341
|
-
components: [
|
|
342
|
-
{
|
|
343
|
-
tag: "Code",
|
|
344
|
-
version: "1.0.0",
|
|
345
|
-
data: {
|
|
346
|
-
children: "// CMS-provided code\nconst cms = 'integration';",
|
|
347
|
-
language: "javascript",
|
|
348
|
-
title: "CMS Example"
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
]
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
// Render CMS components
|
|
355
|
-
const cmsComponents = cmsResponse.components.map((componentData, index) => (
|
|
356
|
-
<div key={index}>
|
|
357
|
-
{ComponentTransformer.deserialize(componentData)}
|
|
358
|
-
</div>
|
|
359
|
-
));
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
### Data Binding with Serialization
|
|
363
|
-
|
|
364
|
-
```typescript
|
|
365
|
-
// Component with data binding
|
|
366
|
-
const dataBoundCode = (
|
|
367
|
-
<Code
|
|
368
|
-
dataSource="api/code-examples/fibonacci"
|
|
369
|
-
bindingOptions={{ cache: true, cacheTTL: 300000 }}
|
|
370
|
-
language="javascript"
|
|
371
|
-
showCopy={true}
|
|
372
|
-
/>
|
|
373
|
-
);
|
|
374
|
-
|
|
375
|
-
// Serialization preserves data binding
|
|
376
|
-
const serialized = ComponentTransformer.serialize(dataBoundCode);
|
|
377
|
-
|
|
378
|
-
// After deserialization, data binding continues to work
|
|
379
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
380
|
-
// Component will still load data from "api/code-examples/fibonacci"
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### Component Collections
|
|
384
|
-
|
|
385
|
-
```typescript
|
|
386
|
-
// Serialize multiple components
|
|
387
|
-
const componentArray = [
|
|
388
|
-
<Code language="js">const a = 1;</Code>,
|
|
389
|
-
<Code language="py">print("hello")</Code>,
|
|
390
|
-
<Code language="html"><div>Hello</div></Code>
|
|
391
|
-
];
|
|
392
|
-
|
|
393
|
-
const serializedArray = ComponentTransformer.serialize(componentArray);
|
|
394
|
-
const deserializedArray = ComponentTransformer.deserialize(serializedArray);
|
|
395
|
-
// Returns array of functional components
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
## Performance Characteristics
|
|
399
|
-
|
|
400
|
-
### Benchmarks (QA Validated)
|
|
401
|
-
|
|
402
|
-
| Operation | Typical Performance | Large Data (1000+ components) | Memory Usage |
|
|
403
|
-
|-----------|-------------------|--------------------------------|--------------|
|
|
404
|
-
| **Serialization** | <1ms | <50ms | <10MB |
|
|
405
|
-
| **Deserialization** | <1ms | <50ms | <10MB |
|
|
406
|
-
| **Round-trip** | <3ms | <100ms | <20MB |
|
|
407
|
-
| **Registry Lookup** | <0.1ms | <0.1ms | Minimal |
|
|
408
|
-
| **Deep Nesting (30 levels)** | <5ms | N/A | <5MB |
|
|
409
|
-
|
|
410
|
-
### Performance Optimizations
|
|
411
|
-
|
|
412
|
-
```typescript
|
|
413
|
-
// Registry caching
|
|
414
|
-
const componentRegistry = new Map<string, SerializableConstructor>();
|
|
415
|
-
|
|
416
|
-
// Lazy processing
|
|
417
|
-
const serializeNode = memoize((node: ReactNode) => {
|
|
418
|
-
// Expensive serialization operations are cached
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
// Memory management
|
|
422
|
-
componentWillUnmount() {
|
|
423
|
-
// Automatic cleanup of cached references
|
|
424
|
-
}
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Performance Testing
|
|
428
|
-
|
|
429
|
-
```typescript
|
|
430
|
-
// Performance validation test
|
|
431
|
-
test('serialization performance benchmark', () => {
|
|
432
|
-
const largeComponent = createLargeComponent(1000); // 1000 child components
|
|
433
|
-
|
|
434
|
-
const startTime = performance.now();
|
|
435
|
-
const serialized = ComponentTransformer.serialize(largeComponent);
|
|
436
|
-
const serializeTime = performance.now() - startTime;
|
|
437
|
-
|
|
438
|
-
const deserializeStart = performance.now();
|
|
439
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
440
|
-
const deserializeTime = performance.now() - deserializeStart;
|
|
441
|
-
|
|
442
|
-
expect(serializeTime).toBeLessThan(50); // <50ms for 1000 components
|
|
443
|
-
expect(deserializeTime).toBeLessThan(50); // <50ms for 1000 components
|
|
444
|
-
});
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
## Error Handling
|
|
448
|
-
|
|
449
|
-
### Graceful Degradation
|
|
450
|
-
|
|
451
|
-
```typescript
|
|
452
|
-
// Unknown component handling
|
|
453
|
-
{
|
|
454
|
-
tag: "__react_node__", // Fallback tag
|
|
455
|
-
version: "1.0.0",
|
|
456
|
-
data: {
|
|
457
|
-
type: "react-element",
|
|
458
|
-
elementType: "div",
|
|
459
|
-
props: { children: "Fallback content" }
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// Error recovery in deserialization
|
|
464
|
-
static fromJson(jsonData: any): ReactElement {
|
|
465
|
-
try {
|
|
466
|
-
return <Component {...jsonData} />;
|
|
467
|
-
} catch (error) {
|
|
468
|
-
console.warn('Component deserialization error:', error);
|
|
469
|
-
return <ErrorFallbackComponent error={error} />;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### Development vs Production
|
|
475
|
-
|
|
476
|
-
```typescript
|
|
477
|
-
// Development: Detailed error information
|
|
478
|
-
if (process.env.NODE_ENV === 'development') {
|
|
479
|
-
console.error('Detailed serialization error:', error, stackTrace);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// Production: Silent fallback
|
|
483
|
-
return <SafeFallbackComponent />;
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
## Testing
|
|
487
|
-
|
|
488
|
-
### Test Structure
|
|
489
|
-
|
|
490
|
-
```
|
|
491
|
-
src/schemas/transformers/__tests__/
|
|
492
|
-
├── ComponentTransformer.test.ts # Core transformer tests
|
|
493
|
-
├── SerializationIntegration.test.tsx # Multi-component scenarios
|
|
494
|
-
├── SerializationPerformance.test.ts # Performance benchmarks
|
|
495
|
-
├── SerializationErrorHandling.test.ts # Error scenarios
|
|
496
|
-
├── ComponentSerializationPatterns.test.tsx # Standardized patterns
|
|
497
|
-
├── RealWorldScenarios.test.tsx # Production use cases
|
|
498
|
-
└── CrossBrowserCompatibility.test.ts # Browser compatibility
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
### Test Categories
|
|
502
|
-
|
|
503
|
-
#### 1. Unit Tests
|
|
504
|
-
```typescript
|
|
505
|
-
describe('ComponentTransformer', () => {
|
|
506
|
-
test('should serialize component correctly', () => {
|
|
507
|
-
const component = <Code>test</Code>;
|
|
508
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
509
|
-
expect(serialized).toBeTruthy();
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
test('should deserialize component correctly', () => {
|
|
513
|
-
const data = { tag: 'Code', version: '1.0.0', data: { children: 'test' } };
|
|
514
|
-
const component = ComponentTransformer.deserialize(data);
|
|
515
|
-
expect(component).toBeTruthy();
|
|
516
|
-
});
|
|
517
|
-
});
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
#### 2. Integration Tests
|
|
521
|
-
```typescript
|
|
522
|
-
test('should handle nested component serialization', () => {
|
|
523
|
-
const nested = (
|
|
524
|
-
<Code title="Parent">
|
|
525
|
-
<Code language="js">const nested = true;</Code>
|
|
526
|
-
</Code>
|
|
527
|
-
);
|
|
528
|
-
|
|
529
|
-
const serialized = ComponentTransformer.serialize(nested);
|
|
530
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
531
|
-
expect(deserialized).toBeTruthy();
|
|
532
|
-
});
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
#### 3. Performance Tests
|
|
536
|
-
```typescript
|
|
537
|
-
test('should handle large component trees efficiently', () => {
|
|
538
|
-
const largeTree = createDeepComponentTree(1000);
|
|
539
|
-
|
|
540
|
-
const { duration } = measurePerformance(() => {
|
|
541
|
-
ComponentTransformer.serialize(largeTree);
|
|
542
|
-
});
|
|
543
|
-
|
|
544
|
-
expect(duration).toBeLessThan(50); // <50ms for 1000 components
|
|
545
|
-
});
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
### Generic Test Utilities
|
|
549
|
-
|
|
550
|
-
```typescript
|
|
551
|
-
// Reusable test helper for component serialization
|
|
552
|
-
export function testComponentSerialization<T>(
|
|
553
|
-
componentName: string,
|
|
554
|
-
ComponentClass: any,
|
|
555
|
-
testCases: Array<{ name: string; props: T }>
|
|
556
|
-
) {
|
|
557
|
-
describe(`${componentName} Serialization`, () => {
|
|
558
|
-
testCases.forEach(({ name, props }) => {
|
|
559
|
-
test(name, () => {
|
|
560
|
-
const component = React.createElement(ComponentClass, props);
|
|
561
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
562
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
563
|
-
|
|
564
|
-
expect(deserialized).toBeTruthy();
|
|
565
|
-
expect(JSON.parse(serialized).tag).toBe(ComponentClass.tagName);
|
|
566
|
-
});
|
|
567
|
-
});
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
## File Structure
|
|
573
|
-
|
|
574
|
-
```
|
|
575
|
-
src/schemas/
|
|
576
|
-
├── README.md # This file
|
|
577
|
-
├── index.ts # Main exports
|
|
578
|
-
├── types/
|
|
579
|
-
│ └── Serializable.ts # Core serialization interfaces
|
|
580
|
-
├── transformers/
|
|
581
|
-
│ ├── ComponentTransformer.ts # Primary serialization engine
|
|
582
|
-
│ ├── ReactNodeTransformer.ts # Fallback transformer
|
|
583
|
-
│ ├── registry.ts # Component registration utilities
|
|
584
|
-
│ └── __tests__/ # Comprehensive test suites
|
|
585
|
-
├── models/ # Schema model definitions
|
|
586
|
-
│ ├── CodeSchema.ts # Code component schema
|
|
587
|
-
│ └── [Other component schemas]
|
|
588
|
-
└── utils/
|
|
589
|
-
└── serializationUtils.ts # Utility functions
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
## Migration Guide
|
|
593
|
-
|
|
594
|
-
### From Non-Serializable Components
|
|
595
|
-
|
|
596
|
-
1. **Convert to Class Component** (if functional)
|
|
597
|
-
2. **Implement Serializable Interface**
|
|
598
|
-
3. **Add Static Properties** (tagName, version, fromJson)
|
|
599
|
-
4. **Implement toJson Method**
|
|
600
|
-
5. **Preserve Data Binding** (if applicable)
|
|
601
|
-
6. **Add Comprehensive Tests**
|
|
602
|
-
|
|
603
|
-
See: [Component Serialization Migration Guide](/docs/SERIALIZATION_MIGRATION.md)
|
|
604
|
-
|
|
605
|
-
## Best Practices
|
|
606
|
-
|
|
607
|
-
### Implementation Guidelines
|
|
608
|
-
- Use semantic versioning for component evolution
|
|
609
|
-
- Always preserve `dataSource` and `bindingOptions` in serialization
|
|
610
|
-
- Exclude function props from serialization
|
|
611
|
-
- Handle edge cases with proper validation
|
|
612
|
-
- Implement comprehensive error handling
|
|
613
|
-
- Test with realistic data sizes and structures
|
|
614
|
-
|
|
615
|
-
### Performance Guidelines
|
|
616
|
-
- Cache expensive serialization operations
|
|
617
|
-
- Use memoization for repeated transformations
|
|
618
|
-
- Implement lazy evaluation where possible
|
|
619
|
-
- Monitor memory usage in production
|
|
620
|
-
- Provide fallbacks for performance degradation
|
|
621
|
-
|
|
622
|
-
### Security Guidelines
|
|
623
|
-
- Validate all deserialized data
|
|
624
|
-
- Sanitize user-generated content
|
|
625
|
-
- Use safe fallback components for unknown data
|
|
626
|
-
- Implement Content Security Policy compatibility
|
|
627
|
-
- Avoid eval() or similar unsafe operations
|
|
628
|
-
|
|
629
|
-
## Contributing
|
|
630
|
-
|
|
631
|
-
### Component Registration
|
|
632
|
-
New serializable components are automatically registered when imported. Follow the established patterns:
|
|
633
|
-
|
|
634
|
-
1. **Implement Serializable interface**
|
|
635
|
-
2. **Follow naming conventions** (PascalCase tagName)
|
|
636
|
-
3. **Use semantic versioning**
|
|
637
|
-
4. **Include comprehensive tests**
|
|
638
|
-
5. **Document serialization behavior**
|
|
639
|
-
|
|
640
|
-
### Testing Requirements
|
|
641
|
-
All serializable components must include:
|
|
642
|
-
- Basic serialization/deserialization tests
|
|
643
|
-
- Edge case handling tests
|
|
644
|
-
- Performance benchmark tests
|
|
645
|
-
- Data binding preservation tests (if applicable)
|
|
646
|
-
- Cross-browser compatibility validation
|
|
647
|
-
|
|
648
|
-
## References
|
|
649
|
-
|
|
650
|
-
- [Component Serialization Guide](/docs/COMPONENT_SERIALIZATION_GUIDE.md) - Complete implementation guide
|
|
651
|
-
- [Serializable Component Templates](/docs/SERIALIZABLE_COMPONENT_TEMPLATE.md) - Copy-paste boilerplate
|
|
652
|
-
- [Architecture Documentation](/ARCHITECTURE.md#component-serialization-system-architecture) - System architecture
|
|
653
|
-
- [Code Component README](/src/components/blocks/Code.md) - Reference implementation
|
|
654
|
-
|
|
655
|
-
---
|
|
656
|
-
|
|
657
|
-
## License
|
|
658
|
-
|
|
659
|
-
Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
660
|
-
|
|
661
|
-
The QwickApps Schema System enables powerful "WebView for React" functionality while maintaining component integrity, performance, and developer experience across the entire framework ecosystem.
|