@qwickapps/react-framework 1.3.5 → 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 +1681 -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/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/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/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 +10951 -6238
- package/dist/index.js +11014 -6287
- 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/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 +1 -1
- 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/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,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QwickApps AppConfig Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the configuration contract for QwickApp applications.
|
|
5
|
+
* Separates static app configuration from runtime settings.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
import type { UserConfig as ViteUserConfig } from 'vite';
|
|
10
|
+
/**
|
|
11
|
+
* Static, immutable application configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface AppConfig {
|
|
14
|
+
/** Application identity and metadata */
|
|
15
|
+
readonly app: AppIdentity;
|
|
16
|
+
/** Build and development settings */
|
|
17
|
+
readonly build: BuildConfig;
|
|
18
|
+
/** Progressive Web App configuration */
|
|
19
|
+
readonly pwa: PWAConfig;
|
|
20
|
+
/** Default theme and UI settings */
|
|
21
|
+
readonly ui: UIConfig;
|
|
22
|
+
/** Copyright and legal information */
|
|
23
|
+
readonly copyright: CopyrightConfig;
|
|
24
|
+
/** Computed Vite configuration */
|
|
25
|
+
readonly viteConfig: ViteUserConfig;
|
|
26
|
+
/** Computed PWA manifest */
|
|
27
|
+
readonly pwaManifest: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Application identity and basic metadata
|
|
31
|
+
*/
|
|
32
|
+
export interface AppIdentity {
|
|
33
|
+
/** Unique application identifier */
|
|
34
|
+
readonly id: string;
|
|
35
|
+
/** Full application name */
|
|
36
|
+
readonly name: string;
|
|
37
|
+
/** Short name for PWA and limited spaces */
|
|
38
|
+
readonly shortName: string;
|
|
39
|
+
/** Application description */
|
|
40
|
+
readonly description: string;
|
|
41
|
+
/** Application version */
|
|
42
|
+
readonly version: string;
|
|
43
|
+
/** Path to application logo/icon */
|
|
44
|
+
readonly logo: string;
|
|
45
|
+
/** Application author/organization */
|
|
46
|
+
readonly author?: string;
|
|
47
|
+
/** Application homepage URL */
|
|
48
|
+
readonly homepage?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build and development configuration
|
|
52
|
+
*/
|
|
53
|
+
export interface BuildConfig {
|
|
54
|
+
/** Development server port */
|
|
55
|
+
readonly port: number;
|
|
56
|
+
/** Preview server port */
|
|
57
|
+
readonly previewPort: number;
|
|
58
|
+
/** Build output directory */
|
|
59
|
+
readonly outputDir: string;
|
|
60
|
+
/** Public path for assets */
|
|
61
|
+
readonly publicPath: string;
|
|
62
|
+
/** Base URL for the application */
|
|
63
|
+
readonly base: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Progressive Web App configuration
|
|
67
|
+
*/
|
|
68
|
+
export interface PWAConfig {
|
|
69
|
+
/** PWA theme color */
|
|
70
|
+
readonly themeColor: string;
|
|
71
|
+
/** PWA background color */
|
|
72
|
+
readonly backgroundColor: string;
|
|
73
|
+
/** PWA start URL */
|
|
74
|
+
readonly startUrl: string;
|
|
75
|
+
/** PWA scope */
|
|
76
|
+
readonly scope: string;
|
|
77
|
+
/** PWA display mode */
|
|
78
|
+
readonly display: 'standalone' | 'fullscreen' | 'minimal-ui' | 'browser';
|
|
79
|
+
/** PWA orientation */
|
|
80
|
+
readonly orientation?: 'portrait' | 'landscape' | 'any';
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Default UI and theme configuration
|
|
84
|
+
*/
|
|
85
|
+
export interface UIConfig {
|
|
86
|
+
/** Default theme mode */
|
|
87
|
+
readonly defaultTheme: 'light' | 'dark' | 'system';
|
|
88
|
+
/** Default color palette */
|
|
89
|
+
readonly defaultPalette: string;
|
|
90
|
+
/** Enable scaffolding (navigation, layout) */
|
|
91
|
+
readonly enableScaffolding: boolean;
|
|
92
|
+
/** Show theme switcher */
|
|
93
|
+
readonly showThemeSwitcher: boolean;
|
|
94
|
+
/** Show palette switcher */
|
|
95
|
+
readonly showPaletteSwitcher: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Copyright and legal information
|
|
99
|
+
*/
|
|
100
|
+
export interface CopyrightConfig {
|
|
101
|
+
/** Copyright year ('auto' for current year or specific year) */
|
|
102
|
+
readonly year: 'auto' | number;
|
|
103
|
+
/** Copyright holder/owner */
|
|
104
|
+
readonly author: string;
|
|
105
|
+
/** Additional legal text */
|
|
106
|
+
readonly text?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Configuration builder options
|
|
110
|
+
*/
|
|
111
|
+
export interface AppConfigOptions {
|
|
112
|
+
/** Base directory for resolving relative paths */
|
|
113
|
+
baseDir?: string;
|
|
114
|
+
/** Environment (development, production, test) */
|
|
115
|
+
env?: string;
|
|
116
|
+
/** Skip file existence validation */
|
|
117
|
+
skipValidation?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validation result
|
|
121
|
+
*/
|
|
122
|
+
export interface ValidationResult {
|
|
123
|
+
/** Validation warnings */
|
|
124
|
+
warnings: string[];
|
|
125
|
+
/** Validation errors */
|
|
126
|
+
errors: string[];
|
|
127
|
+
/** Whether configuration is valid */
|
|
128
|
+
isValid: boolean;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"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"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QwickApps Configuration Module Entry
|
|
3
|
+
*
|
|
4
|
+
* Lightweight export for config-only usage at build time.
|
|
5
|
+
* This file only exports configuration types and builders
|
|
6
|
+
* without pulling in React or MUI dependencies.
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
9
|
+
*/
|
|
10
|
+
export { AppConfig } from './config/AppConfig';
|
|
11
|
+
export { AppConfigBuilder } from './config/AppConfigBuilder';
|
|
12
|
+
export type { AppConfig as IAppConfig, AppIdentity, BuildConfig, PWAConfig, UIConfig, AppConfigOptions, ValidationResult, } from './config/types';
|
|
13
|
+
import { AppConfigBuilder } from './config/AppConfigBuilder';
|
|
14
|
+
export declare const createAppConfig: typeof AppConfigBuilder.create;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EACV,SAAS,IAAI,UAAU,EACvB,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,eAAO,MAAM,eAAe,gCAA0B,CAAC"}
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QwickApps AppConfig Implementation
|
|
3
|
+
*
|
|
4
|
+
* Immutable configuration object with computed properties for Vite and PWA.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Immutable application configuration
|
|
10
|
+
*/
|
|
11
|
+
class AppConfig {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
// Create frozen, immutable configuration
|
|
14
|
+
this.app = Object.freeze({
|
|
15
|
+
...config.app
|
|
16
|
+
});
|
|
17
|
+
this.build = Object.freeze({
|
|
18
|
+
...config.build
|
|
19
|
+
});
|
|
20
|
+
this.pwa = Object.freeze({
|
|
21
|
+
...config.pwa
|
|
22
|
+
});
|
|
23
|
+
this.ui = Object.freeze({
|
|
24
|
+
...config.ui
|
|
25
|
+
});
|
|
26
|
+
this.copyright = Object.freeze({
|
|
27
|
+
...config.copyright
|
|
28
|
+
});
|
|
29
|
+
// Freeze the entire object
|
|
30
|
+
Object.freeze(this);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Generate complete Vite configuration
|
|
34
|
+
*/
|
|
35
|
+
get viteConfig() {
|
|
36
|
+
return {
|
|
37
|
+
server: {
|
|
38
|
+
port: this.build.port,
|
|
39
|
+
host: true
|
|
40
|
+
},
|
|
41
|
+
preview: {
|
|
42
|
+
port: this.build.previewPort,
|
|
43
|
+
host: true
|
|
44
|
+
},
|
|
45
|
+
build: {
|
|
46
|
+
outDir: this.build.outputDir
|
|
47
|
+
},
|
|
48
|
+
base: this.build.base,
|
|
49
|
+
publicDir: 'public',
|
|
50
|
+
define: {
|
|
51
|
+
__APP_NAME__: JSON.stringify(this.app.name),
|
|
52
|
+
__APP_ID__: JSON.stringify(this.app.id),
|
|
53
|
+
__APP_VERSION__: JSON.stringify(this.app.version)
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Generate PWA manifest
|
|
59
|
+
*/
|
|
60
|
+
get pwaManifest() {
|
|
61
|
+
return {
|
|
62
|
+
name: this.app.name,
|
|
63
|
+
short_name: this.app.shortName,
|
|
64
|
+
description: this.app.description,
|
|
65
|
+
start_url: this.pwa.startUrl,
|
|
66
|
+
display: this.pwa.display,
|
|
67
|
+
orientation: this.pwa.orientation,
|
|
68
|
+
theme_color: this.pwa.themeColor,
|
|
69
|
+
background_color: this.pwa.backgroundColor,
|
|
70
|
+
scope: this.pwa.scope,
|
|
71
|
+
icons: [{
|
|
72
|
+
src: 'pwa-192x192.png',
|
|
73
|
+
sizes: '192x192',
|
|
74
|
+
type: 'image/png'
|
|
75
|
+
}, {
|
|
76
|
+
src: 'pwa-512x512.png',
|
|
77
|
+
sizes: '512x512',
|
|
78
|
+
type: 'image/png'
|
|
79
|
+
}]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Convert to plain object (for serialization)
|
|
84
|
+
*/
|
|
85
|
+
toJSON() {
|
|
86
|
+
return {
|
|
87
|
+
app: this.app,
|
|
88
|
+
build: this.build,
|
|
89
|
+
pwa: this.pwa,
|
|
90
|
+
ui: this.ui,
|
|
91
|
+
copyright: this.copyright
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a copy with overrides (returns new immutable instance)
|
|
96
|
+
*/
|
|
97
|
+
with(overrides) {
|
|
98
|
+
return new AppConfig({
|
|
99
|
+
app: {
|
|
100
|
+
...this.app,
|
|
101
|
+
...overrides.app
|
|
102
|
+
},
|
|
103
|
+
build: {
|
|
104
|
+
...this.build,
|
|
105
|
+
...overrides.build
|
|
106
|
+
},
|
|
107
|
+
pwa: {
|
|
108
|
+
...this.pwa,
|
|
109
|
+
...overrides.pwa
|
|
110
|
+
},
|
|
111
|
+
ui: {
|
|
112
|
+
...this.ui,
|
|
113
|
+
...overrides.ui
|
|
114
|
+
},
|
|
115
|
+
copyright: {
|
|
116
|
+
...this.copyright,
|
|
117
|
+
...overrides.copyright
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* QwickApps AppConfigBuilder
|
|
125
|
+
*
|
|
126
|
+
* Builder pattern for creating validated, immutable AppConfig instances.
|
|
127
|
+
* Supports fluent API and deferred validation.
|
|
128
|
+
*
|
|
129
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
130
|
+
*/
|
|
131
|
+
// Node.js imports (only available in build/development environment)
|
|
132
|
+
let fs;
|
|
133
|
+
let path;
|
|
134
|
+
try {
|
|
135
|
+
// Only import if we're in Node.js environment
|
|
136
|
+
if (typeof window === 'undefined' && typeof process !== 'undefined') {
|
|
137
|
+
fs = require('fs');
|
|
138
|
+
path = require('path');
|
|
139
|
+
}
|
|
140
|
+
} catch (error) {
|
|
141
|
+
// Browser environment - fs/path not available
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Builder for creating AppConfig instances with validation
|
|
145
|
+
*/
|
|
146
|
+
class AppConfigBuilder {
|
|
147
|
+
constructor() {
|
|
148
|
+
this.config = {
|
|
149
|
+
app: {},
|
|
150
|
+
build: {},
|
|
151
|
+
pwa: {},
|
|
152
|
+
ui: {},
|
|
153
|
+
copyright: {}
|
|
154
|
+
};
|
|
155
|
+
this.options = {};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create a new AppConfigBuilder instance
|
|
159
|
+
*/
|
|
160
|
+
static create() {
|
|
161
|
+
return new AppConfigBuilder();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Load configuration from JSON file (Node.js only)
|
|
165
|
+
*/
|
|
166
|
+
withConfig(configPath) {
|
|
167
|
+
if (!fs || !path) {
|
|
168
|
+
// Only warn in development, not in tests or production browsers
|
|
169
|
+
if (typeof window === 'undefined') {
|
|
170
|
+
console.warn('Warning: File system operations not available in browser environment');
|
|
171
|
+
}
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const fullPath = path.resolve(configPath);
|
|
176
|
+
const configData = JSON.parse(fs.readFileSync(fullPath, 'utf-8'));
|
|
177
|
+
if (configData.app) Object.assign(this.config.app, configData.app);
|
|
178
|
+
if (configData.build) Object.assign(this.config.build, configData.build);
|
|
179
|
+
if (configData.pwa) Object.assign(this.config.pwa, configData.pwa);
|
|
180
|
+
if (configData.ui) Object.assign(this.config.ui, configData.ui);
|
|
181
|
+
if (configData.copyright) Object.assign(this.config.copyright, configData.copyright);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
// Don't throw here - will be handled in build()
|
|
184
|
+
console.warn(`Warning: Could not load config file: ${configPath}`);
|
|
185
|
+
}
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Set builder options
|
|
190
|
+
*/
|
|
191
|
+
withOptions(options) {
|
|
192
|
+
this.options = {
|
|
193
|
+
...this.options,
|
|
194
|
+
...options
|
|
195
|
+
};
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
// App Identity Methods
|
|
199
|
+
withName(name) {
|
|
200
|
+
this.config.app.name = name;
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
withId(id) {
|
|
204
|
+
this.config.app.id = id;
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
withShortName(shortName) {
|
|
208
|
+
this.config.app.shortName = shortName;
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
withDescription(description) {
|
|
212
|
+
this.config.app.description = description;
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
withVersion(version) {
|
|
216
|
+
this.config.app.version = version;
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
withLogo(logo) {
|
|
220
|
+
this.config.app.logo = logo;
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
withAuthor(author) {
|
|
224
|
+
this.config.app.author = author;
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
withHomepage(homepage) {
|
|
228
|
+
this.config.app.homepage = homepage;
|
|
229
|
+
return this;
|
|
230
|
+
}
|
|
231
|
+
// Build Config Methods
|
|
232
|
+
withPort(port) {
|
|
233
|
+
this.config.build.port = port;
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
withPreviewPort(previewPort) {
|
|
237
|
+
this.config.build.previewPort = previewPort;
|
|
238
|
+
return this;
|
|
239
|
+
}
|
|
240
|
+
withOutputDir(outputDir) {
|
|
241
|
+
this.config.build.outputDir = outputDir;
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
withPublicPath(publicPath) {
|
|
245
|
+
this.config.build.publicPath = publicPath;
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
withBase(base) {
|
|
249
|
+
this.config.build.base = base;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
// PWA Config Methods
|
|
253
|
+
withThemeColor(themeColor) {
|
|
254
|
+
this.config.pwa.themeColor = themeColor;
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
withBackgroundColor(backgroundColor) {
|
|
258
|
+
this.config.pwa.backgroundColor = backgroundColor;
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
withStartUrl(startUrl) {
|
|
262
|
+
this.config.pwa.startUrl = startUrl;
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
265
|
+
withScope(scope) {
|
|
266
|
+
this.config.pwa.scope = scope;
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
withDisplay(display) {
|
|
270
|
+
this.config.pwa.display = display;
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
273
|
+
withOrientation(orientation) {
|
|
274
|
+
this.config.pwa.orientation = orientation;
|
|
275
|
+
return this;
|
|
276
|
+
}
|
|
277
|
+
// UI Config Methods
|
|
278
|
+
withDefaultTheme(defaultTheme) {
|
|
279
|
+
this.config.ui.defaultTheme = defaultTheme;
|
|
280
|
+
return this;
|
|
281
|
+
}
|
|
282
|
+
withDefaultPalette(defaultPalette) {
|
|
283
|
+
this.config.ui.defaultPalette = defaultPalette;
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
withScaffolding(enableScaffolding) {
|
|
287
|
+
this.config.ui.enableScaffolding = enableScaffolding;
|
|
288
|
+
return this;
|
|
289
|
+
}
|
|
290
|
+
withThemeSwitcher(showThemeSwitcher) {
|
|
291
|
+
this.config.ui.showThemeSwitcher = showThemeSwitcher;
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
withPaletteSwitcher(showPaletteSwitcher) {
|
|
295
|
+
this.config.ui.showPaletteSwitcher = showPaletteSwitcher;
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
// Copyright Methods
|
|
299
|
+
withCopyright(year, author, text) {
|
|
300
|
+
this.config.copyright.year = year;
|
|
301
|
+
this.config.copyright.author = author;
|
|
302
|
+
if (text !== undefined) this.config.copyright.text = text;
|
|
303
|
+
return this;
|
|
304
|
+
}
|
|
305
|
+
withCopyrightYear(year) {
|
|
306
|
+
this.config.copyright.year = year;
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
withCopyrightAuthor(author) {
|
|
310
|
+
this.config.copyright.author = author;
|
|
311
|
+
return this;
|
|
312
|
+
}
|
|
313
|
+
withCopyrightText(text) {
|
|
314
|
+
this.config.copyright.text = text;
|
|
315
|
+
return this;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Build and validate the configuration
|
|
319
|
+
*/
|
|
320
|
+
build() {
|
|
321
|
+
const validation = this.validate();
|
|
322
|
+
// Print warnings
|
|
323
|
+
validation.warnings.forEach(warning => {
|
|
324
|
+
console.warn(`⚠️ AppConfig: ${warning}`);
|
|
325
|
+
});
|
|
326
|
+
// Throw on errors
|
|
327
|
+
if (!validation.isValid) {
|
|
328
|
+
throw new Error(`AppConfig validation failed:\n${validation.errors.map(e => ` - ${e}`).join('\n')}`);
|
|
329
|
+
}
|
|
330
|
+
// Apply defaults and build
|
|
331
|
+
const completeConfig = this.applyDefaults();
|
|
332
|
+
return new AppConfig(completeConfig);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Validate the current configuration
|
|
336
|
+
*/
|
|
337
|
+
validate() {
|
|
338
|
+
const warnings = [];
|
|
339
|
+
const errors = [];
|
|
340
|
+
// Required fields validation
|
|
341
|
+
if (!this.config.app.name) errors.push('App name is required');
|
|
342
|
+
if (!this.config.app.id) errors.push('App ID is required');
|
|
343
|
+
// Copyright validation - author will be defaulted if not provided
|
|
344
|
+
if (this.config.copyright.year && this.config.copyright.year !== 'auto' && (!Number.isInteger(this.config.copyright.year) || this.config.copyright.year < 1900)) {
|
|
345
|
+
warnings.push('Copyright year should be "auto" or a valid year >= 1900');
|
|
346
|
+
}
|
|
347
|
+
// Logo file validation (warning only) - only in Node.js environment
|
|
348
|
+
if (this.config.app.logo && !this.options.skipValidation && fs && path) {
|
|
349
|
+
const logoPath = path.resolve(this.options.baseDir || process.cwd(), this.config.app.logo);
|
|
350
|
+
if (!fs.existsSync(logoPath)) {
|
|
351
|
+
warnings.push(`Logo file not found: ${this.config.app.logo} (will use default)`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// Port validation
|
|
355
|
+
if (this.config.build.port !== undefined) {
|
|
356
|
+
if (!Number.isInteger(this.config.build.port) || this.config.build.port < 1 || this.config.build.port > 65535) {
|
|
357
|
+
errors.push('Port must be a valid integer between 1 and 65535');
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (this.config.build.previewPort !== undefined) {
|
|
361
|
+
if (!Number.isInteger(this.config.build.previewPort) || this.config.build.previewPort < 1 || this.config.build.previewPort > 65535) {
|
|
362
|
+
errors.push('Preview port must be a valid integer between 1 and 65535');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
// Color validation (warnings only)
|
|
366
|
+
if (this.config.pwa.themeColor && !this.isValidColor(this.config.pwa.themeColor)) {
|
|
367
|
+
warnings.push(`Theme color may not be valid: ${this.config.pwa.themeColor}`);
|
|
368
|
+
}
|
|
369
|
+
if (this.config.pwa.backgroundColor && !this.isValidColor(this.config.pwa.backgroundColor)) {
|
|
370
|
+
warnings.push(`Background color may not be valid: ${this.config.pwa.backgroundColor}`);
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
warnings,
|
|
374
|
+
errors,
|
|
375
|
+
isValid: errors.length === 0
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Apply default values to configuration
|
|
380
|
+
*/
|
|
381
|
+
applyDefaults() {
|
|
382
|
+
const app = {
|
|
383
|
+
id: this.config.app.id,
|
|
384
|
+
name: this.config.app.name,
|
|
385
|
+
shortName: this.config.app.shortName || this.config.app.name,
|
|
386
|
+
description: this.config.app.description || this.config.app.name,
|
|
387
|
+
version: this.config.app.version || '1.0.0',
|
|
388
|
+
logo: this.config.app.logo || '/favicon.ico',
|
|
389
|
+
author: this.config.app.author,
|
|
390
|
+
homepage: this.config.app.homepage
|
|
391
|
+
};
|
|
392
|
+
const build = {
|
|
393
|
+
port: this.config.build.port || 3000,
|
|
394
|
+
previewPort: this.config.build.previewPort || 4173,
|
|
395
|
+
outputDir: this.config.build.outputDir || 'dist',
|
|
396
|
+
publicPath: this.config.build.publicPath || '/',
|
|
397
|
+
base: this.config.build.base || '/'
|
|
398
|
+
};
|
|
399
|
+
const pwa = {
|
|
400
|
+
themeColor: this.config.pwa.themeColor || '#000000',
|
|
401
|
+
backgroundColor: this.config.pwa.backgroundColor || '#ffffff',
|
|
402
|
+
startUrl: this.config.pwa.startUrl || '/',
|
|
403
|
+
scope: this.config.pwa.scope || '/',
|
|
404
|
+
display: this.config.pwa.display || 'standalone',
|
|
405
|
+
orientation: this.config.pwa.orientation
|
|
406
|
+
};
|
|
407
|
+
const ui = {
|
|
408
|
+
defaultTheme: this.config.ui.defaultTheme || 'light',
|
|
409
|
+
defaultPalette: this.config.ui.defaultPalette || 'default',
|
|
410
|
+
enableScaffolding: this.config.ui.enableScaffolding ?? true,
|
|
411
|
+
showThemeSwitcher: this.config.ui.showThemeSwitcher ?? false,
|
|
412
|
+
showPaletteSwitcher: this.config.ui.showPaletteSwitcher ?? false
|
|
413
|
+
};
|
|
414
|
+
const copyright = {
|
|
415
|
+
year: this.config.copyright.year || 'auto',
|
|
416
|
+
author: this.config.copyright.author || app.author || app.name,
|
|
417
|
+
text: this.config.copyright.text
|
|
418
|
+
};
|
|
419
|
+
return {
|
|
420
|
+
app,
|
|
421
|
+
build,
|
|
422
|
+
pwa,
|
|
423
|
+
ui,
|
|
424
|
+
copyright
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Simple color validation
|
|
429
|
+
*/
|
|
430
|
+
isValidColor(color) {
|
|
431
|
+
// Basic hex color validation
|
|
432
|
+
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(color) ||
|
|
433
|
+
// Named colors (basic check)
|
|
434
|
+
/^(black|white|red|green|blue|yellow|orange|purple|pink|gray|grey)$/i.test(color) ||
|
|
435
|
+
// RGB/RGBA
|
|
436
|
+
/^rgba?\([^)]+\)$/i.test(color);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* QwickApps Configuration Module Entry
|
|
442
|
+
*
|
|
443
|
+
* Lightweight export for config-only usage at build time.
|
|
444
|
+
* This file only exports configuration types and builders
|
|
445
|
+
* without pulling in React or MUI dependencies.
|
|
446
|
+
*
|
|
447
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
448
|
+
*/
|
|
449
|
+
const createAppConfig = AppConfigBuilder.create;
|
|
450
|
+
|
|
451
|
+
export { AppConfig, AppConfigBuilder, createAppConfig };
|