@embeddables/cli 0.7.19 → 0.8.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.
|
@@ -154,13 +154,13 @@ export function PageName() {
|
|
|
154
154
|
}
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
**OptionSelector buttons pattern**: When writing TSX files with `OptionSelector` components, define the buttons as constants before the JSX, then reference them in the `buttons` prop:
|
|
157
|
+
**OptionSelector buttons pattern**: When writing TSX files with `OptionSelector` components, define the buttons as constants before the JSX, then reference them in the `buttons` prop. Use `OptionSelectorButtonWithLanguages` as the type (imported from `@embeddables/cli/components`) — this type extends `OptionSelectorButton` with an optional `languages` property, so it works for buttons both with and without translations:
|
|
158
158
|
|
|
159
159
|
```tsx
|
|
160
160
|
'use client'
|
|
161
161
|
|
|
162
162
|
import { OptionSelector } from '@embeddables/cli/components'
|
|
163
|
-
import type { OptionSelectorButton } from '@embeddables/cli/
|
|
163
|
+
import type { OptionSelectorButtonWithLanguages as OptionSelectorButton } from '@embeddables/cli/components'
|
|
164
164
|
|
|
165
165
|
const planButtons: OptionSelectorButton[] = [
|
|
166
166
|
{ id: 'button_plan_basic', key: 'basic', text: 'Basic Plan', description: '$9/month' },
|
|
@@ -187,6 +187,8 @@ export default function PlanPage() {
|
|
|
187
187
|
|
|
188
188
|
This pattern improves readability and makes the buttons array easier to maintain compared to defining it inline within the JSX.
|
|
189
189
|
|
|
190
|
+
**Important**: Always use `OptionSelectorButtonWithLanguages` (not `OptionSelectorButton` from `@embeddables/cli/types`) when declaring button constants. The alias `as OptionSelectorButton` keeps the code readable while ensuring the type supports the `languages` property for translations. This matches what the CLI generates when reverse-compiling.
|
|
191
|
+
|
|
190
192
|
## Styles Structure (CSS)
|
|
191
193
|
|
|
192
194
|
Styles are stored in `Flow.styles` as a map of CSS selectors to style objects. The `FlowStyles` type is defined in `src/types-builder.ts`.
|
|
@@ -768,11 +770,12 @@ Add a `languages` prop to any component in your `.page.tsx` or `.location.tsx` f
|
|
|
768
770
|
|
|
769
771
|
### Adding Translations to OptionSelector Buttons
|
|
770
772
|
|
|
771
|
-
For OptionSelector components, translations are added on each **button** object (not on the component itself). Add a `languages` property inside each button definition:
|
|
773
|
+
For OptionSelector components, translations are added on each **button** object (not on the component itself). Add a `languages` property inside each button definition. The `OptionSelectorButtonWithLanguages` type (not plain `OptionSelectorButton`) is required here since it includes the `languages` property:
|
|
772
774
|
|
|
773
775
|
```tsx
|
|
774
776
|
import { OptionSelector } from '@embeddables/cli/components'
|
|
775
|
-
|
|
777
|
+
|
|
778
|
+
import type { OptionSelectorButtonWithLanguages as OptionSelectorButton } from '@embeddables/cli/components'
|
|
776
779
|
|
|
777
780
|
const planButtons: OptionSelectorButton[] = [
|
|
778
781
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embeddables/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"embeddables": "./bin/embeddables.mjs"
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@supabase/supabase-js": "^2.39.0",
|
|
56
56
|
"@tailwindcss/postcss": "^4.1.18",
|
|
57
57
|
"autoprefixer": "^10.4.23",
|
|
58
|
+
"boxen": "^8.0.1",
|
|
58
59
|
"chokidar": "^3.6.0",
|
|
59
60
|
"commander": "^12.1.0",
|
|
60
61
|
"cssjson": "^2.1.3",
|
|
@@ -62,6 +63,8 @@
|
|
|
62
63
|
"express": "^4.19.2",
|
|
63
64
|
"fast-glob": "^3.3.2",
|
|
64
65
|
"http-proxy-middleware": "^3.0.3",
|
|
66
|
+
"log-symbols": "^7.0.1",
|
|
67
|
+
"ora": "^9.3.0",
|
|
65
68
|
"picocolors": "^1.1.0",
|
|
66
69
|
"postcss": "^8.5.6",
|
|
67
70
|
"prompts": "^2.4.2",
|