@protoflexo/proto-config 0.1.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.d.ts +251 -0
- package/dist/index.js +57 -0
- package/package.json +34 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
interface ProtoConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
author: {
|
|
8
|
+
name: string;
|
|
9
|
+
role: string;
|
|
10
|
+
avatar?: string;
|
|
11
|
+
};
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
project: string;
|
|
15
|
+
tags: string[];
|
|
16
|
+
status: ProtoStatus;
|
|
17
|
+
problemStatement: string;
|
|
18
|
+
links?: {
|
|
19
|
+
figma?: string;
|
|
20
|
+
linear?: string;
|
|
21
|
+
notion?: string;
|
|
22
|
+
slack?: string;
|
|
23
|
+
[key: string]: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
viewport?: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
deviceLabel?: string;
|
|
29
|
+
};
|
|
30
|
+
variants: VariantConfig[];
|
|
31
|
+
}
|
|
32
|
+
type ProtoStatus = 'exploring' | 'in-review' | 'decided' | 'shipped' | 'archived';
|
|
33
|
+
interface VariantConfig {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
description: string;
|
|
37
|
+
screens: ScreenConfig[];
|
|
38
|
+
}
|
|
39
|
+
interface ScreenConfig {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
path: string;
|
|
43
|
+
}
|
|
44
|
+
/** Default viewport dimensions (iPhone 15 Pro logical resolution) */
|
|
45
|
+
declare const DEFAULT_VIEWPORT: {
|
|
46
|
+
readonly width: 393;
|
|
47
|
+
readonly height: 852;
|
|
48
|
+
readonly deviceLabel: "iPhone 15 Pro";
|
|
49
|
+
};
|
|
50
|
+
/** PostMessage protocol types for iframe ↔ web app communication */
|
|
51
|
+
type ProtoMessage = {
|
|
52
|
+
type: 'proto:ready';
|
|
53
|
+
config: ProtoConfig;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'proto:navigate';
|
|
56
|
+
variant: string;
|
|
57
|
+
screen: string;
|
|
58
|
+
} | {
|
|
59
|
+
type: 'proto:setState';
|
|
60
|
+
variant: string;
|
|
61
|
+
screen: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare const screenConfigSchema: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
path: z.ZodString;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
id: string;
|
|
70
|
+
label: string;
|
|
71
|
+
path: string;
|
|
72
|
+
}, {
|
|
73
|
+
id: string;
|
|
74
|
+
label: string;
|
|
75
|
+
path: string;
|
|
76
|
+
}>;
|
|
77
|
+
declare const variantConfigSchema: z.ZodObject<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
label: z.ZodString;
|
|
80
|
+
description: z.ZodString;
|
|
81
|
+
screens: z.ZodArray<z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
label: z.ZodString;
|
|
84
|
+
path: z.ZodString;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
path: string;
|
|
89
|
+
}, {
|
|
90
|
+
id: string;
|
|
91
|
+
label: string;
|
|
92
|
+
path: string;
|
|
93
|
+
}>, "many">;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
id: string;
|
|
96
|
+
label: string;
|
|
97
|
+
description: string;
|
|
98
|
+
screens: {
|
|
99
|
+
id: string;
|
|
100
|
+
label: string;
|
|
101
|
+
path: string;
|
|
102
|
+
}[];
|
|
103
|
+
}, {
|
|
104
|
+
id: string;
|
|
105
|
+
label: string;
|
|
106
|
+
description: string;
|
|
107
|
+
screens: {
|
|
108
|
+
id: string;
|
|
109
|
+
label: string;
|
|
110
|
+
path: string;
|
|
111
|
+
}[];
|
|
112
|
+
}>;
|
|
113
|
+
declare const protoStatusSchema: z.ZodEnum<["exploring", "in-review", "decided", "shipped", "archived"]>;
|
|
114
|
+
declare const protoConfigSchema: z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
title: z.ZodString;
|
|
117
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
118
|
+
author: z.ZodObject<{
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
role: z.ZodString;
|
|
121
|
+
avatar: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
name: string;
|
|
124
|
+
role: string;
|
|
125
|
+
avatar?: string | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
name: string;
|
|
128
|
+
role: string;
|
|
129
|
+
avatar?: string | undefined;
|
|
130
|
+
}>;
|
|
131
|
+
createdAt: z.ZodString;
|
|
132
|
+
updatedAt: z.ZodString;
|
|
133
|
+
project: z.ZodString;
|
|
134
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
135
|
+
status: z.ZodEnum<["exploring", "in-review", "decided", "shipped", "archived"]>;
|
|
136
|
+
problemStatement: z.ZodString;
|
|
137
|
+
links: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
|
|
138
|
+
viewport: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
width: z.ZodNumber;
|
|
140
|
+
height: z.ZodNumber;
|
|
141
|
+
deviceLabel: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
deviceLabel?: string | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
width: number;
|
|
148
|
+
height: number;
|
|
149
|
+
deviceLabel?: string | undefined;
|
|
150
|
+
}>>;
|
|
151
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
label: z.ZodString;
|
|
154
|
+
description: z.ZodString;
|
|
155
|
+
screens: z.ZodArray<z.ZodObject<{
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
label: z.ZodString;
|
|
158
|
+
path: z.ZodString;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
id: string;
|
|
161
|
+
label: string;
|
|
162
|
+
path: string;
|
|
163
|
+
}, {
|
|
164
|
+
id: string;
|
|
165
|
+
label: string;
|
|
166
|
+
path: string;
|
|
167
|
+
}>, "many">;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
id: string;
|
|
170
|
+
label: string;
|
|
171
|
+
description: string;
|
|
172
|
+
screens: {
|
|
173
|
+
id: string;
|
|
174
|
+
label: string;
|
|
175
|
+
path: string;
|
|
176
|
+
}[];
|
|
177
|
+
}, {
|
|
178
|
+
id: string;
|
|
179
|
+
label: string;
|
|
180
|
+
description: string;
|
|
181
|
+
screens: {
|
|
182
|
+
id: string;
|
|
183
|
+
label: string;
|
|
184
|
+
path: string;
|
|
185
|
+
}[];
|
|
186
|
+
}>, "many">;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
id: string;
|
|
189
|
+
status: "exploring" | "in-review" | "decided" | "shipped" | "archived";
|
|
190
|
+
title: string;
|
|
191
|
+
author: {
|
|
192
|
+
name: string;
|
|
193
|
+
role: string;
|
|
194
|
+
avatar?: string | undefined;
|
|
195
|
+
};
|
|
196
|
+
createdAt: string;
|
|
197
|
+
updatedAt: string;
|
|
198
|
+
project: string;
|
|
199
|
+
tags: string[];
|
|
200
|
+
problemStatement: string;
|
|
201
|
+
variants: {
|
|
202
|
+
id: string;
|
|
203
|
+
label: string;
|
|
204
|
+
description: string;
|
|
205
|
+
screens: {
|
|
206
|
+
id: string;
|
|
207
|
+
label: string;
|
|
208
|
+
path: string;
|
|
209
|
+
}[];
|
|
210
|
+
}[];
|
|
211
|
+
subtitle?: string | undefined;
|
|
212
|
+
links?: Record<string, string | undefined> | undefined;
|
|
213
|
+
viewport?: {
|
|
214
|
+
width: number;
|
|
215
|
+
height: number;
|
|
216
|
+
deviceLabel?: string | undefined;
|
|
217
|
+
} | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
id: string;
|
|
220
|
+
status: "exploring" | "in-review" | "decided" | "shipped" | "archived";
|
|
221
|
+
title: string;
|
|
222
|
+
author: {
|
|
223
|
+
name: string;
|
|
224
|
+
role: string;
|
|
225
|
+
avatar?: string | undefined;
|
|
226
|
+
};
|
|
227
|
+
createdAt: string;
|
|
228
|
+
updatedAt: string;
|
|
229
|
+
project: string;
|
|
230
|
+
tags: string[];
|
|
231
|
+
problemStatement: string;
|
|
232
|
+
variants: {
|
|
233
|
+
id: string;
|
|
234
|
+
label: string;
|
|
235
|
+
description: string;
|
|
236
|
+
screens: {
|
|
237
|
+
id: string;
|
|
238
|
+
label: string;
|
|
239
|
+
path: string;
|
|
240
|
+
}[];
|
|
241
|
+
}[];
|
|
242
|
+
subtitle?: string | undefined;
|
|
243
|
+
links?: Record<string, string | undefined> | undefined;
|
|
244
|
+
viewport?: {
|
|
245
|
+
width: number;
|
|
246
|
+
height: number;
|
|
247
|
+
deviceLabel?: string | undefined;
|
|
248
|
+
} | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
|
|
251
|
+
export { DEFAULT_VIEWPORT, type ProtoConfig, type ProtoMessage, type ProtoStatus, type ScreenConfig, type VariantConfig, protoConfigSchema, protoStatusSchema, screenConfigSchema, variantConfigSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/types.ts
|
|
2
|
+
var DEFAULT_VIEWPORT = {
|
|
3
|
+
width: 393,
|
|
4
|
+
height: 852,
|
|
5
|
+
deviceLabel: "iPhone 15 Pro"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/schema.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
var screenConfigSchema = z.object({
|
|
11
|
+
id: z.string().min(1),
|
|
12
|
+
label: z.string().min(1),
|
|
13
|
+
path: z.string().min(1)
|
|
14
|
+
});
|
|
15
|
+
var variantConfigSchema = z.object({
|
|
16
|
+
id: z.string().min(1),
|
|
17
|
+
label: z.string().min(1),
|
|
18
|
+
description: z.string().min(1),
|
|
19
|
+
screens: z.array(screenConfigSchema).min(1)
|
|
20
|
+
});
|
|
21
|
+
var protoStatusSchema = z.enum([
|
|
22
|
+
"exploring",
|
|
23
|
+
"in-review",
|
|
24
|
+
"decided",
|
|
25
|
+
"shipped",
|
|
26
|
+
"archived"
|
|
27
|
+
]);
|
|
28
|
+
var protoConfigSchema = z.object({
|
|
29
|
+
id: z.string().min(1),
|
|
30
|
+
title: z.string().min(1),
|
|
31
|
+
subtitle: z.string().optional(),
|
|
32
|
+
author: z.object({
|
|
33
|
+
name: z.string().min(1),
|
|
34
|
+
role: z.string().min(1),
|
|
35
|
+
avatar: z.string().url().optional()
|
|
36
|
+
}),
|
|
37
|
+
createdAt: z.string().datetime(),
|
|
38
|
+
updatedAt: z.string().datetime(),
|
|
39
|
+
project: z.string().min(1),
|
|
40
|
+
tags: z.array(z.string()),
|
|
41
|
+
status: protoStatusSchema,
|
|
42
|
+
problemStatement: z.string().min(1),
|
|
43
|
+
links: z.record(z.string(), z.string().url().optional()).optional(),
|
|
44
|
+
viewport: z.object({
|
|
45
|
+
width: z.number().positive(),
|
|
46
|
+
height: z.number().positive(),
|
|
47
|
+
deviceLabel: z.string().optional()
|
|
48
|
+
}).optional(),
|
|
49
|
+
variants: z.array(variantConfigSchema).min(1).max(8)
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
DEFAULT_VIEWPORT,
|
|
53
|
+
protoConfigSchema,
|
|
54
|
+
protoStatusSchema,
|
|
55
|
+
screenConfigSchema,
|
|
56
|
+
variantConfigSchema
|
|
57
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@protoflexo/proto-config",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Config types and validation for ProtoFeed prototypes",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"tsup": "^8.0.0",
|
|
23
|
+
"vitest": "^3.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "^3.24.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
30
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"typecheck": "tsc --noEmit"
|
|
33
|
+
}
|
|
34
|
+
}
|