@qwickapps/react-framework 1.3.4 → 1.4.0
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/README.md +1688 -2
- package/dist/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
- package/dist/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.d.ts +7 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/Html.d.ts +28 -18
- package/dist/components/Html.d.ts.map +1 -1
- package/dist/components/Logo.d.ts +12 -35
- package/dist/components/Logo.d.ts.map +1 -1
- package/dist/components/Markdown.d.ts +18 -13
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/QwickApp.d.ts +16 -3
- package/dist/components/QwickApp.d.ts.map +1 -1
- package/dist/components/QwickIcon.d.ts +23 -0
- package/dist/components/QwickIcon.d.ts.map +1 -0
- package/dist/components/SafeSpan.d.ts +12 -5
- package/dist/components/SafeSpan.d.ts.map +1 -1
- package/dist/components/Scaffold.d.ts.map +1 -1
- package/dist/components/base/ModelView.d.ts +101 -0
- package/dist/components/base/ModelView.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +11 -0
- package/dist/components/base/index.d.ts.map +1 -0
- package/dist/components/blocks/Article.d.ts +12 -2
- package/dist/components/blocks/Article.d.ts.map +1 -1
- package/dist/components/blocks/Code.d.ts +13 -2
- package/dist/components/blocks/Code.d.ts.map +1 -1
- package/dist/components/blocks/Content.d.ts.map +1 -1
- package/dist/components/blocks/CoverImageHeader.d.ts.map +1 -1
- package/dist/components/blocks/FeatureCard.d.ts.map +1 -1
- package/dist/components/blocks/FeatureGrid.d.ts.map +1 -1
- package/dist/components/blocks/Footer.d.ts.map +1 -1
- package/dist/components/blocks/HeroBlock.d.ts +27 -13
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
- package/dist/components/blocks/Image.d.ts +41 -0
- package/dist/components/blocks/Image.d.ts.map +1 -0
- package/dist/components/blocks/PageBannerHeader.d.ts.map +1 -1
- package/dist/components/blocks/ProductCard.d.ts.map +1 -1
- package/dist/components/blocks/Section.d.ts +16 -2
- package/dist/components/blocks/Section.d.ts.map +1 -1
- package/dist/components/blocks/Text.d.ts +41 -0
- package/dist/components/blocks/Text.d.ts.map +1 -0
- package/dist/components/blocks/index.d.ts +4 -0
- package/dist/components/blocks/index.d.ts.map +1 -1
- package/dist/components/buttons/Button.d.ts +23 -7
- package/dist/components/buttons/Button.d.ts.map +1 -1
- package/dist/components/forms/FormBlock.d.ts +19 -13
- package/dist/components/forms/FormBlock.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/ChoiceInputField.d.ts +17 -11
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
- package/dist/components/input/HtmlInputField.d.ts +17 -11
- package/dist/components/input/HtmlInputField.d.ts.map +1 -1
- package/dist/components/input/SelectInputField.d.ts +16 -10
- package/dist/components/input/SelectInputField.d.ts.map +1 -1
- package/dist/components/input/SwitchInputField.d.ts +16 -10
- package/dist/components/input/SwitchInputField.d.ts.map +1 -1
- package/dist/components/input/TextField.d.ts.map +1 -1
- package/dist/components/input/TextInputField.d.ts +16 -11
- package/dist/components/input/TextInputField.d.ts.map +1 -1
- package/dist/components/layout/GridCell.d.ts +23 -6
- package/dist/components/layout/GridCell.d.ts.map +1 -1
- package/dist/components/layout/GridLayout.d.ts +24 -23
- package/dist/components/layout/GridLayout.d.ts.map +1 -1
- package/dist/components/pages/FormPage.d.ts.map +1 -1
- package/dist/components/pages/Page.d.ts +49 -87
- package/dist/components/pages/Page.d.ts.map +1 -1
- package/dist/components/pages/index.d.ts +2 -2
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/config/AppConfig.d.ts +49 -0
- package/dist/config/AppConfig.d.ts.map +1 -0
- package/dist/config/AppConfigBuilder.d.ts +75 -0
- package/dist/config/AppConfigBuilder.d.ts.map +1 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/types.d.ts +130 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.esm.js +451 -0
- package/dist/config.js +455 -0
- package/dist/contexts/PrintModeContext.d.ts +27 -0
- package/dist/contexts/PrintModeContext.d.ts.map +1 -0
- package/dist/contexts/QwickAppContext.d.ts +2 -2
- package/dist/contexts/QwickAppContext.d.ts.map +1 -1
- package/dist/contexts/ThemeContext.d.ts.map +1 -1
- package/dist/contexts/index.d.ts +2 -0
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/usePrintMode.d.ts +39 -0
- package/dist/hooks/usePrintMode.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +20722 -16021
- package/dist/index.js +20725 -16010
- package/dist/schemas/CodeSchema.d.ts +2 -1
- package/dist/schemas/CodeSchema.d.ts.map +1 -1
- package/dist/schemas/CollapsibleLayoutSchema.d.ts +2 -1
- package/dist/schemas/CollapsibleLayoutSchema.d.ts.map +1 -1
- package/dist/schemas/ContentSchema.d.ts +2 -1
- package/dist/schemas/ContentSchema.d.ts.map +1 -1
- package/dist/schemas/GridCellSchema.d.ts +25 -0
- package/dist/schemas/GridCellSchema.d.ts.map +1 -0
- package/dist/schemas/GridLayoutSchema.d.ts +23 -0
- package/dist/schemas/GridLayoutSchema.d.ts.map +1 -0
- package/dist/schemas/HtmlSchema.d.ts +14 -0
- package/dist/schemas/HtmlSchema.d.ts.map +1 -0
- package/dist/schemas/ImageSchema.d.ts +32 -0
- package/dist/schemas/ImageSchema.d.ts.map +1 -0
- package/dist/schemas/LogoSchema.d.ts +35 -0
- package/dist/schemas/LogoSchema.d.ts.map +1 -0
- package/dist/schemas/MarkdownSchema.d.ts +14 -0
- package/dist/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/schemas/PageTemplateSchema.d.ts +31 -0
- package/dist/schemas/PageTemplateSchema.d.ts.map +1 -0
- package/dist/schemas/PrintConfigSchema.d.ts +31 -0
- package/dist/schemas/PrintConfigSchema.d.ts.map +1 -0
- package/dist/schemas/SectionSchema.d.ts +2 -1
- package/dist/schemas/SectionSchema.d.ts.map +1 -1
- package/dist/schemas/TextSchema.d.ts +37 -0
- package/dist/schemas/TextSchema.d.ts.map +1 -0
- package/dist/schemas/ViewModelSchema.d.ts +23 -0
- package/dist/schemas/ViewModelSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +15 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/transformers/ComponentTransformer.d.ts +116 -0
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
- package/dist/schemas/transformers/__tests__/MockSerializableComponent.d.ts +66 -0
- package/dist/schemas/transformers/__tests__/MockSerializableComponent.d.ts.map +1 -0
- package/dist/schemas/transformers/registry.d.ts +15 -0
- package/dist/schemas/transformers/registry.d.ts.map +1 -0
- package/dist/schemas/types/Serializable.d.ts +46 -0
- package/dist/schemas/types/Serializable.d.ts.map +1 -0
- package/dist/utils/htmlTransform.d.ts.map +1 -1
- package/dist/utils/reactUtils.d.ts +12 -3
- package/dist/utils/reactUtils.d.ts.map +1 -1
- package/package.json +17 -3
- package/src/{components/__tests__ → __tests__/components}/AccessibilityProvider.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Article.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Breadcrumbs.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Button.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/CardListGrid.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/ChoiceInputField.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Code.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Content.integration.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Content.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/CoverImageHeader.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/ErrorBoundary.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/FeatureCard.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/FeatureGrid.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/FeatureGrid.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/Footer.test.tsx +4 -4
- package/src/{components/__tests__ → __tests__/components}/FormBlock.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/HeroBlock.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/HeroBlock.test.tsx +233 -7
- package/src/{components/__tests__ → __tests__/components}/Html.test.tsx +11 -2
- package/src/{components/__tests__ → __tests__/components}/HtmlInputField.test.tsx +3 -3
- package/src/__tests__/components/Logo.test.js +3 -3
- package/src/{components/__tests__ → __tests__/components}/Markdown.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/PageBannerHeader.test.tsx +3 -3
- package/src/{components/__tests__ → __tests__/components}/PaletteSwitcher.test.tsx +3 -3
- package/src/{components/__tests__ → __tests__/components}/ProductCard.test.tsx +4 -4
- package/src/{components/__tests__ → __tests__/components}/SafeSpan.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/SafeSpan.simple.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/SafeSpan.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Section.integration.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Section.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/SelectInputField.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/TextInputField.test.tsx +3 -3
- package/src/{components/__tests__ → __tests__/components}/ThemeSwitcher.test.tsx +3 -3
- package/src/__tests__/components/base/ModelView.test.tsx +220 -0
- package/src/__tests__/components/blocks/Code.performance.test.tsx +625 -0
- package/src/__tests__/components/blocks/Code.serialization.test.tsx +507 -0
- package/src/__tests__/components/blocks/HeroBlock.serialization.test.tsx +414 -0
- package/src/__tests__/components/blocks/Image.serialization.test.tsx +257 -0
- package/src/__tests__/components/blocks/Section.serialization.test.tsx +553 -0
- package/src/__tests__/components/blocks/Text.performance.test.tsx +442 -0
- package/src/__tests__/components/blocks/Text.serialization.test.tsx +491 -0
- package/src/__tests__/components/buttons/Button.serialization.test.tsx +443 -0
- package/src/__tests__/components/input/FormComponents.serialization.test.tsx +482 -0
- package/src/__tests__/components/input/SelectInputField.serialization.test.tsx +439 -0
- package/src/__tests__/components/input/TextInputField.serialization.test.tsx +359 -0
- package/src/{components/layout/CollapsibleLayout/__tests__ → __tests__/components/layout}/CollapsibleLayout.test.tsx +4 -4
- package/src/__tests__/components/layout/GridCell.serialization.test.tsx +403 -0
- package/src/__tests__/components/layout/GridLayout.serialization.test.tsx +311 -0
- package/src/__tests__/hooks/usePrintMode.test.ts +89 -0
- package/src/__tests__/schemas/PageTemplateSchema.test.ts +161 -0
- package/src/__tests__/schemas/PrintConfigSchema.test.ts +127 -0
- package/src/__tests__/schemas/ViewModelSchema.test.ts +80 -0
- package/src/__tests__/schemas/transformers/ComponentSerializationPatterns.test.tsx +602 -0
- package/src/__tests__/schemas/transformers/ComponentTransformer.htmlPatterns.test.ts +301 -0
- package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +521 -0
- package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +586 -0
- package/src/__tests__/schemas/transformers/MockSerializableComponent.ts +103 -0
- package/src/__tests__/schemas/transformers/RealWorldScenarios.test.tsx +1165 -0
- package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +602 -0
- package/src/__tests__/schemas/transformers/SerializationIntegration.test.tsx +691 -0
- package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +460 -0
- package/src/__tests__/schemas/transformers/TestAutomation.test.ts +597 -0
- package/src/{utils/__tests__ → __tests__/utils}/nested-dom-fix.test.tsx +1 -1
- package/src/components/ErrorBoundary.tsx +8 -8
- package/src/components/Html.tsx +147 -44
- package/src/components/Logo.tsx +198 -100
- package/src/components/Markdown.tsx +125 -16
- package/src/components/QwickApp.tsx +64 -31
- package/src/components/QwickIcon.tsx +59 -0
- package/src/components/SafeSpan.tsx +65 -10
- package/src/components/Scaffold.tsx +2 -8
- package/src/components/base/ModelView.tsx +199 -0
- package/src/components/base/index.ts +11 -0
- package/src/components/blocks/Article.tsx +57 -18
- package/src/components/blocks/Code.md +529 -0
- package/src/components/blocks/Code.tsx +102 -15
- package/src/components/blocks/Content.tsx +25 -77
- package/src/components/blocks/CoverImageHeader.tsx +9 -4
- package/src/components/blocks/FeatureCard.tsx +1 -2
- package/src/components/blocks/FeatureGrid.tsx +19 -1
- package/src/components/blocks/Footer.tsx +13 -1
- package/src/components/blocks/HeroBlock.tsx +87 -20
- package/src/components/blocks/Image.tsx +395 -0
- package/src/components/blocks/PageBannerHeader.tsx +14 -12
- package/src/components/blocks/ProductCard.tsx +51 -52
- package/src/components/blocks/Section.tsx +113 -8
- package/src/components/blocks/Text.tsx +285 -0
- package/src/components/blocks/index.ts +4 -0
- package/src/components/buttons/Button.tsx +184 -15
- package/src/components/forms/FormBlock.tsx +70 -17
- package/src/components/index.ts +5 -0
- package/src/components/input/ChoiceInputField.tsx +48 -18
- package/src/components/input/HtmlInputField.tsx +48 -18
- package/src/components/input/SelectInputField.tsx +48 -16
- package/src/components/input/SwitchInputField.tsx +48 -17
- package/src/components/input/TextField.tsx +41 -1
- package/src/components/input/TextInputField.tsx +52 -18
- package/src/components/layout/GridCell.tsx +118 -9
- package/src/components/layout/GridLayout.tsx +125 -24
- package/src/components/pages/FormPage.tsx +0 -1
- package/src/components/pages/Page.css +304 -332
- package/src/components/pages/Page.tsx +307 -255
- package/src/components/pages/index.ts +2 -2
- package/src/config/AppConfig.ts +133 -0
- package/src/config/AppConfigBuilder.ts +421 -0
- package/src/config/__tests__/AppConfig.test.ts +385 -0
- package/src/config/__tests__/AppConfigBuilder.test.ts +432 -0
- package/src/config/index.ts +24 -0
- package/src/config/types.ts +170 -0
- package/src/config.ts +25 -0
- package/src/contexts/PrintModeContext.tsx +332 -0
- package/src/contexts/QwickAppContext.tsx +2 -2
- package/src/contexts/ThemeContext.tsx +1 -2
- package/src/contexts/index.ts +2 -0
- package/src/hooks/index.ts +5 -1
- package/src/hooks/usePrintMode.ts +73 -0
- package/src/index.ts +3 -0
- package/src/schemas/CodeSchema.ts +3 -3
- package/src/schemas/CollapsibleLayoutSchema.ts +2 -1
- package/src/schemas/ContentSchema.ts +2 -1
- package/src/schemas/GridCellSchema.ts +164 -0
- package/src/schemas/GridLayoutSchema.ts +133 -0
- package/src/schemas/HtmlSchema.ts +47 -0
- package/src/schemas/ImageSchema.ts +235 -0
- package/src/schemas/LogoSchema.ts +241 -0
- package/src/schemas/MarkdownSchema.ts +47 -0
- package/src/schemas/PageTemplateSchema.ts +186 -0
- package/src/schemas/PrintConfigSchema.ts +207 -0
- package/src/schemas/README.md +661 -0
- package/src/schemas/SectionSchema.ts +2 -1
- package/src/schemas/TextSchema.ts +329 -0
- package/src/schemas/ViewModelSchema.ts +115 -0
- package/src/schemas/index.ts +21 -2
- package/src/schemas/transformers/ComponentTransformer.ts +403 -0
- package/src/schemas/transformers/ReactNodeTransformer.ts +236 -0
- package/src/schemas/transformers/registry.ts +72 -0
- package/src/schemas/types/Serializable.ts +51 -0
- package/src/stories/AccessibilityProvider.stories.tsx +253 -253
- package/src/stories/Article.stories.tsx +433 -433
- package/src/stories/Button.stories.tsx +1 -1
- package/src/stories/CardListGrid.stories.tsx +451 -451
- package/src/stories/ChoiceInputField.stories.tsx +503 -503
- package/src/stories/Code.stories.tsx +1 -1
- package/src/stories/CollapsibleLayout.stories.tsx +1414 -1414
- package/src/stories/Content.stories.tsx +393 -393
- package/src/stories/CoverImageHeader.stories.tsx +701 -701
- package/src/stories/DataBinding.advanced.stories.tsx +432 -432
- package/src/stories/DataProvider.stories.tsx +1192 -1192
- package/src/stories/FeatureCard.stories.tsx +557 -557
- package/src/stories/FeatureGrid.stories.tsx +594 -594
- package/src/stories/Footer.stories.tsx +640 -640
- package/src/stories/FormBlock.stories.tsx +760 -760
- package/src/stories/FormComponents.stories.tsx +349 -541
- package/src/stories/GridCell.stories.tsx +417 -0
- package/src/stories/GridLayout.stories.tsx +353 -0
- package/src/stories/HeroBlock.stories.tsx +862 -373
- package/src/stories/HtmlInputField.stories.tsx +474 -474
- package/src/stories/Image.stories.tsx +819 -0
- package/src/stories/Introduction.stories.tsx +667 -667
- package/src/stories/LayoutBlocks.stories.tsx +324 -324
- package/src/stories/Logo.stories.tsx +165 -6
- package/src/stories/Markdown.stories.tsx +137 -137
- package/src/stories/ModelView.stories.tsx +477 -0
- package/src/stories/Page.stories.tsx +688 -688
- package/src/stories/PageBannerHeader.stories.tsx +864 -864
- package/src/stories/PaletteSwitcher.stories.tsx +119 -119
- package/src/stories/ProductCard.stories.tsx +424 -424
- package/src/stories/QwickApp.stories.tsx +368 -368
- package/src/stories/ResponsiveMenu.stories.tsx +249 -249
- package/src/stories/SafeSpan.stories.tsx +531 -531
- package/src/stories/Section.stories.tsx +90 -2
- package/src/stories/SelectInputField.stories.tsx +524 -524
- package/src/stories/Text.stories.tsx +560 -0
- package/src/stories/TextInputField.stories.tsx +443 -443
- package/src/stories/ThemeSwitcher.stories.tsx +123 -123
- package/src/utils/htmlTransform.tsx +74 -53
- package/src/utils/reactUtils.tsx +57 -6
- package/dist/index.bundled.css +0 -12
- /package/src/{hooks/__tests__ → __tests__/hooks}/useDataBinding.test.tsx.disabled +0 -0
- /package/src/{schemas/__tests__ → __tests__/schemas}/builders.test.ts +0 -0
- /package/src/{utils/__tests__ → __tests__/utils}/createDataDrivenComponent.test.tsx.disabled +0 -0
- /package/src/{utils/__tests__ → __tests__/utils}/htmlTransform.test.tsx +0 -0
- /package/src/{utils/__tests__ → __tests__/utils}/optional-logging.test.ts +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for Text component - Comprehensive typography component
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import { IsBoolean, IsOptional, IsString, IsIn } from 'class-validator';
|
|
9
|
+
import 'reflect-metadata';
|
|
10
|
+
import { Editor, Field, Schema, Model, FieldType, DataType } from '@qwickapps/schema';
|
|
11
|
+
|
|
12
|
+
// Typography variants based on Material-UI Typography variants
|
|
13
|
+
export type TextVariant =
|
|
14
|
+
| 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
15
|
+
| 'subtitle1' | 'subtitle2'
|
|
16
|
+
| 'body1' | 'body2'
|
|
17
|
+
| 'button'
|
|
18
|
+
| 'caption'
|
|
19
|
+
| 'overline';
|
|
20
|
+
|
|
21
|
+
// Text alignment options
|
|
22
|
+
export type TextAlign = 'left' | 'center' | 'right' | 'justify' | 'inherit';
|
|
23
|
+
|
|
24
|
+
// Text color variants
|
|
25
|
+
export type TextColor =
|
|
26
|
+
| 'primary' | 'secondary' | 'textPrimary' | 'textSecondary'
|
|
27
|
+
| 'error' | 'warning' | 'info' | 'success'
|
|
28
|
+
| 'inherit';
|
|
29
|
+
|
|
30
|
+
// HTML element types for semantic markup
|
|
31
|
+
export type TextElement = 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'legend';
|
|
32
|
+
|
|
33
|
+
// Text decoration options
|
|
34
|
+
export type TextDecoration = 'none' | 'underline' | 'overline' | 'line-through';
|
|
35
|
+
|
|
36
|
+
// Font weight options
|
|
37
|
+
export type FontWeight = 'inherit' | 'lighter' | 'normal' | 'bold' | 'bolder' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
38
|
+
|
|
39
|
+
// Text transform options
|
|
40
|
+
export type TextTransform = 'none' | 'capitalize' | 'uppercase' | 'lowercase' | 'inherit';
|
|
41
|
+
|
|
42
|
+
@Schema('Text', '1.0.0')
|
|
43
|
+
export class TextModel extends Model {
|
|
44
|
+
@Field({ dataType: DataType.STRING })
|
|
45
|
+
@Editor({
|
|
46
|
+
field_type: FieldType.TEXTAREA,
|
|
47
|
+
label: 'Text Content',
|
|
48
|
+
description: 'The text content to display',
|
|
49
|
+
placeholder: 'Enter your text content here...'
|
|
50
|
+
})
|
|
51
|
+
@IsOptional()
|
|
52
|
+
@IsString()
|
|
53
|
+
content?: string;
|
|
54
|
+
|
|
55
|
+
@Field({ defaultValue: 'body1', dataType: DataType.STRING })
|
|
56
|
+
@Editor({
|
|
57
|
+
field_type: FieldType.SELECT,
|
|
58
|
+
label: 'Typography Variant',
|
|
59
|
+
description: 'Typography variant that determines font size, weight, and line height',
|
|
60
|
+
validation: {
|
|
61
|
+
options: [
|
|
62
|
+
{ label: 'Heading 1', value: 'h1' },
|
|
63
|
+
{ label: 'Heading 2', value: 'h2' },
|
|
64
|
+
{ label: 'Heading 3', value: 'h3' },
|
|
65
|
+
{ label: 'Heading 4', value: 'h4' },
|
|
66
|
+
{ label: 'Heading 5', value: 'h5' },
|
|
67
|
+
{ label: 'Heading 6', value: 'h6' },
|
|
68
|
+
{ label: 'Subtitle 1', value: 'subtitle1' },
|
|
69
|
+
{ label: 'Subtitle 2', value: 'subtitle2' },
|
|
70
|
+
{ label: 'Body 1', value: 'body1' },
|
|
71
|
+
{ label: 'Body 2', value: 'body2' },
|
|
72
|
+
{ label: 'Button', value: 'button' },
|
|
73
|
+
{ label: 'Caption', value: 'caption' },
|
|
74
|
+
{ label: 'Overline', value: 'overline' }
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
@IsOptional()
|
|
79
|
+
@IsString()
|
|
80
|
+
@IsIn(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'button', 'caption', 'overline'])
|
|
81
|
+
variant?: TextVariant;
|
|
82
|
+
|
|
83
|
+
@Field({ defaultValue: 'inherit', dataType: DataType.STRING })
|
|
84
|
+
@Editor({
|
|
85
|
+
field_type: FieldType.SELECT,
|
|
86
|
+
label: 'Text Color',
|
|
87
|
+
description: 'Color variant for the text',
|
|
88
|
+
validation: {
|
|
89
|
+
options: [
|
|
90
|
+
{ label: 'Primary', value: 'primary' },
|
|
91
|
+
{ label: 'Secondary', value: 'secondary' },
|
|
92
|
+
{ label: 'Text Primary', value: 'textPrimary' },
|
|
93
|
+
{ label: 'Text Secondary', value: 'textSecondary' },
|
|
94
|
+
{ label: 'Error', value: 'error' },
|
|
95
|
+
{ label: 'Warning', value: 'warning' },
|
|
96
|
+
{ label: 'Info', value: 'info' },
|
|
97
|
+
{ label: 'Success', value: 'success' },
|
|
98
|
+
{ label: 'Inherit', value: 'inherit' }
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
@IsOptional()
|
|
103
|
+
@IsString()
|
|
104
|
+
@IsIn(['primary', 'secondary', 'textPrimary', 'textSecondary', 'error', 'warning', 'info', 'success', 'inherit'])
|
|
105
|
+
color?: TextColor;
|
|
106
|
+
|
|
107
|
+
@Field({ defaultValue: 'inherit', dataType: DataType.STRING })
|
|
108
|
+
@Editor({
|
|
109
|
+
field_type: FieldType.SELECT,
|
|
110
|
+
label: 'Text Alignment',
|
|
111
|
+
description: 'How to align the text horizontally',
|
|
112
|
+
validation: {
|
|
113
|
+
options: [
|
|
114
|
+
{ label: 'Left', value: 'left' },
|
|
115
|
+
{ label: 'Center', value: 'center' },
|
|
116
|
+
{ label: 'Right', value: 'right' },
|
|
117
|
+
{ label: 'Justify', value: 'justify' },
|
|
118
|
+
{ label: 'Inherit', value: 'inherit' }
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
@IsOptional()
|
|
123
|
+
@IsString()
|
|
124
|
+
@IsIn(['left', 'center', 'right', 'justify', 'inherit'])
|
|
125
|
+
align?: TextAlign;
|
|
126
|
+
|
|
127
|
+
@Field({ defaultValue: 'p', dataType: DataType.STRING })
|
|
128
|
+
@Editor({
|
|
129
|
+
field_type: FieldType.SELECT,
|
|
130
|
+
label: 'HTML Element',
|
|
131
|
+
description: 'The HTML element to render (affects semantics and accessibility)',
|
|
132
|
+
validation: {
|
|
133
|
+
options: [
|
|
134
|
+
{ label: 'Paragraph (p)', value: 'p' },
|
|
135
|
+
{ label: 'Span', value: 'span' },
|
|
136
|
+
{ label: 'Div', value: 'div' },
|
|
137
|
+
{ label: 'Heading 1 (h1)', value: 'h1' },
|
|
138
|
+
{ label: 'Heading 2 (h2)', value: 'h2' },
|
|
139
|
+
{ label: 'Heading 3 (h3)', value: 'h3' },
|
|
140
|
+
{ label: 'Heading 4 (h4)', value: 'h4' },
|
|
141
|
+
{ label: 'Heading 5 (h5)', value: 'h5' },
|
|
142
|
+
{ label: 'Heading 6 (h6)', value: 'h6' },
|
|
143
|
+
{ label: 'Label', value: 'label' },
|
|
144
|
+
{ label: 'Legend', value: 'legend' }
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
@IsOptional()
|
|
149
|
+
@IsString()
|
|
150
|
+
@IsIn(['p', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'label', 'legend'])
|
|
151
|
+
component?: TextElement;
|
|
152
|
+
|
|
153
|
+
@Field({ defaultValue: 'inherit', dataType: DataType.STRING })
|
|
154
|
+
@Editor({
|
|
155
|
+
field_type: FieldType.SELECT,
|
|
156
|
+
label: 'Font Weight',
|
|
157
|
+
description: 'The weight (thickness) of the font',
|
|
158
|
+
validation: {
|
|
159
|
+
options: [
|
|
160
|
+
{ label: 'Inherit', value: 'inherit' },
|
|
161
|
+
{ label: 'Lighter', value: 'lighter' },
|
|
162
|
+
{ label: 'Normal', value: 'normal' },
|
|
163
|
+
{ label: 'Bold', value: 'bold' },
|
|
164
|
+
{ label: 'Bolder', value: 'bolder' },
|
|
165
|
+
{ label: '100', value: '100' },
|
|
166
|
+
{ label: '200', value: '200' },
|
|
167
|
+
{ label: '300', value: '300' },
|
|
168
|
+
{ label: '400', value: '400' },
|
|
169
|
+
{ label: '500', value: '500' },
|
|
170
|
+
{ label: '600', value: '600' },
|
|
171
|
+
{ label: '700', value: '700' },
|
|
172
|
+
{ label: '800', value: '800' },
|
|
173
|
+
{ label: '900', value: '900' }
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
@IsOptional()
|
|
178
|
+
@IsString()
|
|
179
|
+
@IsIn(['inherit', 'lighter', 'normal', 'bold', 'bolder', '100', '200', '300', '400', '500', '600', '700', '800', '900'])
|
|
180
|
+
fontWeight?: FontWeight;
|
|
181
|
+
|
|
182
|
+
@Field({ defaultValue: 'none', dataType: DataType.STRING })
|
|
183
|
+
@Editor({
|
|
184
|
+
field_type: FieldType.SELECT,
|
|
185
|
+
label: 'Text Decoration',
|
|
186
|
+
description: 'Text decoration style',
|
|
187
|
+
validation: {
|
|
188
|
+
options: [
|
|
189
|
+
{ label: 'None', value: 'none' },
|
|
190
|
+
{ label: 'Underline', value: 'underline' },
|
|
191
|
+
{ label: 'Overline', value: 'overline' },
|
|
192
|
+
{ label: 'Line Through', value: 'line-through' }
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
@IsOptional()
|
|
197
|
+
@IsString()
|
|
198
|
+
@IsIn(['none', 'underline', 'overline', 'line-through'])
|
|
199
|
+
textDecoration?: TextDecoration;
|
|
200
|
+
|
|
201
|
+
@Field({ defaultValue: 'none', dataType: DataType.STRING })
|
|
202
|
+
@Editor({
|
|
203
|
+
field_type: FieldType.SELECT,
|
|
204
|
+
label: 'Text Transform',
|
|
205
|
+
description: 'How to transform the text case',
|
|
206
|
+
validation: {
|
|
207
|
+
options: [
|
|
208
|
+
{ label: 'None', value: 'none' },
|
|
209
|
+
{ label: 'Capitalize', value: 'capitalize' },
|
|
210
|
+
{ label: 'Uppercase', value: 'uppercase' },
|
|
211
|
+
{ label: 'Lowercase', value: 'lowercase' },
|
|
212
|
+
{ label: 'Inherit', value: 'inherit' }
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
@IsOptional()
|
|
217
|
+
@IsString()
|
|
218
|
+
@IsIn(['none', 'capitalize', 'uppercase', 'lowercase', 'inherit'])
|
|
219
|
+
textTransform?: TextTransform;
|
|
220
|
+
|
|
221
|
+
@Field({ defaultValue: false, dataType: DataType.BOOLEAN })
|
|
222
|
+
@Editor({
|
|
223
|
+
field_type: FieldType.BOOLEAN,
|
|
224
|
+
label: 'No Wrap',
|
|
225
|
+
description: 'Prevent text from wrapping to multiple lines'
|
|
226
|
+
})
|
|
227
|
+
@IsOptional()
|
|
228
|
+
@IsBoolean()
|
|
229
|
+
noWrap?: boolean;
|
|
230
|
+
|
|
231
|
+
@Field({ defaultValue: false, dataType: DataType.BOOLEAN })
|
|
232
|
+
@Editor({
|
|
233
|
+
field_type: FieldType.BOOLEAN,
|
|
234
|
+
label: 'Paragraph Mode',
|
|
235
|
+
description: 'Apply paragraph spacing and formatting'
|
|
236
|
+
})
|
|
237
|
+
@IsOptional()
|
|
238
|
+
@IsBoolean()
|
|
239
|
+
paragraph?: boolean;
|
|
240
|
+
|
|
241
|
+
@Field({ defaultValue: false, dataType: DataType.BOOLEAN })
|
|
242
|
+
@Editor({
|
|
243
|
+
field_type: FieldType.BOOLEAN,
|
|
244
|
+
label: 'Gutter Bottom',
|
|
245
|
+
description: 'Add margin bottom for spacing (useful for headings)'
|
|
246
|
+
})
|
|
247
|
+
@IsOptional()
|
|
248
|
+
@IsBoolean()
|
|
249
|
+
gutterBottom?: boolean;
|
|
250
|
+
|
|
251
|
+
@Field({ dataType: DataType.STRING })
|
|
252
|
+
@Editor({
|
|
253
|
+
field_type: FieldType.TEXT,
|
|
254
|
+
label: 'Font Size',
|
|
255
|
+
description: 'Custom font size (overrides variant sizing, e.g., "16px", "1.2rem")',
|
|
256
|
+
placeholder: '16px'
|
|
257
|
+
})
|
|
258
|
+
@IsOptional()
|
|
259
|
+
@IsString()
|
|
260
|
+
fontSize?: string;
|
|
261
|
+
|
|
262
|
+
@Field({ dataType: DataType.STRING })
|
|
263
|
+
@Editor({
|
|
264
|
+
field_type: FieldType.TEXT,
|
|
265
|
+
label: 'Line Height',
|
|
266
|
+
description: 'Custom line height (e.g., "1.5", "24px", "150%")',
|
|
267
|
+
placeholder: '1.5'
|
|
268
|
+
})
|
|
269
|
+
@IsOptional()
|
|
270
|
+
@IsString()
|
|
271
|
+
lineHeight?: string;
|
|
272
|
+
|
|
273
|
+
@Field({ dataType: DataType.STRING })
|
|
274
|
+
@Editor({
|
|
275
|
+
field_type: FieldType.TEXT,
|
|
276
|
+
label: 'Letter Spacing',
|
|
277
|
+
description: 'Custom letter spacing (e.g., "0.1em", "1px")',
|
|
278
|
+
placeholder: '0.1em'
|
|
279
|
+
})
|
|
280
|
+
@IsOptional()
|
|
281
|
+
@IsString()
|
|
282
|
+
letterSpacing?: string;
|
|
283
|
+
|
|
284
|
+
@Field({ dataType: DataType.STRING })
|
|
285
|
+
@Editor({
|
|
286
|
+
field_type: FieldType.TEXT,
|
|
287
|
+
label: 'Font Family',
|
|
288
|
+
description: 'Custom font family (e.g., "Arial, sans-serif")',
|
|
289
|
+
placeholder: 'Arial, sans-serif'
|
|
290
|
+
})
|
|
291
|
+
@IsOptional()
|
|
292
|
+
@IsString()
|
|
293
|
+
fontFamily?: string;
|
|
294
|
+
|
|
295
|
+
@Field({ dataType: DataType.STRING })
|
|
296
|
+
@Editor({
|
|
297
|
+
field_type: FieldType.TEXTAREA,
|
|
298
|
+
label: 'Custom Color',
|
|
299
|
+
description: 'Custom text color (CSS color value, overrides color variant)',
|
|
300
|
+
placeholder: '#333333 or rgb(51, 51, 51)'
|
|
301
|
+
})
|
|
302
|
+
@IsOptional()
|
|
303
|
+
@IsString()
|
|
304
|
+
customColor?: string;
|
|
305
|
+
|
|
306
|
+
@Field({ dataType: DataType.STRING })
|
|
307
|
+
@Editor({
|
|
308
|
+
field_type: FieldType.TEXTAREA,
|
|
309
|
+
label: 'Max Width',
|
|
310
|
+
description: 'Maximum width for the text (e.g., "300px", "50%")',
|
|
311
|
+
placeholder: '300px'
|
|
312
|
+
})
|
|
313
|
+
@IsOptional()
|
|
314
|
+
@IsString()
|
|
315
|
+
maxWidth?: string;
|
|
316
|
+
|
|
317
|
+
// Support for rich content (React node)
|
|
318
|
+
@Field({ dataType: DataType.STRING })
|
|
319
|
+
@Editor({
|
|
320
|
+
field_type: FieldType.TEXTAREA,
|
|
321
|
+
label: 'Rich Content',
|
|
322
|
+
description: 'Rich text content with React elements (for advanced use)',
|
|
323
|
+
placeholder: 'Rich content...'
|
|
324
|
+
})
|
|
325
|
+
@IsOptional()
|
|
326
|
+
children?: ReactNode;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export default TextModel;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewModel Schema - Base class for all view components that can be serialized
|
|
3
|
+
*
|
|
4
|
+
* Provides common attributes shared across UI components including
|
|
5
|
+
* styling, accessibility, and layout properties.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { IsOptional, IsString, IsBoolean } from 'class-validator';
|
|
11
|
+
import 'reflect-metadata';
|
|
12
|
+
import { Editor, Field, FieldType, Model, Schema } from '@qwickapps/schema';
|
|
13
|
+
|
|
14
|
+
@Schema('ViewModel', '1.0.0')
|
|
15
|
+
export class ViewModelSchema extends Model {
|
|
16
|
+
@Field()
|
|
17
|
+
@Editor({
|
|
18
|
+
field_type: FieldType.TEXT,
|
|
19
|
+
label: 'CSS Class Name',
|
|
20
|
+
description: 'Additional CSS class name for custom styling',
|
|
21
|
+
placeholder: 'custom-class-name'
|
|
22
|
+
})
|
|
23
|
+
@IsOptional()
|
|
24
|
+
@IsString()
|
|
25
|
+
className?: string;
|
|
26
|
+
|
|
27
|
+
@Field()
|
|
28
|
+
@Editor({
|
|
29
|
+
field_type: FieldType.TEXT,
|
|
30
|
+
label: 'Inline Styles',
|
|
31
|
+
description: 'Inline CSS styles as JSON string (e.g., {"color": "red", "margin": "10px"})',
|
|
32
|
+
placeholder: '{"property": "value"}'
|
|
33
|
+
})
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsString()
|
|
36
|
+
style?: string;
|
|
37
|
+
|
|
38
|
+
@Field()
|
|
39
|
+
@Editor({
|
|
40
|
+
field_type: FieldType.TEXT,
|
|
41
|
+
label: 'Element ID',
|
|
42
|
+
description: 'Unique HTML element ID',
|
|
43
|
+
placeholder: 'unique-element-id'
|
|
44
|
+
})
|
|
45
|
+
@IsOptional()
|
|
46
|
+
@IsString()
|
|
47
|
+
id?: string;
|
|
48
|
+
|
|
49
|
+
@Field({ defaultValue: false })
|
|
50
|
+
@Editor({
|
|
51
|
+
field_type: FieldType.BOOLEAN,
|
|
52
|
+
label: 'Hidden',
|
|
53
|
+
description: 'Whether the component should be hidden from view'
|
|
54
|
+
})
|
|
55
|
+
@IsOptional()
|
|
56
|
+
@IsBoolean()
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
|
|
59
|
+
@Field()
|
|
60
|
+
@Editor({
|
|
61
|
+
field_type: FieldType.TEXT,
|
|
62
|
+
label: 'ARIA Label',
|
|
63
|
+
description: 'Accessibility label for screen readers',
|
|
64
|
+
placeholder: 'Describe this element...'
|
|
65
|
+
})
|
|
66
|
+
@IsOptional()
|
|
67
|
+
@IsString()
|
|
68
|
+
'aria-label'?: string;
|
|
69
|
+
|
|
70
|
+
@Field()
|
|
71
|
+
@Editor({
|
|
72
|
+
field_type: FieldType.TEXT,
|
|
73
|
+
label: 'ARIA Described By',
|
|
74
|
+
description: 'IDs of elements that describe this component',
|
|
75
|
+
placeholder: 'element-id-1 element-id-2'
|
|
76
|
+
})
|
|
77
|
+
@IsOptional()
|
|
78
|
+
@IsString()
|
|
79
|
+
'aria-describedby'?: string;
|
|
80
|
+
|
|
81
|
+
@Field()
|
|
82
|
+
@Editor({
|
|
83
|
+
field_type: FieldType.TEXT,
|
|
84
|
+
label: 'ARIA Labelled By',
|
|
85
|
+
description: 'IDs of elements that label this component',
|
|
86
|
+
placeholder: 'label-element-id'
|
|
87
|
+
})
|
|
88
|
+
@IsOptional()
|
|
89
|
+
@IsString()
|
|
90
|
+
'aria-labelledby'?: string;
|
|
91
|
+
|
|
92
|
+
@Field()
|
|
93
|
+
@Editor({
|
|
94
|
+
field_type: FieldType.TEXT,
|
|
95
|
+
label: 'Data Test ID',
|
|
96
|
+
description: 'Test automation identifier',
|
|
97
|
+
placeholder: 'test-element-name'
|
|
98
|
+
})
|
|
99
|
+
@IsOptional()
|
|
100
|
+
@IsString()
|
|
101
|
+
'data-testid'?: string;
|
|
102
|
+
|
|
103
|
+
@Field()
|
|
104
|
+
@Editor({
|
|
105
|
+
field_type: FieldType.TEXT,
|
|
106
|
+
label: 'Role',
|
|
107
|
+
description: 'ARIA role for accessibility',
|
|
108
|
+
placeholder: 'button, navigation, main, etc.'
|
|
109
|
+
})
|
|
110
|
+
@IsOptional()
|
|
111
|
+
@IsString()
|
|
112
|
+
role?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default ViewModelSchema;
|
package/src/schemas/index.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Schemas Module - Declarative Model schema definitions
|
|
2
|
+
* Schemas Module - Declarative Model schema definitions and Component Serialization System
|
|
3
3
|
*
|
|
4
4
|
* Exports all Model classes and their type-safe props using the new
|
|
5
5
|
* declarative pattern with @Schema, @Field, and @Editor decorators.
|
|
6
6
|
*
|
|
7
|
+
* Also exports the new Component Serialization System for "WebView for React" functionality.
|
|
8
|
+
*
|
|
7
9
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
10
|
*/
|
|
9
11
|
|
|
12
|
+
// Component Serialization System
|
|
13
|
+
export type { Serializable, SerializableConstructor } from './types/Serializable';
|
|
14
|
+
export { ComponentTransformer } from './transformers/ComponentTransformer';
|
|
15
|
+
// Auto-register serializable components
|
|
16
|
+
import './transformers/registry';
|
|
17
|
+
|
|
10
18
|
// Component schema models (declarative pattern)
|
|
11
19
|
export * from './ActionSchema';
|
|
12
20
|
export * from './ArticleSchema';
|
|
@@ -22,8 +30,13 @@ export * from './FooterItemSchema';
|
|
|
22
30
|
export * from './FormBlockSchema';
|
|
23
31
|
export * from './FooterSchema';
|
|
24
32
|
export * from './FooterSectionSchema';
|
|
33
|
+
export * from './GridCellSchema';
|
|
34
|
+
export * from './GridLayoutSchema';
|
|
25
35
|
export * from './HeaderActionSchema';
|
|
26
36
|
export * from './HeroBlockSchema';
|
|
37
|
+
export * from './HtmlSchema';
|
|
38
|
+
export * from './ImageSchema';
|
|
39
|
+
export * from './MarkdownSchema';
|
|
27
40
|
export * from './MetadataItemSchema';
|
|
28
41
|
export * from './PageBannerHeaderSchema';
|
|
29
42
|
export * from './PaletteSwitcherSchema';
|
|
@@ -31,4 +44,10 @@ export * from './ProductCardSchema';
|
|
|
31
44
|
export * from './SafeSpanSchema';
|
|
32
45
|
export * from './SectionSchema';
|
|
33
46
|
export * from './TextInputFieldSchema';
|
|
34
|
-
export * from './
|
|
47
|
+
export * from './TextSchema';
|
|
48
|
+
export * from './ThemeSwitcherSchema';
|
|
49
|
+
|
|
50
|
+
// Page system schemas
|
|
51
|
+
export * from './ViewModelSchema';
|
|
52
|
+
export * from './PrintConfigSchema';
|
|
53
|
+
export * from './PageTemplateSchema';
|