@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.cjs +118 -2
- package/dist/index.d.cts +1179 -5
- package/dist/index.d.ts +1179 -5
- package/dist/index.js +113 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21,11 +21,79 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
SchemaValidationError: () => SchemaValidationError,
|
|
24
|
+
defineAdminMiddleware: () => defineAdminMiddleware,
|
|
25
|
+
defineContentMiddleware: () => defineContentMiddleware,
|
|
26
|
+
defineSystemMiddleware: () => defineSystemMiddleware,
|
|
27
|
+
exampleBlockComponent: () => exampleBlockComponent,
|
|
28
|
+
exampleComponentSchema: () => exampleComponentSchema,
|
|
24
29
|
exampleSchema: () => exampleSchema
|
|
25
30
|
});
|
|
26
31
|
module.exports = __toCommonJS(index_exports);
|
|
27
32
|
|
|
28
33
|
// src/notty-schema.ts
|
|
34
|
+
var exampleComponentSchema = {
|
|
35
|
+
uid: "shared.seo-meta",
|
|
36
|
+
category: "shared",
|
|
37
|
+
info: {
|
|
38
|
+
displayName: "SEO Meta",
|
|
39
|
+
description: "SEO metadata for pages",
|
|
40
|
+
icon: "mdi:search-web"
|
|
41
|
+
},
|
|
42
|
+
attributes: {
|
|
43
|
+
metaTitle: {
|
|
44
|
+
type: "string",
|
|
45
|
+
maxLength: 60
|
|
46
|
+
},
|
|
47
|
+
metaDescription: {
|
|
48
|
+
type: "text",
|
|
49
|
+
maxLength: 160
|
|
50
|
+
},
|
|
51
|
+
keywords: {
|
|
52
|
+
type: "string",
|
|
53
|
+
maxLength: 255
|
|
54
|
+
},
|
|
55
|
+
canonicalUrl: {
|
|
56
|
+
type: "string",
|
|
57
|
+
maxLength: 500
|
|
58
|
+
},
|
|
59
|
+
ogImage: {
|
|
60
|
+
type: "media",
|
|
61
|
+
allowedTypes: ["images"],
|
|
62
|
+
multiple: false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var exampleBlockComponent = {
|
|
67
|
+
uid: "blocks.hero-section",
|
|
68
|
+
category: "blocks",
|
|
69
|
+
info: {
|
|
70
|
+
displayName: "Hero Section",
|
|
71
|
+
description: "Hero banner with title and CTA",
|
|
72
|
+
icon: "mdi:view-dashboard"
|
|
73
|
+
},
|
|
74
|
+
attributes: {
|
|
75
|
+
title: {
|
|
76
|
+
type: "string",
|
|
77
|
+
required: true,
|
|
78
|
+
maxLength: 100
|
|
79
|
+
},
|
|
80
|
+
subtitle: {
|
|
81
|
+
type: "text"
|
|
82
|
+
},
|
|
83
|
+
backgroundImage: {
|
|
84
|
+
type: "media",
|
|
85
|
+
allowedTypes: ["images"]
|
|
86
|
+
},
|
|
87
|
+
ctaText: {
|
|
88
|
+
type: "string",
|
|
89
|
+
maxLength: 50
|
|
90
|
+
},
|
|
91
|
+
ctaLink: {
|
|
92
|
+
type: "string",
|
|
93
|
+
maxLength: 500
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
29
97
|
var exampleSchema = {
|
|
30
98
|
kind: "collectionType",
|
|
31
99
|
info: {
|
|
@@ -72,13 +140,30 @@ var exampleSchema = {
|
|
|
72
140
|
type: "media",
|
|
73
141
|
allowedTypes: ["images"],
|
|
74
142
|
multiple: false
|
|
75
|
-
// single image
|
|
76
143
|
},
|
|
77
144
|
gallery: {
|
|
78
145
|
type: "media",
|
|
79
146
|
allowedTypes: ["images", "videos"],
|
|
80
147
|
multiple: true
|
|
81
|
-
|
|
148
|
+
},
|
|
149
|
+
// Component field example - single SEO meta
|
|
150
|
+
seo: {
|
|
151
|
+
type: "component",
|
|
152
|
+
component: "shared.seo-meta",
|
|
153
|
+
repeatable: false
|
|
154
|
+
},
|
|
155
|
+
// Component field example - repeatable FAQ items
|
|
156
|
+
faq: {
|
|
157
|
+
type: "component",
|
|
158
|
+
component: "shared.faq-item",
|
|
159
|
+
repeatable: true,
|
|
160
|
+
min: 0,
|
|
161
|
+
max: 20
|
|
162
|
+
},
|
|
163
|
+
// Dynamic zone example - page builder blocks
|
|
164
|
+
blocks: {
|
|
165
|
+
type: "dynamicZone",
|
|
166
|
+
components: ["blocks.hero-section", "blocks.rich-text", "blocks.gallery", "blocks.cta"]
|
|
82
167
|
}
|
|
83
168
|
}
|
|
84
169
|
};
|
|
@@ -91,8 +176,39 @@ var SchemaValidationError = class extends Error {
|
|
|
91
176
|
this.name = "SchemaValidationError";
|
|
92
177
|
}
|
|
93
178
|
};
|
|
179
|
+
|
|
180
|
+
// src/middleware.ts
|
|
181
|
+
function defineAdminMiddleware(definition) {
|
|
182
|
+
return {
|
|
183
|
+
_type: "admin",
|
|
184
|
+
order: 100,
|
|
185
|
+
enabled: true,
|
|
186
|
+
...definition
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function defineContentMiddleware(definition) {
|
|
190
|
+
return {
|
|
191
|
+
_type: "content",
|
|
192
|
+
order: 100,
|
|
193
|
+
enabled: true,
|
|
194
|
+
...definition
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function defineSystemMiddleware(definition) {
|
|
198
|
+
return {
|
|
199
|
+
_type: "system",
|
|
200
|
+
order: 100,
|
|
201
|
+
enabled: true,
|
|
202
|
+
...definition
|
|
203
|
+
};
|
|
204
|
+
}
|
|
94
205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
206
|
0 && (module.exports = {
|
|
96
207
|
SchemaValidationError,
|
|
208
|
+
defineAdminMiddleware,
|
|
209
|
+
defineContentMiddleware,
|
|
210
|
+
defineSystemMiddleware,
|
|
211
|
+
exampleBlockComponent,
|
|
212
|
+
exampleComponentSchema,
|
|
97
213
|
exampleSchema
|
|
98
214
|
});
|