From 62980e59965455cecb28a4e1516134c1a279f18b Mon Sep 17 00:00:00 2001 From: Konstantin Beskrovnyi Date: Tue, 10 Oct 2023 00:32:12 +0300 Subject: [PATCH] fix --- configuration-guide.md | 78 +++++++++---------- examples/ai/src/config.ts | 2 +- examples/ai/src/custom/ActionSlide.vue | 15 ++-- examples/tales/src/config.ts | 2 +- packages/generation/README.md | 2 +- packages/generation/bootstrap.ts | 6 +- .../DrawPreset.vue} | 4 +- .../components/DrawPreset/README.md | 6 ++ .../generation/components/DrawPreset/index.ts | 1 + .../components/DrawPresset/README.md | 6 -- .../components/DrawPresset/index.ts | 1 - .../components/ListItem/ListItem.props.ts | 4 +- .../components/ListItem/ListItem.vue | 4 +- .../generation/components/Media/Emodji.vue | 4 +- packages/generation/components/Media/Icon.vue | 4 +- .../generation/components/Media/Image.vue | 4 +- ...presset.props.ts => Media.preset.props.ts} | 22 +++--- .../{Media.presset.vue => Media.preset.vue} | 6 +- .../generation/components/Media/README.md | 2 +- .../generation/components/Media/Sticker.vue | 4 +- .../{VideoPresset.vue => VideoPreset.vue} | 4 +- packages/generation/components/Media/index.ts | 4 +- .../components/Media/useLoadedImage.ts | 2 +- .../components/PaywallPopup/PaywallPopup.vue | 4 +- .../components/PaywallPopup/README.md | 2 +- .../PrimitivePaywall/PrimitivePaywall.vue | 6 +- .../components/PrimitivePaywall/README.md | 4 +- .../PrimitiveSlide/PrimitiveSlide.vue | 4 +- .../components/PrimitiveSlide/README.md | 2 +- packages/generation/components/README.md | 2 +- packages/generation/defineConfig.ts | 18 ++--- packages/generation/plugins/README.md | 2 +- .../definePresets/DefinePresets.plugin.ts | 14 ++++ .../generation/plugins/definePresets/index.ts | 1 + .../definePressets/DefinePressets.plugin.ts | 14 ---- .../plugins/definePressets/index.ts | 1 - .../{pressets => presets}/README.md | 2 +- .../{pressets => presets}/Route.vue | 4 +- .../{pressets => presets}/base/README.md | 6 +- .../base/base.preset.props.ts} | 4 +- .../base/base.preset.vue} | 13 ++-- packages/generation/presets/base/index.ts | 2 + .../{pressets => presets}/form/README.md | 6 +- .../form/form.preset.props.ts} | 4 +- .../form/form.preset.vue} | 17 ++-- packages/generation/presets/form/index.ts | 2 + .../paywall/BaseProduct.vue | 2 +- .../{pressets => presets}/paywall/README.md | 6 +- packages/generation/presets/paywall/index.ts | 2 + .../presets/paywall/paywall.preset.props.ts | 7 ++ .../paywall/paywall.preset.vue} | 10 +-- .../paywall_row/Product.vue | 2 +- .../paywall_row/README.md | 6 +- .../generation/presets/paywall_row/index.ts | 2 + .../paywall_row/paywall_row.preset.props.ts} | 4 +- .../paywall_row/paywall_row.preset.vue} | 10 +-- .../presets/paywall_single/README.md | 12 +++ .../presets/paywall_single/index.ts | 2 + .../paywall_single.preset.props.ts} | 4 +- .../paywall_single/paywall_single.preset.vue} | 14 ++-- .../{pressets => presets}/slide/README.md | 6 +- packages/generation/presets/slide/index.ts | 2 + .../slide/slide.preset.props.ts} | 4 +- .../slide/slide.preset.vue} | 10 +-- packages/generation/pressets/base/index.ts | 2 - packages/generation/pressets/form/index.ts | 2 - packages/generation/pressets/paywall/index.ts | 2 - .../pressets/paywall/paywall.presset.props.ts | 7 -- .../generation/pressets/paywall_row/index.ts | 2 - .../pressets/paywall_single/README.md | 12 --- .../pressets/paywall_single/index.ts | 2 - packages/generation/pressets/slide/index.ts | 2 - packages/generation/tokens/README.md | 4 +- .../generation/tokens/definedPresets.token.ts | 34 ++++++++ .../tokens/definedPressets.token.ts | 34 -------- packages/generation/tokens/index.ts | 2 +- packages/generation/use/README.md | 4 +- 77 files changed, 263 insertions(+), 272 deletions(-) rename packages/generation/components/{DrawPresset/DrawPresset.vue => DrawPreset/DrawPreset.vue} (73%) create mode 100644 packages/generation/components/DrawPreset/README.md create mode 100644 packages/generation/components/DrawPreset/index.ts delete mode 100644 packages/generation/components/DrawPresset/README.md delete mode 100644 packages/generation/components/DrawPresset/index.ts rename packages/generation/components/Media/{Media.presset.props.ts => Media.preset.props.ts} (79%) rename packages/generation/components/Media/{Media.presset.vue => Media.preset.vue} (77%) rename packages/generation/components/Media/{VideoPresset.vue => VideoPreset.vue} (96%) create mode 100644 packages/generation/plugins/definePresets/DefinePresets.plugin.ts create mode 100644 packages/generation/plugins/definePresets/index.ts delete mode 100644 packages/generation/plugins/definePressets/DefinePressets.plugin.ts delete mode 100644 packages/generation/plugins/definePressets/index.ts rename packages/generation/{pressets => presets}/README.md (99%) rename packages/generation/{pressets => presets}/Route.vue (71%) rename packages/generation/{pressets => presets}/base/README.md (69%) rename packages/generation/{pressets/base/base.presset.props.ts => presets/base/base.preset.props.ts} (52%) rename packages/generation/{pressets/base/base.presset.vue => presets/base/base.preset.vue} (88%) create mode 100644 packages/generation/presets/base/index.ts rename packages/generation/{pressets => presets}/form/README.md (77%) rename packages/generation/{pressets/form/form.presset.props.ts => presets/form/form.preset.props.ts} (68%) rename packages/generation/{pressets/form/form.presset.vue => presets/form/form.preset.vue} (85%) create mode 100644 packages/generation/presets/form/index.ts rename packages/generation/{pressets => presets}/paywall/BaseProduct.vue (96%) rename packages/generation/{pressets => presets}/paywall/README.md (53%) create mode 100644 packages/generation/presets/paywall/index.ts create mode 100644 packages/generation/presets/paywall/paywall.preset.props.ts rename packages/generation/{pressets/paywall/paywall.presset.vue => presets/paywall/paywall.preset.vue} (90%) rename packages/generation/{pressets => presets}/paywall_row/Product.vue (96%) rename packages/generation/{pressets => presets}/paywall_row/README.md (60%) create mode 100644 packages/generation/presets/paywall_row/index.ts rename packages/generation/{pressets/paywall_row/paywall_row.presset.props.ts => presets/paywall_row/paywall_row.preset.props.ts} (64%) rename packages/generation/{pressets/paywall_row/paywall_row.presset.vue => presets/paywall_row/paywall_row.preset.vue} (92%) create mode 100644 packages/generation/presets/paywall_single/README.md create mode 100644 packages/generation/presets/paywall_single/index.ts rename packages/generation/{pressets/paywall_single/paywall_single.presset.props.ts => presets/paywall_single/paywall_single.preset.props.ts} (75%) rename packages/generation/{pressets/paywall_single/paywall_single.presset.vue => presets/paywall_single/paywall_single.preset.vue} (84%) rename packages/generation/{pressets => presets}/slide/README.md (65%) create mode 100644 packages/generation/presets/slide/index.ts rename packages/generation/{pressets/slide/slide.presset.props.ts => presets/slide/slide.preset.props.ts} (81%) rename packages/generation/{pressets/slide/slide.presset.vue => presets/slide/slide.preset.vue} (92%) delete mode 100644 packages/generation/pressets/base/index.ts delete mode 100644 packages/generation/pressets/form/index.ts delete mode 100644 packages/generation/pressets/paywall/index.ts delete mode 100644 packages/generation/pressets/paywall/paywall.presset.props.ts delete mode 100644 packages/generation/pressets/paywall_row/index.ts delete mode 100644 packages/generation/pressets/paywall_single/README.md delete mode 100644 packages/generation/pressets/paywall_single/index.ts delete mode 100644 packages/generation/pressets/slide/index.ts create mode 100644 packages/generation/tokens/definedPresets.token.ts delete mode 100644 packages/generation/tokens/definedPressets.token.ts diff --git a/configuration-guide.md b/configuration-guide.md index f097e5a..310e601 100644 --- a/configuration-guide.md +++ b/configuration-guide.md @@ -1,11 +1,11 @@ # Configuration Guide 1. [DefineConfig and Bootstrap](#defineconfig-and-bootstrap) -2. [Pressets](#pressets) +2. [Presets](#presets) - [base](#base) - [slide](#slide) - [Standalone Page](#standalone-page) - - [Inside base.presset](#inside-basepresset) + - [Inside base.preset](#inside-basepreset) - Parameters - [Title](#title-required) - [Button](#button-required) @@ -46,7 +46,7 @@ 6. [Currency Config](#currency-config) 7. [Localization](#localization) 8. [Currency localization](#currency-localization) -9. [Custom Pressets](#custom-pressets) +9. [Custom Presets](#custom-presets) # DefineConfig and Bootstrap @@ -57,7 +57,7 @@ The structure of your configuration: ```ts export default defineConfig({ // [Required]. App pages configuration. - // More info in the "Pressets" section + // More info in the "Presets" section pages: [...], // [Optional]. Theme configuration. @@ -72,13 +72,13 @@ export default defineConfig({ // More information in the "Currency Config" section currencyConfig: {}, - // [Optional]. custom pressets configuration - // More info in the "Custom Pressets" section - definePressets: {}, + // [Optional]. custom presets configuration + // More info in the "Custom Presets" section + definePresets: {}, }); ``` -# Pressets +# Presets In the `pages` section of your configuration file, you can extend our presets with the following code: @@ -110,7 +110,7 @@ You can see all available extensions in the examples below } ``` -[Link to the component](./packages/generation/pressets/base/README.md) +[Link to the component](./packages/generation/presets/base/README.md) This is the main preset of your application, representing a [Carousel](./packages/ui/components/Carousel/README.md). You can use it without defining an extends keyword. We will automatically resolve this preset **only for root elements** inside the pages section @@ -126,7 +126,7 @@ export default defineConfig({ }); ``` -The only required parameter for this `base.presset` is `slides`, which takes an array of other presets. +The only required parameter for this `base.preset` is `slides`, which takes an array of other presets. ```ts export default defineConfig({ @@ -148,7 +148,7 @@ export default defineConfig({ }); ``` -By default, if there is no `extends` keyword inside the `slides`, the `Base` will use [slide presset](#slide) +By default, if there is no `extends` keyword inside the `slides`, the `Base` will use [slide preset](#slide) So, this is valid config for this case: @@ -176,9 +176,9 @@ export default defineConfig({ } ``` -[Link to the component](./packages/generation/pressets/slide/README.md) +[Link to the component](./packages/generation/presets/slide/README.md) -This presset can be used as a standalone page or inside [base.presset](#base) +This preset can be used as a standalone page or inside [base.preset](#base) ### Standalone page @@ -193,13 +193,13 @@ export default defineConfig({ }); ``` -### Inside base.presset +### Inside base.preset -Refer to the examples above for [base.presset](#base) +Refer to the examples above for [base.preset](#base) ### Parameters -The examples below are for standalone page usage. The same configuration can be used for a slide inside [base.presset](#base). +The examples below are for standalone page usage. The same configuration can be used for a slide inside [base.preset](#base). And `Button` will be shown only inside Telegram @@ -302,7 +302,7 @@ export default defineConfig({
With the code above you will get this result: -Keep in mind that all media pressets with `type="image"` by default will be with aspect-ratio: 1/1 +Keep in mind that all media presets with `type="image"` by default will be with aspect-ratio: 1/1 ![preview](./docs/images/slide_media.png) @@ -377,7 +377,7 @@ export default defineConfig({ ### Pagination [Optional] -If you are using the [slide.presset](#slide) inside slides in [base.presset](#base), you can use the `pagination` parameter to show the counter on the page. If it's not inside [base.presset](#base), pagination won't be displayed. +If you are using the [slide.preset](#slide) inside slides in [base.preset](#base), you can use the `pagination` parameter to show the counter on the page. If it's not inside [base.preset](#base), pagination won't be displayed. ```ts export default defineConfig({ @@ -563,9 +563,9 @@ export default defineConfig({ } ``` -[Link to the component](./packages/generation/pressets/form/README.md) +[Link to the component](./packages/generation/presets/form/README.md) -This preset supports all the parameters from the [slide](#slide) and adds a new one: `form`. +This preset supports all parameters from the [slide](#slide) and introduces new ones: `form`. ### Parameters @@ -650,11 +650,11 @@ export default defineConfig({ } ``` -[Link to the component](./packages/generation/pressets/paywall/README.md) +[Link to the component](./packages/generation/presets/paywall/README.md) The currency can be customized. [See these examples](#currency-config). -This preset supports all the parameters except `button` from the [slide](#slide) and adds new ones: +This preset supports all parameters except `button` from the [slide](#slide) and introduces new ones: ### Parameters @@ -671,7 +671,7 @@ export default defineConfig({ { id: 'id1', title: 'Title', - // you can show price instead of description with this "trick" + // You can display the price instead of the description using this "trick" description: '', price: 10, }, @@ -738,7 +738,7 @@ export default defineConfig({ By default will be with "Continue" text -You can show price inside main button text with this config: +You can display the price inside the main button like this: ```ts export default defineConfig({ @@ -772,7 +772,7 @@ By default will be show our predefinned popup By default: 'telegram' -You can tell that you want to show only web popup with this parameter: +You can specify this parameter to indicate your preference for displaying only web popups ```ts export default defineConfig({ @@ -963,9 +963,9 @@ export default defineConfig({ } ``` -[Link to the component](./packages/generation/pressets/paywall_single/README.md) +[Link to the component](./packages/generation/presets/paywall_single/README.md) -This preset supports all the parameters except `products` from the [paywall](#paywall) and add new once: +This preset supports all parameters (except `products`) from the [paywall](#paywall) and add new one: ### Parameters @@ -997,7 +997,7 @@ export default defineConfig({
-And you can add some media for your product: +You can also include some [media](#media) for your product ```ts export default defineConfig({ @@ -1038,9 +1038,9 @@ export default defineConfig({ } ``` -[Link to the component](./packages/generation/pressets/paywall_row/README.md) +[Link to the component](./packages/generation/presets/paywall_row/README.md) -This preset supports all the parameters from the [paywall](#paywall) but overrides products: +This preset supports all parameters from the [paywall](#paywall) but **overrides products**: ### Parameters @@ -1277,7 +1277,7 @@ Styles by default: # Button Actions -You can specify button action behavior inside [slide.presset](#slide). +You can specify button action behavior inside [slide.preset](#slide). It will be shown as text with the default behavior of navigating to the next slide if possible. > [!NOTE] @@ -1487,7 +1487,7 @@ export default defineConfig({ }); ``` -# Custom Pressets +# Custom Presets > [!NOTE] > Try to avoid using reserved preset names above. @@ -1499,17 +1499,17 @@ You can define custom presets if you want to using the following code: ```ts // this will be inside intial bundle -import CustomPresset from './CustomPresset.vue'; +import CustomPreset from './CustomPreset.vue'; -// this will be loaded asynchronously when such presset will be shown -const AsyncCustomPresset = defineAsyncComponent( - () => import('./CustomPresset.vue') +// this will be loaded asynchronously when such preset will be shown +const AsyncCustomPreset = defineAsyncComponent( + () => import('./CustomPreset.vue') ); export default defineConfig({ - definePressets: { - your_custom_name: CustomPresset, - async_your_custom_name: AsyncCustomPresset, + definePresets: { + your_custom_name: CustomPreset, + async_your_custom_name: AsyncCustomPreset, }, // and use them as: pages: [ diff --git a/examples/ai/src/config.ts b/examples/ai/src/config.ts index 8cf269f..d4453c1 100644 --- a/examples/ai/src/config.ts +++ b/examples/ai/src/config.ts @@ -7,7 +7,7 @@ const imageStyle = export default defineConfig({ theme: 'dark', - definePressets: { + definePresets: { action_slide: ActionSlide, }, currencyConfig: { diff --git a/examples/ai/src/custom/ActionSlide.vue b/examples/ai/src/custom/ActionSlide.vue index 4f6169b..727a055 100644 --- a/examples/ai/src/custom/ActionSlide.vue +++ b/examples/ai/src/custom/ActionSlide.vue @@ -1,5 +1,5 @@ diff --git a/packages/generation/components/Media/README.md b/packages/generation/components/Media/README.md index 6a4f7ff..2c4344a 100644 --- a/packages/generation/components/Media/README.md +++ b/packages/generation/components/Media/README.md @@ -5,7 +5,7 @@ This component supports 5 different types of media: -1. [Video](./VideoPresset.vue) +1. [Video](./VideoPreset.vue) 2. [Image](./Image.vue) 3. [Icon](./Icon.vue) 4. [Emodji](./Emodji.vue) diff --git a/packages/generation/components/Media/Sticker.vue b/packages/generation/components/Media/Sticker.vue index 0a2c30b..be613c1 100644 --- a/packages/generation/components/Media/Sticker.vue +++ b/packages/generation/components/Media/Sticker.vue @@ -13,14 +13,14 @@