@qwickapps/react-framework 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QUICK_START_GUIDE.md +82 -0
- package/README.md +221 -21
- package/dist/components/Html.d.ts.map +1 -1
- package/dist/components/Markdown.d.ts +1 -2
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/SafeSpan.d.ts +1 -2
- package/dist/components/SafeSpan.d.ts.map +1 -1
- package/dist/components/base/Container.d.ts +32 -0
- package/dist/components/base/Container.d.ts.map +1 -0
- package/dist/components/base/ContainerView.d.ts +65 -0
- package/dist/components/base/ContainerView.d.ts.map +1 -0
- package/dist/components/base/ModelView.d.ts +37 -46
- package/dist/components/base/ModelView.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +3 -2
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/blocks/Article.d.ts +1 -2
- package/dist/components/blocks/Article.d.ts.map +1 -1
- package/dist/components/blocks/Code-factory.d.ts +22 -0
- package/dist/components/blocks/Code-factory.d.ts.map +1 -0
- package/dist/components/blocks/Code-old.d.ts +31 -0
- package/dist/components/blocks/Code-old.d.ts.map +1 -0
- package/dist/components/blocks/Code.d.ts +30 -18
- package/dist/components/blocks/Code.d.ts.map +1 -1
- package/dist/components/blocks/HeroBlock.d.ts +1 -2
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
- package/dist/components/blocks/Image.d.ts +1 -2
- package/dist/components/blocks/Image.d.ts.map +1 -1
- package/dist/components/blocks/Section.d.ts +1 -2
- package/dist/components/blocks/Section.d.ts.map +1 -1
- package/dist/components/blocks/Text.d.ts +35 -27
- package/dist/components/blocks/Text.d.ts.map +1 -1
- package/dist/components/buttons/Button.d.ts +1 -2
- package/dist/components/buttons/Button.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/ChoiceInputField.d.ts +1 -2
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
- package/dist/components/input/HtmlInputField.d.ts +1 -2
- package/dist/components/input/HtmlInputField.d.ts.map +1 -1
- package/dist/components/input/SelectInputField.d.ts +1 -2
- package/dist/components/input/SelectInputField.d.ts.map +1 -1
- package/dist/components/pages/Page.d.ts +29 -47
- package/dist/components/pages/Page.d.ts.map +1 -1
- package/dist/components/pages/index.d.ts +2 -3
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/components/shared/createSerializableView.d.ts +68 -0
- package/dist/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/components/shared/viewProps.d.ts +37 -0
- package/dist/components/shared/viewProps.d.ts.map +1 -0
- package/dist/index.esm.js +21782 -22580
- package/dist/index.js +21782 -22579
- package/dist/qa/ConsoleWarningTest.d.ts +5 -0
- package/dist/qa/ConsoleWarningTest.d.ts.map +1 -0
- package/dist/qa/StorageKeyTest.d.ts +6 -0
- package/dist/qa/StorageKeyTest.d.ts.map +1 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts +6 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts.map +1 -0
- package/dist/schemas/CodeSchema.d.ts +2 -2
- package/dist/schemas/CodeSchema.d.ts.map +1 -1
- package/dist/schemas/ContainerSchema.d.ts +12 -0
- package/dist/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/schemas/PageTemplateSchema.d.ts +3 -3
- package/dist/schemas/PageTemplateSchema.d.ts.map +1 -1
- package/dist/schemas/ViewModelSchema.d.ts +46 -6
- package/dist/schemas/ViewModelSchema.d.ts.map +1 -1
- package/dist/schemas/ViewSchema.d.ts +65 -0
- package/dist/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/transformers/ComponentTransformer.d.ts +27 -15
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/registry.d.ts +3 -0
- package/dist/schemas/transformers/registry.d.ts.map +1 -1
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
- package/dist/src/components/AccessibilityChecker.d.ts +12 -0
- package/dist/src/components/AccessibilityChecker.d.ts.map +1 -0
- package/dist/src/components/AccessibilityProvider.d.ts +64 -0
- package/dist/src/components/AccessibilityProvider.d.ts.map +1 -0
- package/dist/src/components/Breadcrumbs.d.ts +39 -0
- package/dist/src/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/src/components/ErrorBoundary.d.ts +46 -0
- package/dist/src/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/components/Html.d.ts +58 -0
- package/dist/src/components/Html.d.ts.map +1 -0
- package/dist/src/components/Logo.d.ts +56 -0
- package/dist/src/components/Logo.d.ts.map +1 -0
- package/dist/src/components/Markdown.d.ts +51 -0
- package/dist/src/components/Markdown.d.ts.map +1 -0
- package/dist/src/components/QwickApp.d.ts +69 -0
- package/dist/src/components/QwickApp.d.ts.map +1 -0
- package/dist/src/components/QwickAppsLogo.d.ts +25 -0
- package/dist/src/components/QwickAppsLogo.d.ts.map +1 -0
- package/dist/src/components/QwickIcon.d.ts +23 -0
- package/dist/src/components/QwickIcon.d.ts.map +1 -0
- package/dist/src/components/ResponsiveMenu.d.ts +38 -0
- package/dist/src/components/ResponsiveMenu.d.ts.map +1 -0
- package/dist/src/components/SafeSpan.d.ts +29 -0
- package/dist/src/components/SafeSpan.d.ts.map +1 -0
- package/dist/src/components/Scaffold.d.ts +57 -0
- package/dist/src/components/Scaffold.d.ts.map +1 -0
- package/dist/src/components/base/Container.d.ts +33 -0
- package/dist/src/components/base/Container.d.ts.map +1 -0
- package/dist/src/components/base/ModelView.d.ts +92 -0
- package/dist/src/components/base/ModelView.d.ts.map +1 -0
- package/dist/src/components/base/index.d.ts +12 -0
- package/dist/src/components/base/index.d.ts.map +1 -0
- package/dist/src/components/blocks/Article.d.ts +32 -0
- package/dist/src/components/blocks/Article.d.ts.map +1 -0
- package/dist/src/components/blocks/CardListGrid.d.ts +23 -0
- package/dist/src/components/blocks/CardListGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Code.d.ts +37 -0
- package/dist/src/components/blocks/Code.d.ts.map +1 -0
- package/dist/src/components/blocks/Content.d.ts +24 -0
- package/dist/src/components/blocks/Content.d.ts.map +1 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts +44 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureCard.d.ts +66 -0
- package/dist/src/components/blocks/FeatureCard.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts +48 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Footer.d.ts +56 -0
- package/dist/src/components/blocks/Footer.d.ts.map +1 -0
- package/dist/src/components/blocks/HeroBlock.d.ts +55 -0
- package/dist/src/components/blocks/HeroBlock.d.ts.map +1 -0
- package/dist/src/components/blocks/Image.d.ts +40 -0
- package/dist/src/components/blocks/Image.d.ts.map +1 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts +30 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/ProductCard.d.ts +57 -0
- package/dist/src/components/blocks/ProductCard.d.ts.map +1 -0
- package/dist/src/components/blocks/Section.d.ts +45 -0
- package/dist/src/components/blocks/Section.d.ts.map +1 -0
- package/dist/src/components/blocks/Text.d.ts +34 -0
- package/dist/src/components/blocks/Text.d.ts.map +1 -0
- package/dist/src/components/blocks/index.d.ts +41 -0
- package/dist/src/components/blocks/index.d.ts.map +1 -0
- package/dist/src/components/buttons/Button.d.ts +41 -0
- package/dist/src/components/buttons/Button.d.ts.map +1 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/index.d.ts +11 -0
- package/dist/src/components/buttons/index.d.ts.map +1 -0
- package/dist/src/components/forms/FormBlock.d.ts +51 -0
- package/dist/src/components/forms/FormBlock.d.ts.map +1 -0
- package/dist/src/components/forms/index.d.ts +8 -0
- package/dist/src/components/forms/index.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +41 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/input/ChoiceInputField.d.ts +29 -0
- package/dist/src/components/input/ChoiceInputField.d.ts.map +1 -0
- package/dist/src/components/input/HtmlInputField.d.ts +33 -0
- package/dist/src/components/input/HtmlInputField.d.ts.map +1 -0
- package/dist/src/components/input/SelectInputField.d.ts +31 -0
- package/dist/src/components/input/SelectInputField.d.ts.map +1 -0
- package/dist/src/components/input/SwitchInputField.d.ts +27 -0
- package/dist/src/components/input/SwitchInputField.d.ts.map +1 -0
- package/dist/src/components/input/TextField.d.ts +18 -0
- package/dist/src/components/input/TextField.d.ts.map +1 -0
- package/dist/src/components/input/TextInputField.d.ts +34 -0
- package/dist/src/components/input/TextInputField.d.ts.map +1 -0
- package/dist/src/components/input/index.d.ts +19 -0
- package/dist/src/components/input/index.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts +34 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts +9 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts.map +1 -0
- package/dist/src/components/layout/GridCell.d.ts +32 -0
- package/dist/src/components/layout/GridCell.d.ts.map +1 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts +46 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts.map +1 -0
- package/dist/src/components/layout/GridLayout.d.ts +50 -0
- package/dist/src/components/layout/GridLayout.d.ts.map +1 -0
- package/dist/src/components/layout/index.d.ts +14 -0
- package/dist/src/components/layout/index.d.ts.map +1 -0
- package/dist/src/components/menu/Menu.d.ts +1 -0
- package/dist/src/components/menu/Menu.d.ts.map +1 -0
- package/dist/src/components/menu/MenuItem.d.ts +31 -0
- package/dist/src/components/menu/MenuItem.d.ts.map +1 -0
- package/dist/src/components/menu/index.d.ts +7 -0
- package/dist/src/components/menu/index.d.ts.map +1 -0
- package/dist/src/components/pages/FormPage.d.ts +66 -0
- package/dist/src/components/pages/FormPage.d.ts.map +1 -0
- package/dist/src/components/pages/Page.d.ts +68 -0
- package/dist/src/components/pages/Page.d.ts.map +1 -0
- package/dist/src/components/pages/index.d.ts +10 -0
- package/dist/src/components/pages/index.d.ts.map +1 -0
- package/dist/src/components/shared/createSerializableView.d.ts +81 -0
- package/dist/src/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/src/components/shared/viewProps.d.ts +37 -0
- package/dist/src/components/shared/viewProps.d.ts.map +1 -0
- package/dist/src/config/AppConfig.d.ts +49 -0
- package/dist/src/config/AppConfig.d.ts.map +1 -0
- package/dist/src/config/AppConfigBuilder.d.ts +75 -0
- package/dist/src/config/AppConfigBuilder.d.ts.map +1 -0
- package/dist/src/config/index.d.ts +13 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/types.d.ts +130 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config.d.ts +15 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/contexts/DataContext.d.ts +139 -0
- package/dist/src/contexts/DataContext.d.ts.map +1 -0
- package/dist/src/contexts/DimensionsContext.d.ts +42 -0
- package/dist/src/contexts/DimensionsContext.d.ts.map +1 -0
- package/dist/src/contexts/PaletteContext.d.ts +53 -0
- package/dist/src/contexts/PaletteContext.d.ts.map +1 -0
- package/dist/src/contexts/PrintModeContext.d.ts +27 -0
- package/dist/src/contexts/PrintModeContext.d.ts.map +1 -0
- package/dist/src/contexts/QwickAppContext.d.ts +71 -0
- package/dist/src/contexts/QwickAppContext.d.ts.map +1 -0
- package/dist/src/contexts/ThemeContext.d.ts +65 -0
- package/dist/src/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/src/contexts/index.d.ts +11 -0
- package/dist/src/contexts/index.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +12 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useBaseProps.d.ts +101 -0
- package/dist/src/hooks/useBaseProps.d.ts.map +1 -0
- package/dist/src/hooks/useDataBinding.d.ts +22 -0
- package/dist/src/hooks/useDataBinding.d.ts.map +1 -0
- package/dist/src/hooks/usePrintMode.d.ts +39 -0
- package/dist/src/hooks/usePrintMode.d.ts.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/palettes/PaletteAutumn.d.ts +10 -0
- package/dist/src/palettes/PaletteAutumn.d.ts.map +1 -0
- package/dist/src/palettes/PaletteCosmic.d.ts +10 -0
- package/dist/src/palettes/PaletteCosmic.d.ts.map +1 -0
- package/dist/src/palettes/PaletteDefault.d.ts +10 -0
- package/dist/src/palettes/PaletteDefault.d.ts.map +1 -0
- package/dist/src/palettes/PaletteOcean.d.ts +10 -0
- package/dist/src/palettes/PaletteOcean.d.ts.map +1 -0
- package/dist/src/palettes/PaletteSpring.d.ts +10 -0
- package/dist/src/palettes/PaletteSpring.d.ts.map +1 -0
- package/dist/src/palettes/PaletteWinter.d.ts +10 -0
- package/dist/src/palettes/PaletteWinter.d.ts.map +1 -0
- package/dist/src/palettes/index.d.ts +13 -0
- package/dist/src/palettes/index.d.ts.map +1 -0
- package/dist/src/schemas/ActionSchema.d.ts +21 -0
- package/dist/src/schemas/ActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/ArticleSchema.d.ts +13 -0
- package/dist/src/schemas/ArticleSchema.d.ts.map +1 -0
- package/dist/src/schemas/ButtonSchema.d.ts +19 -0
- package/dist/src/schemas/ButtonSchema.d.ts.map +1 -0
- package/dist/src/schemas/CardListGridSchema.d.ts +17 -0
- package/dist/src/schemas/CardListGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/CodeSchema.d.ts +18 -0
- package/dist/src/schemas/CodeSchema.d.ts.map +1 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts +32 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContainerSchema.d.ts +12 -0
- package/dist/src/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContentSchema.d.ts +21 -0
- package/dist/src/schemas/ContentSchema.d.ts.map +1 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts +28 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts +17 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts +16 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterItemSchema.d.ts +15 -0
- package/dist/src/schemas/FooterItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSchema.d.ts +20 -0
- package/dist/src/schemas/FooterSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts +15 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/FormBlockSchema.d.ts +19 -0
- package/dist/src/schemas/FormBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridCellSchema.d.ts +23 -0
- package/dist/src/schemas/GridCellSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts +21 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts +17 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts +22 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlSchema.d.ts +14 -0
- package/dist/src/schemas/HtmlSchema.d.ts.map +1 -0
- package/dist/src/schemas/ImageSchema.d.ts +32 -0
- package/dist/src/schemas/ImageSchema.d.ts.map +1 -0
- package/dist/src/schemas/LogoSchema.d.ts +35 -0
- package/dist/src/schemas/LogoSchema.d.ts.map +1 -0
- package/dist/src/schemas/MarkdownSchema.d.ts +14 -0
- package/dist/src/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts +13 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts +31 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts.map +1 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts +16 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts +31 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts.map +1 -0
- package/dist/src/schemas/ProductCardSchema.d.ts +39 -0
- package/dist/src/schemas/ProductCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts +13 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts.map +1 -0
- package/dist/src/schemas/SectionSchema.d.ts +16 -0
- package/dist/src/schemas/SectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts +27 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts +22 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextSchema.d.ts +37 -0
- package/dist/src/schemas/TextSchema.d.ts.map +1 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts +19 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/ViewSchema.d.ts +66 -0
- package/dist/src/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/src/schemas/index.d.ts +47 -0
- package/dist/src/schemas/index.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts +128 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/registry.d.ts +18 -0
- package/dist/src/schemas/transformers/registry.d.ts.map +1 -0
- package/dist/src/schemas/types/Serializable.d.ts +46 -0
- package/dist/src/schemas/types/Serializable.d.ts.map +1 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts +44 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts.map +1 -0
- package/dist/src/templates/TemplateResolver.d.ts +52 -0
- package/dist/src/templates/TemplateResolver.d.ts.map +1 -0
- package/dist/src/templates/index.d.ts +7 -0
- package/dist/src/templates/index.d.ts.map +1 -0
- package/dist/src/types/CacheProvider.d.ts +18 -0
- package/dist/src/types/CacheProvider.d.ts.map +1 -0
- package/dist/src/types/CollapsibleLayout.d.ts +142 -0
- package/dist/src/types/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/types/ContentProxy.d.ts +47 -0
- package/dist/src/types/ContentProxy.d.ts.map +1 -0
- package/dist/src/types/DataTypes.d.ts +185 -0
- package/dist/src/types/DataTypes.d.ts.map +1 -0
- package/dist/src/types/TemplateProvider.d.ts +10 -0
- package/dist/src/types/TemplateProvider.d.ts.map +1 -0
- package/dist/src/types/TemplateResolver.d.ts +23 -0
- package/dist/src/types/TemplateResolver.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +82 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/breakpoints.d.ts +35 -0
- package/dist/src/utils/breakpoints.d.ts.map +1 -0
- package/dist/src/utils/cssUtils.d.ts +17 -0
- package/dist/src/utils/cssUtils.d.ts.map +1 -0
- package/dist/src/utils/customPaletteManager.d.ts +8 -0
- package/dist/src/utils/customPaletteManager.d.ts.map +1 -0
- package/dist/src/utils/dimensions.d.ts +34 -0
- package/dist/src/utils/dimensions.d.ts.map +1 -0
- package/dist/src/utils/htmlTransform.d.ts +44 -0
- package/dist/src/utils/htmlTransform.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +16 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/logger.d.ts +26 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/paletteUtils.d.ts +38 -0
- package/dist/src/utils/paletteUtils.d.ts.map +1 -0
- package/dist/src/utils/persistenceUtils.d.ts +31 -0
- package/dist/src/utils/persistenceUtils.d.ts.map +1 -0
- package/dist/src/utils/reactUtils.d.ts +33 -0
- package/dist/src/utils/reactUtils.d.ts.map +1 -0
- package/dist/src/utils/spacing.d.ts +34 -0
- package/dist/src/utils/spacing.d.ts.map +1 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts +32 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts.map +1 -0
- package/dist/src/utils/themeUtils.d.ts +27 -0
- package/dist/src/utils/themeUtils.d.ts.map +1 -0
- package/dist/utils/cssUtils.d.ts +17 -0
- package/dist/utils/cssUtils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/scripts/bundle-css.cjs +27 -0
- package/scripts/create-project.sh +28 -0
- package/scripts/create-qwickapps-project.js +284 -0
- package/src/__tests__/components/base/Container.test.tsx +966 -0
- package/src/__tests__/schemas/PageTemplateSchema.test.ts +1 -1
- package/src/__tests__/schemas/ViewSchema.test.ts +805 -0
- package/src/__tests__/schemas/builders.test.ts +2 -2
- package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +19 -19
- package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +13 -13
- package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +39 -39
- package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +14 -14
- package/src/__tests__/schemas/transformers/TestAutomation.test.ts +8 -8
- package/src/__tests__/schemas/transformers/nested-serialization.test.tsx +181 -0
- package/src/__tests__/schemas/transformers/round-trip-component-serialization.test.tsx +458 -0
- package/src/__tests__/test_image_accessibility.test.tsx +226 -0
- package/src/__tests__/utils/optional-logging.test.ts +3 -3
- package/src/components/Html.tsx +24 -15
- package/src/components/Logo.tsx +2 -2
- package/src/components/Markdown.tsx +2 -7
- package/src/components/SafeSpan.tsx +2 -7
- package/src/components/base/Container.tsx +61 -0
- package/src/components/base/ModelView.tsx +225 -91
- package/src/components/base/index.ts +3 -2
- package/src/components/blocks/Article.tsx +2 -7
- package/src/components/blocks/CardListGrid.tsx +2 -2
- package/src/components/blocks/Code.tsx +91 -179
- package/src/components/blocks/Content.tsx +2 -2
- package/src/components/blocks/CoverImageHeader.tsx +2 -2
- package/src/components/blocks/HeroBlock.tsx +54 -146
- package/src/components/blocks/Image.tsx +82 -196
- package/src/components/blocks/PageBannerHeader.tsx +2 -2
- package/src/components/blocks/Section.tsx +79 -181
- package/src/components/blocks/Text.tsx +100 -198
- package/src/components/buttons/Button.tsx +85 -183
- package/src/components/buttons/PaletteSwitcher.tsx +2 -2
- package/src/components/buttons/ThemeSwitcher.tsx +2 -2
- package/src/components/forms/FormBlock.tsx +2 -2
- package/src/components/index.ts +5 -0
- package/src/components/input/ChoiceInputField.tsx +76 -160
- package/src/components/input/HtmlInputField.tsx +141 -264
- package/src/components/input/SelectInputField.tsx +48 -153
- package/src/components/input/SwitchInputField.tsx +41 -139
- package/src/components/input/TextInputField.tsx +39 -116
- package/src/components/layout/GridCell.tsx +36 -122
- package/src/components/layout/GridLayout.tsx +55 -127
- package/src/components/pages/Page.tsx +268 -276
- package/src/components/pages/index.ts +2 -3
- package/src/components/shared/createSerializableView.tsx +280 -0
- package/src/components/shared/viewProps.ts +207 -0
- package/src/config/__tests__/AppConfigBuilder.test.ts +2 -2
- package/src/contexts/DataContext.tsx +1 -1
- package/src/schemas/ButtonSchema.ts +3 -2
- package/src/schemas/CardListGridSchema.ts +3 -2
- package/src/schemas/ChoiceInputFieldSchema.ts +3 -2
- package/src/schemas/CodeSchema.ts +8 -6
- package/src/schemas/ContainerSchema.ts +25 -0
- package/src/schemas/FeatureCardSchema.ts +1 -1
- package/src/schemas/FormBlockSchema.ts +3 -2
- package/src/schemas/GridCellSchema.ts +4 -10
- package/src/schemas/GridLayoutSchema.ts +8 -14
- package/src/schemas/HeroBlockSchema.ts +3 -2
- package/src/schemas/HtmlInputFieldSchema.ts +3 -2
- package/src/schemas/ImageSchema.ts +3 -2
- package/src/schemas/PageTemplateSchema.ts +5 -5
- package/src/schemas/SectionSchema.ts +4 -12
- package/src/schemas/SelectInputFieldSchema.ts +3 -2
- package/src/schemas/SwitchInputFieldSchema.ts +2 -2
- package/src/schemas/TextInputFieldSchema.ts +3 -2
- package/src/schemas/ViewSchema.ts +570 -0
- package/src/schemas/index.ts +1 -1
- package/src/schemas/transformers/ComponentTransformer.ts +185 -163
- package/src/schemas/transformers/ReactNodeTransformer.ts +31 -28
- package/src/schemas/transformers/registry.ts +17 -10
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ChoiceInputField.stories.tsx +28 -1
- package/src/stories/Code.stories.tsx +61 -1
- package/src/stories/Container.stories.tsx +954 -0
- package/src/stories/FormBlock.stories.tsx +54 -0
- package/src/stories/FormComponents.stories.tsx +8 -13
- package/src/stories/GridCell.stories.tsx +23 -64
- package/src/stories/GridLayout.stories.tsx +22 -47
- package/src/stories/HeroBlock.stories.tsx +28 -0
- package/src/stories/HtmlInputField.stories.tsx +23 -1
- package/src/stories/Image.stories.tsx +45 -233
- package/src/stories/Markdown.stories.tsx +1 -1
- package/src/stories/Section.stories.tsx +38 -4
- package/src/stories/SelectInputField.stories.tsx +26 -1
- package/src/stories/Text.stories.tsx +22 -54
- package/src/stories/TextInputField.stories.tsx +24 -1
- package/src/stories/_templates/SerializationTemplate.tsx +165 -0
- package/src/templates/TemplateResolver.ts +2 -2
- package/src/types/CollapsibleLayout.ts +2 -2
- package/src/utils/cssUtils.ts +49 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +13 -13
- package/src/__tests__/components/base/ModelView.test.tsx +0 -220
- package/src/__tests__/schemas/ViewModelSchema.test.ts +0 -80
- package/src/components/blocks/Code.md +0 -529
- package/src/schemas/README.md +0 -661
- package/src/schemas/ViewModelSchema.ts +0 -115
- package/src/tests/ConsoleWarningTest.tsx +0 -30
- package/src/tests/StorageKeyTest.tsx +0 -110
- package/src/tests/ThemeStorageKeyTest.tsx +0 -114
|
@@ -1,529 +0,0 @@
|
|
|
1
|
-
# Code Component
|
|
2
|
-
|
|
3
|
-
**QwickApps React Framework - Syntax-Highlighted Code Display with Serialization**
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The Code component provides consistent code block rendering with syntax highlighting, copy functionality, and full serialization support for "WebView for React" functionality. It serves as the canonical reference implementation for serializable components in the QwickApps React Framework.
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
### Display Features
|
|
12
|
-
- **Syntax Highlighting**: Support for multiple programming languages
|
|
13
|
-
- **Copy to Clipboard**: One-click copy functionality with user feedback
|
|
14
|
-
- **Light/Dark Theme**: Automatic theme integration
|
|
15
|
-
- **Line Numbers**: Optional line number display
|
|
16
|
-
- **Responsive Design**: Adapts to container size and device
|
|
17
|
-
- **Customizable Styling**: Theme-aware colors and spacing
|
|
18
|
-
|
|
19
|
-
### Serialization Features ⭐
|
|
20
|
-
- **Full Serialization Support**: Complete "WebView for React" functionality
|
|
21
|
-
- **Data Binding Integration**: Preserves data source configuration
|
|
22
|
-
- **ReactNode Children**: Seamless handling of React and string children
|
|
23
|
-
- **Performance Optimized**: <1ms serialization/deserialization
|
|
24
|
-
- **Version Compatible**: Semantic versioning with migration support
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
The Code component is included in the QwickApps React Framework:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install @qwickapps/react-framework
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Basic Usage
|
|
35
|
-
|
|
36
|
-
### Traditional Props Usage
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
import { Code } from '@qwickapps/react-framework';
|
|
40
|
-
|
|
41
|
-
// String children (recommended)
|
|
42
|
-
<Code language="javascript" showCopy={true}>
|
|
43
|
-
const greeting = 'Hello, World!';
|
|
44
|
-
console.log(greeting);
|
|
45
|
-
</Code>
|
|
46
|
-
|
|
47
|
-
// With title and line numbers
|
|
48
|
-
<Code
|
|
49
|
-
title="example.js"
|
|
50
|
-
language="javascript"
|
|
51
|
-
showLineNumbers={true}
|
|
52
|
-
showCopy={true}
|
|
53
|
-
>
|
|
54
|
-
function fibonacci(n) {
|
|
55
|
-
if (n <= 1) return n;
|
|
56
|
-
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
57
|
-
}
|
|
58
|
-
</Code>
|
|
59
|
-
|
|
60
|
-
// Custom styling
|
|
61
|
-
<Code
|
|
62
|
-
language="python"
|
|
63
|
-
codeBackground="#1e1e1e"
|
|
64
|
-
wrapLines={true}
|
|
65
|
-
>
|
|
66
|
-
def hello_world():
|
|
67
|
-
print("Hello, World!")
|
|
68
|
-
|
|
69
|
-
if __name__ == "__main__":
|
|
70
|
-
hello_world()
|
|
71
|
-
</Code>
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### React Children Support
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
// The Code component automatically handles React children
|
|
78
|
-
<Code language="jsx">
|
|
79
|
-
<span>const App = () => {`{`}</span>
|
|
80
|
-
<br />
|
|
81
|
-
<span> return <div>Hello React!</div>;</span>
|
|
82
|
-
<br />
|
|
83
|
-
<span>{`}`};</span>
|
|
84
|
-
</Code>
|
|
85
|
-
|
|
86
|
-
// Mixed content (automatically converted to text)
|
|
87
|
-
<Code language="html">
|
|
88
|
-
{htmlContent}
|
|
89
|
-
<span className="highlight">// This gets converted to text</span>
|
|
90
|
-
</Code>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Serialization Usage
|
|
94
|
-
|
|
95
|
-
### Basic Serialization
|
|
96
|
-
|
|
97
|
-
```tsx
|
|
98
|
-
import { ComponentTransformer } from '@qwickapps/react-framework';
|
|
99
|
-
|
|
100
|
-
// Create a Code component
|
|
101
|
-
const codeComponent = (
|
|
102
|
-
<Code language="javascript" showCopy={true} title="example.js">
|
|
103
|
-
const message = 'Hello, Serialization!';
|
|
104
|
-
console.log(message);
|
|
105
|
-
</Code>
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
// Serialize to JSON
|
|
109
|
-
const serialized = ComponentTransformer.serialize(codeComponent);
|
|
110
|
-
console.log(serialized);
|
|
111
|
-
// Output: JSON string with component data
|
|
112
|
-
|
|
113
|
-
// Deserialize back to React component
|
|
114
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
115
|
-
// deserialized is fully functional Code component
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Serialized Data Structure
|
|
119
|
-
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"tag": "Code",
|
|
123
|
-
"version": "1.0.0",
|
|
124
|
-
"data": {
|
|
125
|
-
"children": "const message = 'Hello, Serialization!';\nconsole.log(message);",
|
|
126
|
-
"language": "javascript",
|
|
127
|
-
"showCopy": true,
|
|
128
|
-
"showLineNumbers": false,
|
|
129
|
-
"title": "example.js",
|
|
130
|
-
"wrapLines": false,
|
|
131
|
-
"codeBackground": null
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### With Data Binding
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
// Code component with data binding
|
|
140
|
-
<Code
|
|
141
|
-
dataSource="api/code-samples/fibonacci"
|
|
142
|
-
bindingOptions={{ cache: true, cacheTTL: 300000 }}
|
|
143
|
-
language="javascript"
|
|
144
|
-
showCopy={true}
|
|
145
|
-
/>
|
|
146
|
-
|
|
147
|
-
// Serialization preserves data binding configuration
|
|
148
|
-
const serializedWithBinding = ComponentTransformer.serialize(codeBoundComponent);
|
|
149
|
-
|
|
150
|
-
// Deserialized component retains data binding functionality
|
|
151
|
-
const deserializedWithBinding = ComponentTransformer.deserialize(serializedWithBinding);
|
|
152
|
-
// Data binding continues to work after deserialization
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Component Props
|
|
156
|
-
|
|
157
|
-
### Primary Props
|
|
158
|
-
|
|
159
|
-
| Prop | Type | Default | Description |
|
|
160
|
-
|------|------|---------|-------------|
|
|
161
|
-
| `children` | `ReactNode` | `''` | Code content to display (string or React nodes) |
|
|
162
|
-
| `language` | `string` | `'text'` | Programming language for syntax highlighting |
|
|
163
|
-
| `showCopy` | `boolean` | `true` | Show copy to clipboard button |
|
|
164
|
-
| `showLineNumbers` | `boolean` | `false` | Display line numbers |
|
|
165
|
-
| `title` | `string` | `undefined` | Optional title for the code block |
|
|
166
|
-
| `wrapLines` | `boolean` | `false` | Enable line wrapping |
|
|
167
|
-
| `codeBackground` | `string` | `undefined` | Custom background color |
|
|
168
|
-
|
|
169
|
-
### Data Binding Props (Optional)
|
|
170
|
-
|
|
171
|
-
| Prop | Type | Default | Description |
|
|
172
|
-
|------|------|---------|-------------|
|
|
173
|
-
| `dataSource` | `string` | `undefined` | Data source URL for dynamic content |
|
|
174
|
-
| `bindingOptions` | `object` | `undefined` | Configuration for data binding behavior |
|
|
175
|
-
|
|
176
|
-
### Inherited Props
|
|
177
|
-
|
|
178
|
-
The Code component also accepts all standard QwickApps base props:
|
|
179
|
-
- `margin`, `padding` - Spacing configuration
|
|
180
|
-
- `backgroundColor`, `color` - Color overrides
|
|
181
|
-
- `width`, `height` - Size configuration
|
|
182
|
-
- `breakpoints` - Responsive behavior
|
|
183
|
-
- Accessibility props (`aria-label`, `role`, etc.)
|
|
184
|
-
|
|
185
|
-
## Serialization Implementation Details
|
|
186
|
-
|
|
187
|
-
### Component Architecture
|
|
188
|
-
|
|
189
|
-
The Code component uses the recommended architecture for serializable components:
|
|
190
|
-
|
|
191
|
-
```tsx
|
|
192
|
-
// Class component implementing Serializable interface
|
|
193
|
-
export class Code extends React.Component<CodeProps> implements Serializable {
|
|
194
|
-
// Component self-declaration
|
|
195
|
-
static readonly tagName = 'Code';
|
|
196
|
-
static readonly version = '1.0.0';
|
|
197
|
-
|
|
198
|
-
// Deserialization method
|
|
199
|
-
static fromJson(jsonData: any): ReactElement {
|
|
200
|
-
return <Code {...jsonData} />;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Serialization method
|
|
204
|
-
toJson(): any {
|
|
205
|
-
return {
|
|
206
|
-
children: typeof this.props.children === 'string'
|
|
207
|
-
? this.props.children
|
|
208
|
-
: extractTextFromReactNode(this.props.children),
|
|
209
|
-
language: this.props.language,
|
|
210
|
-
showCopy: this.props.showCopy,
|
|
211
|
-
showLineNumbers: this.props.showLineNumbers,
|
|
212
|
-
title: this.props.title,
|
|
213
|
-
wrapLines: this.props.wrapLines,
|
|
214
|
-
codeBackground: this.props.codeBackground,
|
|
215
|
-
// Data binding preservation
|
|
216
|
-
dataSource: this.props.dataSource,
|
|
217
|
-
bindingOptions: this.props.bindingOptions
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// View delegation pattern
|
|
222
|
-
render() {
|
|
223
|
-
return this.props.dataSource ?
|
|
224
|
-
<CodeWithDataBinding {...this.props} /> :
|
|
225
|
-
<CodeView {...this.props} />;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### ReactNode Processing
|
|
231
|
-
|
|
232
|
-
The Code component uses a sophisticated ReactNode processing system:
|
|
233
|
-
|
|
234
|
-
```tsx
|
|
235
|
-
function extractTextFromReactNode(node: ReactNode): string {
|
|
236
|
-
// Handles strings, numbers, booleans
|
|
237
|
-
// Processes arrays recursively
|
|
238
|
-
// Extracts text from React elements
|
|
239
|
-
// Provides fallback string conversion
|
|
240
|
-
}
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
This allows natural usage patterns:
|
|
244
|
-
|
|
245
|
-
```tsx
|
|
246
|
-
// All of these work seamlessly
|
|
247
|
-
<Code>Simple string content</Code>
|
|
248
|
-
<Code>{variableContent}</Code>
|
|
249
|
-
<Code>
|
|
250
|
-
<span>Line 1</span>
|
|
251
|
-
<br />
|
|
252
|
-
<span>Line 2</span>
|
|
253
|
-
</Code>
|
|
254
|
-
<Code>{[line1, '\n', line2]}</Code>
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Data Binding Integration
|
|
258
|
-
|
|
259
|
-
```tsx
|
|
260
|
-
// Data binding wrapper component
|
|
261
|
-
function CodeWithDataBinding(props: CodeProps) {
|
|
262
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
263
|
-
|
|
264
|
-
const { loading, error, ...codeProps } = useDataBinding<CodeModel>(
|
|
265
|
-
dataSource!,
|
|
266
|
-
restProps as Partial<CodeModel>,
|
|
267
|
-
CodeModel.getSchema(),
|
|
268
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
if (loading) return <LoadingState />;
|
|
272
|
-
if (error) return <ErrorState error={error} />;
|
|
273
|
-
|
|
274
|
-
return <CodeView {...codeProps} />;
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
## Performance Characteristics
|
|
279
|
-
|
|
280
|
-
### Serialization Benchmarks (QA Validated)
|
|
281
|
-
|
|
282
|
-
- **Serialization Speed**: <1ms for typical code blocks
|
|
283
|
-
- **Deserialization Speed**: <1ms for component reconstruction
|
|
284
|
-
- **Round-trip Performance**: <3ms for complete serialize/deserialize cycle
|
|
285
|
-
- **Memory Usage**: Minimal overhead, garbage collection friendly
|
|
286
|
-
- **Large Code Blocks**: Efficiently handles 1000+ lines of code
|
|
287
|
-
|
|
288
|
-
### Performance Testing
|
|
289
|
-
|
|
290
|
-
```tsx
|
|
291
|
-
// Performance test example
|
|
292
|
-
test('Code component serialization performance', async () => {
|
|
293
|
-
const largeCodeContent = 'const x = 1;\n'.repeat(1000); // 1000 lines
|
|
294
|
-
const component = <Code language="javascript">{largeCodeContent}</Code>;
|
|
295
|
-
|
|
296
|
-
const startTime = performance.now();
|
|
297
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
298
|
-
const serializeTime = performance.now() - startTime;
|
|
299
|
-
|
|
300
|
-
const deserializeStart = performance.now();
|
|
301
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
302
|
-
const deserializeTime = performance.now() - deserializeStart;
|
|
303
|
-
|
|
304
|
-
expect(serializeTime).toBeLessThan(5); // <5ms serialization
|
|
305
|
-
expect(deserializeTime).toBeLessThan(5); // <5ms deserialization
|
|
306
|
-
});
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
## Integration Examples
|
|
310
|
-
|
|
311
|
-
### CMS Integration
|
|
312
|
-
|
|
313
|
-
```tsx
|
|
314
|
-
// Code component data from CMS
|
|
315
|
-
const cmsCodeData = {
|
|
316
|
-
tag: "Code",
|
|
317
|
-
version: "1.0.0",
|
|
318
|
-
data: {
|
|
319
|
-
children: "// Code from CMS\nconst example = 'Hello CMS';",
|
|
320
|
-
language: "javascript",
|
|
321
|
-
showCopy: true,
|
|
322
|
-
title: "CMS Example"
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// Automatic reconstruction from CMS data
|
|
327
|
-
const codeComponent = ComponentTransformer.deserialize(cmsCodeData);
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
### Storybook Integration
|
|
331
|
-
|
|
332
|
-
```tsx
|
|
333
|
-
// Code.stories.tsx
|
|
334
|
-
export const SerializationDemo: Story = {
|
|
335
|
-
name: 'Serialization Demo',
|
|
336
|
-
render: (args) => {
|
|
337
|
-
const original = <Code {...args} />;
|
|
338
|
-
const serialized = ComponentTransformer.serialize(original);
|
|
339
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
340
|
-
|
|
341
|
-
return (
|
|
342
|
-
<div>
|
|
343
|
-
<h3>Original Component</h3>
|
|
344
|
-
{original}
|
|
345
|
-
|
|
346
|
-
<h3>Serialized Data</h3>
|
|
347
|
-
<pre>{JSON.stringify(JSON.parse(serialized), null, 2)}</pre>
|
|
348
|
-
|
|
349
|
-
<h3>Deserialized Component</h3>
|
|
350
|
-
{deserialized}
|
|
351
|
-
</div>
|
|
352
|
-
);
|
|
353
|
-
},
|
|
354
|
-
args: {
|
|
355
|
-
children: 'const example = "Hello Serialization!";',
|
|
356
|
-
language: 'javascript',
|
|
357
|
-
showCopy: true,
|
|
358
|
-
title: 'Serialization Example'
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
### API Response Integration
|
|
364
|
-
|
|
365
|
-
```tsx
|
|
366
|
-
// API returns serialized components
|
|
367
|
-
const apiResponse = await fetch('/api/content/code-examples');
|
|
368
|
-
const { components } = await apiResponse.json();
|
|
369
|
-
|
|
370
|
-
// Render components from API
|
|
371
|
-
{components.map((componentData, index) => (
|
|
372
|
-
<div key={index}>
|
|
373
|
-
{ComponentTransformer.deserialize(componentData)}
|
|
374
|
-
</div>
|
|
375
|
-
))}
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
## Testing
|
|
379
|
-
|
|
380
|
-
### Basic Serialization Tests
|
|
381
|
-
|
|
382
|
-
```tsx
|
|
383
|
-
import { ComponentTransformer } from '../../schemas/transformers/ComponentTransformer';
|
|
384
|
-
import { Code } from '../Code';
|
|
385
|
-
|
|
386
|
-
describe('Code Component Serialization', () => {
|
|
387
|
-
beforeEach(() => {
|
|
388
|
-
ComponentTransformer.registerComponent(Code);
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
test('should serialize and deserialize correctly', () => {
|
|
392
|
-
const props = {
|
|
393
|
-
children: 'const test = "Hello World!";',
|
|
394
|
-
language: 'javascript',
|
|
395
|
-
showCopy: true,
|
|
396
|
-
title: 'Test Code'
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
const component = <Code {...props} />;
|
|
400
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
401
|
-
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
402
|
-
|
|
403
|
-
expect(deserialized).toBeTruthy();
|
|
404
|
-
|
|
405
|
-
const parsedData = JSON.parse(serialized);
|
|
406
|
-
expect(parsedData.tag).toBe('Code');
|
|
407
|
-
expect(parsedData.version).toBe('1.0.0');
|
|
408
|
-
expect(parsedData.data.children).toBe('const test = "Hello World!";');
|
|
409
|
-
expect(parsedData.data.language).toBe('javascript');
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
test('should handle React children', () => {
|
|
413
|
-
const reactChildren = (
|
|
414
|
-
<>
|
|
415
|
-
<span>Line 1</span>
|
|
416
|
-
<br />
|
|
417
|
-
<span>Line 2</span>
|
|
418
|
-
</>
|
|
419
|
-
);
|
|
420
|
-
|
|
421
|
-
const component = <Code language="text">{reactChildren}</Code>;
|
|
422
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
423
|
-
const parsedData = JSON.parse(serialized);
|
|
424
|
-
|
|
425
|
-
expect(parsedData.data.children).toBe('Line 1Line 2');
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
test('should preserve data binding configuration', () => {
|
|
429
|
-
const dataBindingProps = {
|
|
430
|
-
children: 'Loading...',
|
|
431
|
-
dataSource: 'api/code/example',
|
|
432
|
-
bindingOptions: { cache: true, cacheTTL: 60000 },
|
|
433
|
-
language: 'javascript'
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
const component = <Code {...dataBindingProps} />;
|
|
437
|
-
const serialized = ComponentTransformer.serialize(component);
|
|
438
|
-
const parsedData = JSON.parse(serialized);
|
|
439
|
-
|
|
440
|
-
expect(parsedData.data.dataSource).toBe('api/code/example');
|
|
441
|
-
expect(parsedData.data.bindingOptions).toEqual({ cache: true, cacheTTL: 60000 });
|
|
442
|
-
});
|
|
443
|
-
});
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
## Migration Notes
|
|
447
|
-
|
|
448
|
-
### From Previous Versions
|
|
449
|
-
|
|
450
|
-
The Code component maintains backward compatibility with previous versions. When deserializing older data:
|
|
451
|
-
|
|
452
|
-
- Missing props receive default values
|
|
453
|
-
- Deprecated props are automatically migrated
|
|
454
|
-
- Version validation ensures compatibility
|
|
455
|
-
|
|
456
|
-
### Future Compatibility
|
|
457
|
-
|
|
458
|
-
The Code component follows semantic versioning:
|
|
459
|
-
- **Patch versions (1.0.x)**: Bug fixes, no breaking changes
|
|
460
|
-
- **Minor versions (1.x.0)**: New features, backward compatible
|
|
461
|
-
- **Major versions (x.0.0)**: Breaking changes with migration guide
|
|
462
|
-
|
|
463
|
-
## Troubleshooting
|
|
464
|
-
|
|
465
|
-
### Common Issues
|
|
466
|
-
|
|
467
|
-
**1. Component Not Serializing**
|
|
468
|
-
```tsx
|
|
469
|
-
// ❌ Component not registered
|
|
470
|
-
const serialized = ComponentTransformer.serialize(<Code>content</Code>);
|
|
471
|
-
|
|
472
|
-
// ✅ Ensure component is imported (auto-registers)
|
|
473
|
-
import { Code } from '@qwickapps/react-framework';
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
**2. Large Code Blocks Performance**
|
|
477
|
-
```tsx
|
|
478
|
-
// ❌ Very large content might be slow
|
|
479
|
-
<Code>{megabytesOfCode}</Code>
|
|
480
|
-
|
|
481
|
-
// ✅ Consider data binding for large content
|
|
482
|
-
<Code dataSource="api/large-code-files/1" language="javascript" />
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
**3. ReactNode Children Not Converting**
|
|
486
|
-
```tsx
|
|
487
|
-
// ❌ Complex React components might not convert perfectly
|
|
488
|
-
<Code>
|
|
489
|
-
<ComplexComponent with="props" />
|
|
490
|
-
</Code>
|
|
491
|
-
|
|
492
|
-
// ✅ Use string content or data binding for complex cases
|
|
493
|
-
<Code dataSource="api/code-content/complex" />
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
### Debug Mode
|
|
497
|
-
|
|
498
|
-
Enable debug logging for serialization issues:
|
|
499
|
-
|
|
500
|
-
```tsx
|
|
501
|
-
// Enable debug mode in development
|
|
502
|
-
if (process.env.NODE_ENV === 'development') {
|
|
503
|
-
ComponentTransformer.enableDebugMode();
|
|
504
|
-
}
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
## Contributing
|
|
508
|
-
|
|
509
|
-
### Component Architecture Standards
|
|
510
|
-
|
|
511
|
-
The Code component serves as the reference implementation for all serializable components. When contributing:
|
|
512
|
-
|
|
513
|
-
1. **Follow the Pattern**: Use class-based components with Serializable interface
|
|
514
|
-
2. **Preserve Data Binding**: Always include dataSource and bindingOptions in serialization
|
|
515
|
-
3. **Handle Edge Cases**: Test with empty content, Unicode, and large data
|
|
516
|
-
4. **Performance First**: Maintain <1ms serialization performance
|
|
517
|
-
5. **Test Thoroughly**: Include serialization tests for all new features
|
|
518
|
-
|
|
519
|
-
### Related Documentation
|
|
520
|
-
|
|
521
|
-
- [Component Serialization Guide](/docs/COMPONENT_SERIALIZATION_GUIDE.md) - Comprehensive implementation guide
|
|
522
|
-
- [Serializable Component Templates](/docs/SERIALIZABLE_COMPONENT_TEMPLATE.md) - Copy-paste boilerplate code
|
|
523
|
-
- [Architecture Documentation](/ARCHITECTURE.md#component-serialization-system-architecture) - System architecture details
|
|
524
|
-
|
|
525
|
-
## License
|
|
526
|
-
|
|
527
|
-
Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
528
|
-
|
|
529
|
-
Part of the QwickApps React Framework - enabling "WebView for React" functionality with comprehensive component serialization.
|