Skip to content

Commit 63500f3

Browse files
committed
fix(inherit): type generation
1 parent a620a2c commit 63500f3

File tree

5 files changed

+12
-35
lines changed

5 files changed

+12
-35
lines changed

docs/app/pages/studio/pricing.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ const columns: TableColumn<Feature>[] = [
148148
>
149149
<UColorModeImage
150150
class="size-full max-w-5xl mx-auto"
151-
:dark="page.onboarding.image.dark"
152-
:light="page.onboarding.image.light"
151+
v-bind="page.onboarding.image"
153152
alt="Onboarding steps when creating a project on Nuxt Studio"
154153
/>
155154
</UPageSection>

docs/content.config.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
import { defineContentConfig, defineCollection, property, z } from '@nuxt/content'
22

3-
const createPricingPlanSchema = () => z.object({
4-
title: z.string(),
5-
description: z.string(),
6-
price: z.string(),
7-
cycle: z.string().optional(),
8-
features: z.array(z.string()),
9-
badge: z.string().optional(),
10-
hightlight: z.boolean().optional(),
11-
button: z.object({
12-
label: z.string(),
13-
color: z.enum(['error', 'primary', 'neutral', 'secondary', 'success', 'info', 'warning']),
14-
to: z.string(),
15-
target: z.string().optional(),
16-
}),
17-
})
18-
193
const createPricingFeatureSchema = () => z.object({
204
title: z.string(),
215
plans: z.array(z.enum(['solo', 'team', 'unlimited'])).optional(),
@@ -46,15 +30,14 @@ export default defineContentConfig({
4630
onboarding: z.object({
4731
title: z.string(),
4832
image: z.object({
49-
// TODO: update editor usage to new syntax. This is kept to maintain backwards compatibility.
50-
dark: z.string().editor({ input: 'media' }),
33+
dark: property(z.string()).editor({ input: 'media' }),
5134
light: property(z.string()).editor({ input: 'media' }),
5235
}),
5336
}),
5437
plans: z.object({
55-
solo: createPricingPlanSchema(),
56-
team: createPricingPlanSchema(),
57-
unlimited: createPricingPlanSchema(),
38+
solo: property(z.object({})).inherit('@nuxt/ui-pro/runtime/components/PricingPlan.vue'),
39+
team: property(z.object({})).inherit('@nuxt/ui-pro/runtime/components/PricingPlan.vue'),
40+
unlimited: property(z.object({})).inherit('@nuxt/ui-pro/runtime/components/PricingPlan.vue'),
5841
}),
5942
features: z.object({
6043
title: z.string(),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"micromatch": "^4.0.8",
8787
"minimark": "^0.2.0",
8888
"minimatch": "^10.0.3",
89-
"nuxt-component-meta": "^0.13.1",
89+
"nuxt-component-meta": "^0.14.0",
9090
"nypm": "^0.6.1",
9191
"ohash": "^2.0.11",
9292
"pathe": "^2.0.3",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/schema/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ export function property<T extends ContentStandardSchemaV1>(input: T): Property<
6060
const value = Reflect.get(_target, prop, receiver)
6161

6262
if (typeof value === 'function') {
63-
return (...args: unknown[]) => {
64-
const result = value.apply(_target, args)
65-
// If method is chainable and returns a new schema, re-attach $content and re-wrap
66-
attachContent(result)
67-
return createProxy(result)
68-
}
63+
return (...args: unknown[]) => value.apply(_target, args)
6964
}
7065

7166
return value

0 commit comments

Comments
 (0)