@makeswift/prop-controllers 0.3.0-canary.2 → 0.3.0-canary.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.
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ __export(src_exports, {
49
49
  ResponsiveLengthPropControllerDataV1Type: () => ResponsiveLengthPropControllerDataV1Type,
50
50
  ResponsiveNumber: () => ResponsiveNumber,
51
51
  ResponsiveOpacity: () => ResponsiveOpacity,
52
+ ResponsiveSelect: () => ResponsiveSelect,
52
53
  Shadows: () => Shadows,
53
54
  SocialLinks: () => SocialLinks,
54
55
  Table: () => Table,
@@ -176,6 +177,7 @@ __export(src_exports, {
176
177
  responsiveLengthPropControllerDataSchema: () => responsiveLengthPropControllerDataSchema,
177
178
  responsiveNumberValueSchema: () => responsiveNumberValueSchema,
178
179
  responsiveOpacityValueSchema: () => responsiveOpacityValueSchema,
180
+ responsiveSelectValueSchema: () => responsiveSelectValueSchema,
179
181
  shadowsPropControllerDataSchema: () => shadowsPropControllerDataSchema,
180
182
  socialLinksPropControllerDataSchema: () => socialLinksPropControllerDataSchema,
181
183
  tableFormFieldsPropControllerDataSchema: () => tableFormFieldsPropControllerDataSchema,
@@ -183,6 +185,7 @@ __export(src_exports, {
183
185
  textAreaPropControllerDataSchema: () => textAreaPropControllerDataSchema,
184
186
  textInputPropControllerDataSchema: () => textInputPropControllerDataSchema,
185
187
  textStylePropControllerDataSchema: () => textStylePropControllerDataSchema,
188
+ typeArg: () => typeArg,
186
189
  versionedPropDef: () => versionedPropDef,
187
190
  videoPropControllerDataSchema: () => videoPropControllerDataSchema,
188
191
  widthPropControllerDataSchema: () => widthPropControllerDataSchema
@@ -217,6 +220,7 @@ var Types = {
217
220
  ResponsiveLength: "ResponsiveLength",
218
221
  ResponsiveNumber: "ResponsiveNumber",
219
222
  ResponsiveOpacity: "ResponsiveOpacity",
223
+ ResponsiveSelect: "ResponsiveSelect",
220
224
  SocialLinks: "SocialLinks",
221
225
  TextArea: "TextArea",
222
226
  TextInput: "TextInput",
@@ -289,84 +293,101 @@ var imageDataSchema = import_zod2.z.union([imageDataV0Schema, imageDataV1Schema]
289
293
  var responsiveNumberValueSchema = createResponsiveValueSchema(
290
294
  import_zod2.z.number()
291
295
  );
296
+ var responsiveSelectValueSchema = createResponsiveValueSchema(
297
+ import_zod2.z.string()
298
+ );
292
299
 
293
300
  // src/versioned.ts
294
301
  var import_ts_pattern = require("ts-pattern");
295
302
  var import_zod3 = require("zod");
296
- var PropDef = class extends Function {
303
+ var PropDef = class {
297
304
  __associated_types__;
298
- _callable;
299
- constructor() {
300
- super("...args", "return this._callable.__call__(...args)");
301
- this._callable = this.bind(this);
302
- return this._callable;
303
- }
304
305
  };
305
- var versionedPropDef = () => (type, valueSchema, discriminator) => {
306
+ var TypeArg = class {
307
+ __associated_types__;
308
+ };
309
+ var typeArg = () => new TypeArg();
310
+ var versionedPropDef = (type, valueSchema, discriminator2, _rawOptionsType, _ctor) => {
306
311
  const schemaV0 = valueSchema;
307
312
  const schemaV1 = import_zod3.z.object({
308
- [ControlDataTypeKey]: import_zod3.z.literal(discriminator.dataKey),
313
+ [ControlDataTypeKey]: import_zod3.z.literal(discriminator2.dataKey),
309
314
  value: valueSchema
310
315
  });
311
316
  const schema = import_zod3.z.union([schemaV0, schemaV1]);
312
- class Def extends PropDef {
313
- schemaV0 = schemaV0;
314
- schemaV1 = schemaV1;
315
- schema = schema;
316
- type = type;
317
- discriminator = discriminator;
318
- __call__(options) {
319
- return {
320
- type,
321
- version: discriminator.version,
322
- options: options ?? {}
323
- };
324
- }
325
- fromPropData(propData) {
326
- return (0, import_ts_pattern.match)(propData).with(
327
- {
328
- [ControlDataTypeKey]: discriminator.dataKey
329
- },
330
- (v1) => v1.value
331
- ).otherwise((v0) => v0);
332
- }
333
- toPropData(data, descriptor) {
334
- return (0, import_ts_pattern.match)(descriptor).with(
335
- { version: discriminator.version },
336
- () => ({
337
- [ControlDataTypeKey]: discriminator.dataKey,
338
- value: data
339
- })
340
- ).otherwise(() => data);
341
- }
342
- }
343
- return new Def();
317
+ const r = (options) => {
318
+ return {
319
+ type,
320
+ version: discriminator2.version,
321
+ options: options ?? {}
322
+ };
323
+ };
324
+ r.schema = schema;
325
+ r.type = type;
326
+ r.discriminator = discriminator2;
327
+ r.fromPropData = (propData) => (0, import_ts_pattern.match)(propData).with(
328
+ {
329
+ [ControlDataTypeKey]: discriminator2.dataKey
330
+ },
331
+ (v1) => v1.value
332
+ ).otherwise((v0) => v0);
333
+ r.toPropData = (data, descriptor) => (0, import_ts_pattern.match)(descriptor).with(
334
+ { version: discriminator2.version },
335
+ () => ({
336
+ [ControlDataTypeKey]: discriminator2.dataKey,
337
+ value: data
338
+ })
339
+ ).otherwise(() => data);
340
+ return r;
344
341
  };
345
342
 
346
343
  // src/gap-x/gap-x.ts
347
- var GapX = versionedPropDef()(Types.GapX, responsiveGapDataSchema, {
348
- version: 1,
349
- dataKey: "prop-controllers::gap-x::v1"
350
- });
344
+ var GapX = versionedPropDef(
345
+ Types.GapX,
346
+ responsiveGapDataSchema,
347
+ {
348
+ version: 1,
349
+ dataKey: "prop-controllers::gap-x::v1"
350
+ },
351
+ typeArg()
352
+ );
351
353
 
352
354
  // src/responsive-number/responsive-number.ts
353
- var ResponsiveNumber = versionedPropDef()(Types.ResponsiveNumber, responsiveNumberValueSchema, {
354
- version: 1,
355
- dataKey: "prop-controllers::responsive-number::v1"
356
- });
355
+ var ResponsiveNumber = versionedPropDef(
356
+ Types.ResponsiveNumber,
357
+ responsiveNumberValueSchema,
358
+ {
359
+ version: 1,
360
+ dataKey: "prop-controllers::responsive-number::v1"
361
+ },
362
+ typeArg()
363
+ );
357
364
 
358
365
  // src/responsive-opacity/responsive-opacity.ts
359
366
  var import_zod4 = require("zod");
360
367
  var responsiveOpacityValueSchema = createResponsiveValueSchema(
361
368
  import_zod4.z.number()
362
369
  );
363
- var ResponsiveOpacity = versionedPropDef()(
370
+ var ResponsiveOpacity = versionedPropDef(
364
371
  Types.ResponsiveOpacity,
365
372
  responsiveOpacityValueSchema,
366
373
  {
367
374
  version: 1,
368
375
  dataKey: "prop-controllers::responsive-opacity::v1"
369
- }
376
+ },
377
+ typeArg()
378
+ );
379
+
380
+ // src/responsive-select/responsive-select.ts
381
+ var discriminator = {
382
+ version: 1,
383
+ dataKey: "prop-controllers::responsive-select::v1"
384
+ };
385
+ var ResponsiveSelect = versionedPropDef(
386
+ Types.ResponsiveSelect,
387
+ responsiveSelectValueSchema,
388
+ discriminator,
389
+ typeArg(),
390
+ typeArg()
370
391
  );
371
392
 
372
393
  // src/backgrounds/backgrounds.ts
@@ -2304,6 +2325,7 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
2304
2325
  ResponsiveLengthPropControllerDataV1Type,
2305
2326
  ResponsiveNumber,
2306
2327
  ResponsiveOpacity,
2328
+ ResponsiveSelect,
2307
2329
  Shadows,
2308
2330
  SocialLinks,
2309
2331
  Table,
@@ -2431,6 +2453,7 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
2431
2453
  responsiveLengthPropControllerDataSchema,
2432
2454
  responsiveNumberValueSchema,
2433
2455
  responsiveOpacityValueSchema,
2456
+ responsiveSelectValueSchema,
2434
2457
  shadowsPropControllerDataSchema,
2435
2458
  socialLinksPropControllerDataSchema,
2436
2459
  tableFormFieldsPropControllerDataSchema,
@@ -2438,6 +2461,7 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
2438
2461
  textAreaPropControllerDataSchema,
2439
2462
  textInputPropControllerDataSchema,
2440
2463
  textStylePropControllerDataSchema,
2464
+ typeArg,
2441
2465
  versionedPropDef,
2442
2466
  videoPropControllerDataSchema,
2443
2467
  widthPropControllerDataSchema
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { type ResponsiveValue } from './prop-controllers';
2
3
  export declare const colorDataSchema: z.ZodObject<{
3
4
  swatchId: z.ZodString;
4
5
  alpha: z.ZodNumber;
@@ -135,4 +136,15 @@ export declare const responsiveNumberValueSchema: z.ZodArray<z.ZodObject<{
135
136
  deviceId: string;
136
137
  }>, "many">;
137
138
  export type ResponsiveNumberValue = z.infer<typeof responsiveNumberValueSchema>;
139
+ export declare const responsiveSelectValueSchema: z.ZodArray<z.ZodObject<{
140
+ deviceId: z.ZodString;
141
+ value: z.ZodString;
142
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
143
+ value: string;
144
+ deviceId: string;
145
+ }, {
146
+ value: string;
147
+ deviceId: string;
148
+ }>, "many">;
149
+ export type ResponsiveSelectValue<T extends string = string> = ResponsiveValue<T>;
138
150
  //# sourceMappingURL=data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,aAAa;;;;;;;;;EAGxB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEnD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;WACQ,CAAA;AAE5C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAIvE,eAAO,MAAM,iBAAiB,aAAe,CAAA;AAE7C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAgB3D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;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