@cogenta/widgets 0.2.3

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.
@@ -0,0 +1,194 @@
1
+ import { z } from 'zod';
2
+ export declare const WIDGET_SETTINGS: {
3
+ readonly text: z.ZodObject<{
4
+ body: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ _key: z.ZodString;
6
+ _type: z.ZodLiteral<"block">;
7
+ style: z.ZodEnum<{
8
+ blockquote: "blockquote";
9
+ h2: "h2";
10
+ h3: "h3";
11
+ h4: "h4";
12
+ normal: "normal";
13
+ }>;
14
+ listItem: z.ZodOptional<z.ZodEnum<{
15
+ bullet: "bullet";
16
+ number: "number";
17
+ }>>;
18
+ level: z.ZodOptional<z.ZodNumber>;
19
+ children: z.ZodArray<z.ZodObject<{
20
+ _key: z.ZodString;
21
+ _type: z.ZodLiteral<"span">;
22
+ text: z.ZodString;
23
+ marks: z.ZodDefault<z.ZodArray<z.ZodString>>;
24
+ }, z.core.$strict>>;
25
+ markDefs: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
26
+ _key: z.ZodString;
27
+ _type: z.ZodLiteral<"link">;
28
+ href: z.ZodString;
29
+ rel: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ _key: z.ZodString;
32
+ _type: z.ZodLiteral<"internalLink">;
33
+ collection: z.ZodString;
34
+ id: z.ZodString;
35
+ }, z.core.$strict>], "_type">>>;
36
+ }, z.core.$strict>, z.ZodObject<{
37
+ _key: z.ZodString;
38
+ _type: z.ZodLiteral<"media">;
39
+ id: z.ZodString;
40
+ caption: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ _key: z.ZodString;
43
+ _type: z.ZodLiteral<"hr">;
44
+ }, z.core.$strict>], "_type">>;
45
+ }, z.core.$strict>;
46
+ readonly image: z.ZodObject<{
47
+ media: z.ZodString;
48
+ alt: z.ZodDefault<z.ZodString>;
49
+ caption: z.ZodDefault<z.ZodString>;
50
+ href: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strict>;
52
+ readonly gallery: z.ZodObject<{
53
+ media: z.ZodArray<z.ZodString>;
54
+ columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>>;
55
+ }, z.core.$strict>;
56
+ readonly embed: z.ZodObject<{
57
+ url: z.ZodString;
58
+ caption: z.ZodDefault<z.ZodString>;
59
+ }, z.core.$strict>;
60
+ readonly quote: z.ZodObject<{
61
+ text: z.ZodString;
62
+ attribution: z.ZodDefault<z.ZodString>;
63
+ role: z.ZodDefault<z.ZodString>;
64
+ }, z.core.$strict>;
65
+ readonly cta: z.ZodObject<{
66
+ heading: z.ZodString;
67
+ body: z.ZodDefault<z.ZodString>;
68
+ label: z.ZodString;
69
+ href: z.ZodString;
70
+ }, z.core.$strict>;
71
+ readonly links: z.ZodObject<{
72
+ items: z.ZodArray<z.ZodObject<{
73
+ label: z.ZodString;
74
+ href: z.ZodString;
75
+ newTab: z.ZodDefault<z.ZodBoolean>;
76
+ }, z.core.$strict>>;
77
+ }, z.core.$strict>;
78
+ readonly contact: z.ZodObject<{
79
+ address: z.ZodDefault<z.ZodString>;
80
+ phone: z.ZodDefault<z.ZodString>;
81
+ email: z.ZodDefault<z.ZodString>;
82
+ hours: z.ZodDefault<z.ZodArray<z.ZodObject<{
83
+ label: z.ZodString;
84
+ value: z.ZodString;
85
+ }, z.core.$strict>>>;
86
+ }, z.core.$strict>;
87
+ readonly about: z.ZodObject<{
88
+ media: z.ZodOptional<z.ZodString>;
89
+ heading: z.ZodDefault<z.ZodString>;
90
+ body: z.ZodString;
91
+ link: z.ZodOptional<z.ZodObject<{
92
+ label: z.ZodString;
93
+ href: z.ZodString;
94
+ newTab: z.ZodDefault<z.ZodBoolean>;
95
+ }, z.core.$strict>>;
96
+ }, z.core.$strict>;
97
+ readonly recentEntries: z.ZodObject<{
98
+ collection: z.ZodString;
99
+ count: z.ZodDefault<z.ZodNumber>;
100
+ showDate: z.ZodDefault<z.ZodBoolean>;
101
+ showExcerpt: z.ZodDefault<z.ZodBoolean>;
102
+ showImage: z.ZodDefault<z.ZodBoolean>;
103
+ taxonomy: z.ZodOptional<z.ZodString>;
104
+ termId: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strict>;
106
+ readonly relatedEntries: z.ZodObject<{
107
+ count: z.ZodDefault<z.ZodNumber>;
108
+ showDate: z.ZodDefault<z.ZodBoolean>;
109
+ showImage: z.ZodDefault<z.ZodBoolean>;
110
+ }, z.core.$strict>;
111
+ readonly popularEntries: z.ZodObject<{
112
+ collection: z.ZodOptional<z.ZodString>;
113
+ count: z.ZodDefault<z.ZodNumber>;
114
+ days: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>, z.ZodLiteral<365>]>>;
115
+ showImage: z.ZodDefault<z.ZodBoolean>;
116
+ }, z.core.$strict>;
117
+ readonly terms: z.ZodObject<{
118
+ taxonomy: z.ZodString;
119
+ showCounts: z.ZodDefault<z.ZodBoolean>;
120
+ hierarchical: z.ZodDefault<z.ZodBoolean>;
121
+ hideEmpty: z.ZodDefault<z.ZodBoolean>;
122
+ display: z.ZodDefault<z.ZodEnum<{
123
+ dropdown: "dropdown";
124
+ list: "list";
125
+ }>>;
126
+ }, z.core.$strict>;
127
+ readonly tagCloud: z.ZodObject<{
128
+ taxonomy: z.ZodString;
129
+ maxTerms: z.ZodDefault<z.ZodNumber>;
130
+ showCounts: z.ZodDefault<z.ZodBoolean>;
131
+ }, z.core.$strict>;
132
+ readonly archives: z.ZodObject<{
133
+ collection: z.ZodString;
134
+ granularity: z.ZodDefault<z.ZodEnum<{
135
+ month: "month";
136
+ year: "year";
137
+ }>>;
138
+ showCounts: z.ZodDefault<z.ZodBoolean>;
139
+ display: z.ZodDefault<z.ZodEnum<{
140
+ dropdown: "dropdown";
141
+ list: "list";
142
+ }>>;
143
+ limit: z.ZodDefault<z.ZodNumber>;
144
+ }, z.core.$strict>;
145
+ readonly recentComments: z.ZodObject<{
146
+ count: z.ZodDefault<z.ZodNumber>;
147
+ }, z.core.$strict>;
148
+ readonly search: z.ZodObject<{
149
+ placeholder: z.ZodDefault<z.ZodString>;
150
+ }, z.core.$strict>;
151
+ readonly menu: z.ZodObject<{
152
+ menuId: z.ZodString;
153
+ }, z.core.$strict>;
154
+ readonly social: z.ZodObject<{
155
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
156
+ label: z.ZodString;
157
+ href: z.ZodString;
158
+ newTab: z.ZodDefault<z.ZodBoolean>;
159
+ }, z.core.$strict>>>;
160
+ }, z.core.$strict>;
161
+ readonly form: z.ZodObject<{
162
+ form: z.ZodString;
163
+ }, z.core.$strict>;
164
+ readonly toc: z.ZodObject<{
165
+ maxDepth: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>>;
166
+ }, z.core.$strict>;
167
+ readonly calendar: z.ZodObject<{
168
+ collection: z.ZodString;
169
+ }, z.core.$strict>;
170
+ };
171
+ export type WidgetType = keyof typeof WIDGET_SETTINGS;
172
+ export declare const WIDGET_TYPES: readonly WidgetType[];
173
+ export type WidgetSettings<T extends WidgetType> = z.infer<(typeof WIDGET_SETTINGS)[T]>;
174
+ /** Widgets whose content comes from the site at render time rather than from their settings. */
175
+ export declare const DYNAMIC_WIDGET_TYPES: ReadonlySet<WidgetType>;
176
+ /** Widgets that only mean something beside one entry (they read the page being shown). */
177
+ export declare const ENTRY_WIDGET_TYPES: ReadonlySet<WidgetType>;
178
+ export declare function isWidgetType(value: unknown): value is WidgetType;
179
+ /**
180
+ * Widget types a site's plugins add to the closed vocabulary above (L32 step
181
+ * 4), as `type` → the schema its settings must satisfy.
182
+ *
183
+ * Passed in rather than registered globally: this package validates, it does
184
+ * not discover. The host loads the plugins, builds the schemas, and hands the
185
+ * map to the store — the same direction the block registry already runs in.
186
+ */
187
+ export type ExtraWidgetTypes = ReadonlyMap<string, z.ZodType<Record<string, unknown>>>;
188
+ /**
189
+ * Validates and normalises a widget's settings: defaults filled in, unknown
190
+ * keys refused. The one gate every write goes through, so a stored widget
191
+ * always renders.
192
+ */
193
+ export declare function validateWidgetSettings(type: unknown, settings: unknown, extra?: ExtraWidgetTypes): Record<string, unknown>;
194
+ //# sourceMappingURL=vocabulary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../src/vocabulary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAoCvB,eAAO,MAAM,eAAe;aAE1B,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACJ,KAAK;;;;;;aAML,OAAO;;;;aAIP,KAAK;;;;aACL,KAAK;;;;;aAKL,GAAG;;;;;;aAMH,KAAK;;;;;;;aACL,OAAO;;;;;;;;;aASP,KAAK;;;;;;;;;;aAQL,aAAa;;;;;;;;;aAUb,cAAc;;;;;aAKd,cAAc;;;;;;aAMd,KAAK;;;;;;;;;;aAOL,QAAQ;;;;;aAKR,QAAQ;;;;;;;;;;;;;aAOR,cAAc;;;aACd,MAAM;;;aACN,IAAI;;;aACJ,MAAM;;;;;;;aAIN,IAAI;;;aACJ,GAAG;;;aACH,QAAQ;;;CACA,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,eAAe,CAAA;AACrD,eAAO,MAAM,YAAY,EAAmC,SAAS,UAAU,EAAE,CAAA;AAEjF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEvF,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,UAAU,CAYvD,CAAA;AAEF,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,UAAU,CAGrD,CAAA;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;AAWtF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,OAAO,EACjB,KAAK,CAAC,EAAE,gBAAgB,GACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuCzB"}
@@ -0,0 +1,196 @@
1
+ import { richTextDocumentSchema } from '@cogenta/blocks';
2
+ import { CogentaError } from '@cogenta/core';
3
+ import { z } from 'zod';
4
+ /**
5
+ * The widget vocabulary (L30 D3): every kind of widget a site can place in a
6
+ * widget area, and the settings each one takes.
7
+ *
8
+ * Closed on purpose, like contract B's block vocabulary, but distinct from it:
9
+ * a widget is not a block of a page. It is placed once, in an area the theme
10
+ * owns, and repeated on every page its visibility rules allow. Several widgets
11
+ * are also impossible as blocks, because they read the page being shown (the
12
+ * entries related to it, its table of contents).
13
+ *
14
+ * Every setting is data (R3). WordPress's "Custom HTML" widget is the one
15
+ * deliberately absent: a widget never stores markup.
16
+ */
17
+ const url = z
18
+ .string()
19
+ .trim()
20
+ .min(1)
21
+ .max(2048)
22
+ .refine((value) => /^(https?:\/\/|\/|#|mailto:|tel:)/u.test(value), {
23
+ message: 'must be an absolute http(s) URL, a site path starting with "/", "#…", mailto: or tel:',
24
+ });
25
+ const shortText = z.string().trim().max(200);
26
+ const longText = z.string().trim().max(2000);
27
+ const identifierLike = z.string().trim().min(1).max(128);
28
+ const count = (max) => z.number().int().min(1).max(max);
29
+ const link = z.strictObject({
30
+ label: shortText.min(1),
31
+ href: url,
32
+ newTab: z.boolean().default(false),
33
+ });
34
+ export const WIDGET_SETTINGS = {
35
+ // --- Content -------------------------------------------------------------
36
+ text: z.strictObject({ body: richTextDocumentSchema }),
37
+ image: z.strictObject({
38
+ media: identifierLike,
39
+ alt: shortText.default(''),
40
+ caption: shortText.default(''),
41
+ href: url.optional(),
42
+ }),
43
+ gallery: z.strictObject({
44
+ media: z.array(identifierLike).min(1).max(24),
45
+ columns: z.union([z.literal(2), z.literal(3), z.literal(4)]).default(3),
46
+ }),
47
+ embed: z.strictObject({ url, caption: shortText.default('') }),
48
+ quote: z.strictObject({
49
+ text: longText.min(1),
50
+ attribution: shortText.default(''),
51
+ role: shortText.default(''),
52
+ }),
53
+ cta: z.strictObject({
54
+ heading: shortText.min(1),
55
+ body: longText.default(''),
56
+ label: shortText.min(1),
57
+ href: url,
58
+ }),
59
+ links: z.strictObject({ items: z.array(link).min(1).max(30) }),
60
+ contact: z.strictObject({
61
+ address: longText.default(''),
62
+ phone: shortText.default(''),
63
+ email: shortText.default(''),
64
+ hours: z
65
+ .array(z.strictObject({ label: shortText.min(1), value: shortText.min(1) }))
66
+ .max(14)
67
+ .default([]),
68
+ }),
69
+ about: z.strictObject({
70
+ media: identifierLike.optional(),
71
+ heading: shortText.default(''),
72
+ body: longText.min(1),
73
+ link: link.optional(),
74
+ }),
75
+ // --- Dynamic: read the site at render time -------------------------------
76
+ recentEntries: z.strictObject({
77
+ collection: identifierLike,
78
+ count: count(20).default(5),
79
+ showDate: z.boolean().default(true),
80
+ showExcerpt: z.boolean().default(false),
81
+ showImage: z.boolean().default(false),
82
+ /** Only entries classified under this term. */
83
+ taxonomy: identifierLike.optional(),
84
+ termId: identifierLike.optional(),
85
+ }),
86
+ relatedEntries: z.strictObject({
87
+ count: count(12).default(4),
88
+ showDate: z.boolean().default(false),
89
+ showImage: z.boolean().default(true),
90
+ }),
91
+ popularEntries: z.strictObject({
92
+ collection: identifierLike.optional(),
93
+ count: count(20).default(5),
94
+ days: z.union([z.literal(7), z.literal(30), z.literal(90), z.literal(365)]).default(30),
95
+ showImage: z.boolean().default(false),
96
+ }),
97
+ terms: z.strictObject({
98
+ taxonomy: identifierLike,
99
+ showCounts: z.boolean().default(true),
100
+ hierarchical: z.boolean().default(true),
101
+ hideEmpty: z.boolean().default(true),
102
+ display: z.enum(['list', 'dropdown']).default('list'),
103
+ }),
104
+ tagCloud: z.strictObject({
105
+ taxonomy: identifierLike,
106
+ maxTerms: count(100).default(30),
107
+ showCounts: z.boolean().default(false),
108
+ }),
109
+ archives: z.strictObject({
110
+ collection: identifierLike,
111
+ granularity: z.enum(['month', 'year']).default('month'),
112
+ showCounts: z.boolean().default(true),
113
+ display: z.enum(['list', 'dropdown']).default('list'),
114
+ limit: count(120).default(24),
115
+ }),
116
+ recentComments: z.strictObject({ count: count(20).default(5) }),
117
+ search: z.strictObject({ placeholder: shortText.default('') }),
118
+ menu: z.strictObject({ menuId: identifierLike }),
119
+ social: z.strictObject({
120
+ /** Absent: the site's own `general.socialLinks`. */
121
+ items: z.array(link).max(12).optional(),
122
+ }),
123
+ form: z.strictObject({ form: identifierLike }),
124
+ toc: z.strictObject({ maxDepth: z.union([z.literal(2), z.literal(3), z.literal(4)]).default(3) }),
125
+ calendar: z.strictObject({ collection: identifierLike }),
126
+ };
127
+ export const WIDGET_TYPES = Object.keys(WIDGET_SETTINGS);
128
+ /** Widgets whose content comes from the site at render time rather than from their settings. */
129
+ export const DYNAMIC_WIDGET_TYPES = new Set([
130
+ 'recentEntries',
131
+ 'relatedEntries',
132
+ 'popularEntries',
133
+ 'terms',
134
+ 'tagCloud',
135
+ 'archives',
136
+ 'recentComments',
137
+ 'menu',
138
+ 'social',
139
+ 'toc',
140
+ 'calendar',
141
+ ]);
142
+ /** Widgets that only mean something beside one entry (they read the page being shown). */
143
+ export const ENTRY_WIDGET_TYPES = new Set([
144
+ 'relatedEntries',
145
+ 'toc',
146
+ ]);
147
+ export function isWidgetType(value) {
148
+ return typeof value === 'string' && Object.hasOwn(WIDGET_SETTINGS, value);
149
+ }
150
+ function invalid(message, details) {
151
+ return new CogentaError({
152
+ code: 'WIDGET_INVALID',
153
+ message,
154
+ hint: 'Check the widget type and its settings against the widget vocabulary of @cogenta/widgets.',
155
+ details,
156
+ });
157
+ }
158
+ /**
159
+ * Validates and normalises a widget's settings: defaults filled in, unknown
160
+ * keys refused. The one gate every write goes through, so a stored widget
161
+ * always renders.
162
+ */
163
+ export function validateWidgetSettings(type, settings, extra) {
164
+ if (!isWidgetType(type)) {
165
+ // A type one of this site's plugins provides: validated against the
166
+ // schema that plugin declared, and refused the same way as anything else
167
+ // when the plugin is not installed — a widget nothing can render must not
168
+ // be storable.
169
+ const provided = typeof type === 'string' ? extra?.get(type) : undefined;
170
+ if (provided !== undefined) {
171
+ const result = provided.safeParse(settings ?? {});
172
+ if (result.success)
173
+ return result.data;
174
+ const problem = result.error.issues[0];
175
+ throw invalid(`The ${type} widget's settings are not valid${problem?.path.length ? ` at "${problem.path.join('.')}"` : ''}: ${problem?.message ?? 'unknown problem'}.`, { type, issues: result.error.issues.map((item) => item.message) });
176
+ }
177
+ throw invalid(`"${String(type)}" is not a widget type.`, {
178
+ type,
179
+ known: [...WIDGET_TYPES, ...(extra === undefined ? [] : [...extra.keys()])],
180
+ });
181
+ }
182
+ const parsed = WIDGET_SETTINGS[type].safeParse(settings ?? {});
183
+ if (!parsed.success) {
184
+ const issue = parsed.error.issues[0];
185
+ const path = issue?.path.join('.') ?? '';
186
+ throw invalid(`The ${type} widget's settings are not valid${path === '' ? '' : ` at "${path}"`}: ${issue?.message ?? 'unknown problem'}.`, { type, path, issues: parsed.error.issues.map((item) => item.message) });
187
+ }
188
+ if (type === 'recentEntries') {
189
+ const value = parsed.data;
190
+ if ((value.taxonomy === undefined) !== (value.termId === undefined)) {
191
+ throw invalid('A term filter needs both a taxonomy and a term.', { type });
192
+ }
193
+ }
194
+ return parsed.data;
195
+ }
196
+ //# sourceMappingURL=vocabulary.js.map
@@ -0,0 +1 @@
1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AAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SAC5E,CAAC,CAAA;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAC9D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACpC,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QACxC,MAAM,OAAO,CACX,OAAO,IAAI,mCAAmC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAE,OAAO,IAAI,iBAAiB,GAAG,EAC3H,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CACxE,CAAA;IACH,CAAC;IACD,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAuC,CAAA;QAC5D,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,CAAC;YACpE,MAAM,OAAO,CAAC,iDAAiD,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;QAC5E,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAA+B,CAAA;AAC/C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@cogenta/widgets",
3
+ "version": "0.2.3",
4
+ "description": "Widget areas for Cogenta sites: the widget vocabulary, its validation, visibility rules and storage.",
5
+ "license": "MPL-2.0",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "engines": {
18
+ "node": ">=22.11.0"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "provenance": true
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/cogenta-cms/cogenta.git",
27
+ "directory": "packages/widgets"
28
+ },
29
+ "dependencies": {
30
+ "zod": "^4.4.3",
31
+ "@cogenta/blocks": "1.1.3",
32
+ "@cogenta/core": "0.11.0",
33
+ "@cogenta/schema": "0.7.1"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "^7.0.2",
37
+ "vitest": "^4.1.10"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "typecheck": "tsc -p tsconfig.typecheck.json",
42
+ "test": "vitest run --passWithNoTests",
43
+ "test:integration": "vitest run --config vitest.integration.config.ts --passWithNoTests"
44
+ }
45
+ }