@notty/types 0.7.1 → 0.14.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/dist/index.js CHANGED
@@ -1,4 +1,67 @@
1
1
  // src/notty-schema.ts
2
+ var exampleComponentSchema = {
3
+ uid: "shared.seo-meta",
4
+ category: "shared",
5
+ info: {
6
+ displayName: "SEO Meta",
7
+ description: "SEO metadata for pages",
8
+ icon: "mdi:search-web"
9
+ },
10
+ attributes: {
11
+ metaTitle: {
12
+ type: "string",
13
+ maxLength: 60
14
+ },
15
+ metaDescription: {
16
+ type: "text",
17
+ maxLength: 160
18
+ },
19
+ keywords: {
20
+ type: "string",
21
+ maxLength: 255
22
+ },
23
+ canonicalUrl: {
24
+ type: "string",
25
+ maxLength: 500
26
+ },
27
+ ogImage: {
28
+ type: "media",
29
+ allowedTypes: ["images"],
30
+ multiple: false
31
+ }
32
+ }
33
+ };
34
+ var exampleBlockComponent = {
35
+ uid: "blocks.hero-section",
36
+ category: "blocks",
37
+ info: {
38
+ displayName: "Hero Section",
39
+ description: "Hero banner with title and CTA",
40
+ icon: "mdi:view-dashboard"
41
+ },
42
+ attributes: {
43
+ title: {
44
+ type: "string",
45
+ required: true,
46
+ maxLength: 100
47
+ },
48
+ subtitle: {
49
+ type: "text"
50
+ },
51
+ backgroundImage: {
52
+ type: "media",
53
+ allowedTypes: ["images"]
54
+ },
55
+ ctaText: {
56
+ type: "string",
57
+ maxLength: 50
58
+ },
59
+ ctaLink: {
60
+ type: "string",
61
+ maxLength: 500
62
+ }
63
+ }
64
+ };
2
65
  var exampleSchema = {
3
66
  kind: "collectionType",
4
67
  info: {
@@ -45,13 +108,30 @@ var exampleSchema = {
45
108
  type: "media",
46
109
  allowedTypes: ["images"],
47
110
  multiple: false
48
- // single image
49
111
  },
50
112
  gallery: {
51
113
  type: "media",
52
114
  allowedTypes: ["images", "videos"],
53
115
  multiple: true
54
- // multiple media
116
+ },
117
+ // Component field example - single SEO meta
118
+ seo: {
119
+ type: "component",
120
+ component: "shared.seo-meta",
121
+ repeatable: false
122
+ },
123
+ // Component field example - repeatable FAQ items
124
+ faq: {
125
+ type: "component",
126
+ component: "shared.faq-item",
127
+ repeatable: true,
128
+ min: 0,
129
+ max: 20
130
+ },
131
+ // Dynamic zone example - page builder blocks
132
+ blocks: {
133
+ type: "dynamicZone",
134
+ components: ["blocks.hero-section", "blocks.rich-text", "blocks.gallery", "blocks.cta"]
55
135
  }
56
136
  }
57
137
  };
@@ -64,7 +144,38 @@ var SchemaValidationError = class extends Error {
64
144
  this.name = "SchemaValidationError";
65
145
  }
66
146
  };
147
+
148
+ // src/middleware.ts
149
+ function defineAdminMiddleware(definition) {
150
+ return {
151
+ _type: "admin",
152
+ order: 100,
153
+ enabled: true,
154
+ ...definition
155
+ };
156
+ }
157
+ function defineContentMiddleware(definition) {
158
+ return {
159
+ _type: "content",
160
+ order: 100,
161
+ enabled: true,
162
+ ...definition
163
+ };
164
+ }
165
+ function defineSystemMiddleware(definition) {
166
+ return {
167
+ _type: "system",
168
+ order: 100,
169
+ enabled: true,
170
+ ...definition
171
+ };
172
+ }
67
173
  export {
68
174
  SchemaValidationError,
175
+ defineAdminMiddleware,
176
+ defineContentMiddleware,
177
+ defineSystemMiddleware,
178
+ exampleBlockComponent,
179
+ exampleComponentSchema,
69
180
  exampleSchema
70
181
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notty/types",
3
- "version": "0.7.1",
3
+ "version": "0.14.0",
4
4
  "description": "Shared TypeScript types for Notty CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",