@makeswift/prop-controllers 0.1.0-canary.3 → 0.1.0-canary.4
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 +506 -224
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/link/link.d.ts +944 -34
- package/dist/types/link/link.d.ts.map +1 -1
- package/dist/types/navigation-links/navigation-links.d.ts +76 -73
- package/dist/types/navigation-links/navigation-links.d.ts.map +1 -1
- package/dist/types/prop-controllers.d.ts +1 -0
- package/dist/types/prop-controllers.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -29,9 +29,9 @@ __export(src_exports, {
|
|
29
29
|
Date: () => Date,
|
30
30
|
Font: () => Font,
|
31
31
|
Link: () => Link,
|
32
|
-
LinkPropControllerDataV1Type: () => LinkPropControllerDataV1Type,
|
33
32
|
Margin: () => Margin,
|
34
33
|
MarginPropControllerFormat: () => MarginPropControllerFormat,
|
34
|
+
NavigationLinks: () => NavigationLinks,
|
35
35
|
Number: () => Number,
|
36
36
|
Padding: () => Padding,
|
37
37
|
PaddingPropControllerFormat: () => PaddingPropControllerFormat,
|
@@ -50,6 +50,7 @@ __export(src_exports, {
|
|
50
50
|
checkboxPropControllerDataSchema: () => checkboxPropControllerDataSchema,
|
51
51
|
copyBorderPropControllerData: () => copyBorderPropControllerData,
|
52
52
|
copyLinkPropControllerData: () => copyLinkPropControllerData,
|
53
|
+
copyNavigationLinksPropControllerData: () => copyNavigationLinksPropControllerData,
|
53
54
|
copyResponsiveColorPropControllerData: () => copyResponsiveColorPropControllerData,
|
54
55
|
copyShadowsPropControllerData: () => copyShadowsPropControllerData,
|
55
56
|
copyTablePropControllerData: () => copyTablePropControllerData,
|
@@ -58,7 +59,9 @@ __export(src_exports, {
|
|
58
59
|
createCheckboxPropControllerDataFromBoolean: () => createCheckboxPropControllerDataFromBoolean,
|
59
60
|
createDatePropControllerDataFromString: () => createDatePropControllerDataFromString,
|
60
61
|
createFontPropControllerDataFromResponsiveFontData: () => createFontPropControllerDataFromResponsiveFontData,
|
62
|
+
createLinkPropControllerDataFromLinkData: () => createLinkPropControllerDataFromLinkData,
|
61
63
|
createMarginPropControllerDataFromResponsiveMarginData: () => createMarginPropControllerDataFromResponsiveMarginData,
|
64
|
+
createNavigationLinksPropControllerDataFromNavigationLinksData: () => createNavigationLinksPropControllerDataFromNavigationLinksData,
|
62
65
|
createNumberPropControllerDataFromNumber: () => createNumberPropControllerDataFromNumber,
|
63
66
|
createPaddingPropControllerDataFromResponsivePaddingData: () => createPaddingPropControllerDataFromResponsivePaddingData,
|
64
67
|
createResponsiveColorPropControllerDataFromResponsiveColorData: () => createResponsiveColorPropControllerDataFromResponsiveColorData,
|
@@ -77,9 +80,12 @@ __export(src_exports, {
|
|
77
80
|
getCheckboxPropControllerDataBoolean: () => getCheckboxPropControllerDataBoolean,
|
78
81
|
getDatePropControllerDataString: () => getDatePropControllerDataString,
|
79
82
|
getFontPropControllerDataResponsiveFontData: () => getFontPropControllerDataResponsiveFontData,
|
83
|
+
getLinkPropControllerDataLinkData: () => getLinkPropControllerDataLinkData,
|
80
84
|
getLinkPropControllerPageIds: () => getLinkPropControllerPageIds,
|
81
|
-
getLinkPropControllerValue: () => getLinkPropControllerValue,
|
82
85
|
getMarginPropControllerDataResponsiveMarginData: () => getMarginPropControllerDataResponsiveMarginData,
|
86
|
+
getNavigationLinksPropControllerDataNavigationLinksData: () => getNavigationLinksPropControllerDataNavigationLinksData,
|
87
|
+
getNavigationLinksPropControllerPageIds: () => getNavigationLinksPropControllerPageIds,
|
88
|
+
getNavigationLinksPropControllerSwatchIds: () => getNavigationLinksPropControllerSwatchIds,
|
83
89
|
getNumberPropControllerDataNumber: () => getNumberPropControllerDataNumber,
|
84
90
|
getPaddingPropControllerDataResponsivePaddingData: () => getPaddingPropControllerDataResponsivePaddingData,
|
85
91
|
getResponsiveColorDataSwatchIds: () => getResponsiveColorDataSwatchIds,
|
@@ -93,7 +99,10 @@ __export(src_exports, {
|
|
93
99
|
getTextStylePropControllerDataResponsiveTextStyleData: () => getTextStylePropControllerDataResponsiveTextStyleData,
|
94
100
|
getVideoPropControllerDataVideoData: () => getVideoPropControllerDataVideoData,
|
95
101
|
getWidthPropControllerDataResponsiveLengthData: () => getWidthPropControllerDataResponsiveLengthData,
|
102
|
+
linkDataSchema: () => linkDataSchema,
|
103
|
+
linkPropControllerDataSchema: () => linkPropControllerDataSchema,
|
96
104
|
marginPropControllerDataSchema: () => marginPropControllerDataSchema,
|
105
|
+
navigationLinksPropControllerDataSchema: () => navigationLinksPropControllerDataSchema,
|
97
106
|
numberPropControllerDataSchema: () => numberPropControllerDataSchema,
|
98
107
|
paddingPropControllerDataSchema: () => paddingPropControllerDataSchema,
|
99
108
|
responsiveColorPropControllerDataSchema: () => responsiveColorPropControllerDataSchema,
|
@@ -106,22 +115,8 @@ __export(src_exports, {
|
|
106
115
|
});
|
107
116
|
module.exports = __toCommonJS(src_exports);
|
108
117
|
|
109
|
-
// src/border/border.ts
|
110
|
-
var import_ts_pattern = require("ts-pattern");
|
111
|
-
|
112
|
-
// src/data.ts
|
113
|
-
var import_zod = require("zod");
|
114
|
-
var colorDataSchema = import_zod.z.object({
|
115
|
-
swatchId: import_zod.z.string(),
|
116
|
-
alpha: import_zod.z.number()
|
117
|
-
});
|
118
|
-
var lengthDataSchema = import_zod.z.object({
|
119
|
-
value: import_zod.z.number(),
|
120
|
-
unit: import_zod.z.union([import_zod.z.literal("px"), import_zod.z.literal("%")])
|
121
|
-
});
|
122
|
-
|
123
118
|
// src/prop-controllers.ts
|
124
|
-
var
|
119
|
+
var import_zod = require("zod");
|
125
120
|
var Types = {
|
126
121
|
Border: "Border",
|
127
122
|
BorderRadius: "BorderRadius",
|
@@ -130,6 +125,7 @@ var Types = {
|
|
130
125
|
Font: "Font",
|
131
126
|
Link: "Link",
|
132
127
|
Margin: "Margin",
|
128
|
+
NavigationLinks: "NavigationLinks",
|
133
129
|
Padding: "Padding",
|
134
130
|
Number: "Number",
|
135
131
|
Shadows: "Shadows",
|
@@ -141,17 +137,31 @@ var Types = {
|
|
141
137
|
Video: "Video"
|
142
138
|
};
|
143
139
|
var ControlDataTypeKey = "@@makeswift/type";
|
144
|
-
var deviceSchema =
|
140
|
+
var deviceSchema = import_zod.z.string();
|
145
141
|
function createDeviceOverrideSchema(schema) {
|
146
|
-
return
|
142
|
+
return import_zod.z.object({
|
147
143
|
deviceId: deviceSchema,
|
148
144
|
value: schema
|
149
145
|
});
|
150
146
|
}
|
151
147
|
function createResponsiveValueSchema(schema) {
|
152
|
-
return
|
148
|
+
return import_zod.z.array(createDeviceOverrideSchema(schema));
|
153
149
|
}
|
154
150
|
|
151
|
+
// src/border/border.ts
|
152
|
+
var import_ts_pattern = require("ts-pattern");
|
153
|
+
|
154
|
+
// src/data.ts
|
155
|
+
var import_zod2 = require("zod");
|
156
|
+
var colorDataSchema = import_zod2.z.object({
|
157
|
+
swatchId: import_zod2.z.string(),
|
158
|
+
alpha: import_zod2.z.number()
|
159
|
+
});
|
160
|
+
var lengthDataSchema = import_zod2.z.object({
|
161
|
+
value: import_zod2.z.number(),
|
162
|
+
unit: import_zod2.z.union([import_zod2.z.literal("px"), import_zod2.z.literal("%")])
|
163
|
+
});
|
164
|
+
|
155
165
|
// src/border/border.ts
|
156
166
|
var import_zod3 = require("zod");
|
157
167
|
var borderSideDataSchema = import_zod3.z.object({
|
@@ -409,17 +419,94 @@ function createFontPropControllerDataFromResponsiveFontData(responsiveFontData,
|
|
409
419
|
|
410
420
|
// src/link/link.ts
|
411
421
|
var import_ts_pattern6 = require("ts-pattern");
|
422
|
+
var import_zod8 = require("zod");
|
423
|
+
var openPageLinkSchema = import_zod8.z.object({
|
424
|
+
type: import_zod8.z.literal("OPEN_PAGE"),
|
425
|
+
payload: import_zod8.z.object({
|
426
|
+
pageId: import_zod8.z.string().nullable().optional(),
|
427
|
+
openInNewTab: import_zod8.z.boolean()
|
428
|
+
}).transform((v) => ({
|
429
|
+
pageId: v.pageId,
|
430
|
+
...v
|
431
|
+
}))
|
432
|
+
});
|
433
|
+
var openURLLinkSchema = import_zod8.z.object({
|
434
|
+
type: import_zod8.z.literal("OPEN_URL"),
|
435
|
+
payload: import_zod8.z.object({
|
436
|
+
url: import_zod8.z.string(),
|
437
|
+
openInNewTab: import_zod8.z.boolean()
|
438
|
+
})
|
439
|
+
});
|
440
|
+
var sendEmailLinkSchema = import_zod8.z.object({
|
441
|
+
type: import_zod8.z.literal("SEND_EMAIL"),
|
442
|
+
payload: import_zod8.z.object({
|
443
|
+
to: import_zod8.z.string(),
|
444
|
+
subject: import_zod8.z.string().optional(),
|
445
|
+
body: import_zod8.z.string().optional()
|
446
|
+
})
|
447
|
+
});
|
448
|
+
var callPhoneLinkSchema = import_zod8.z.object({
|
449
|
+
type: import_zod8.z.literal("CALL_PHONE"),
|
450
|
+
payload: import_zod8.z.object({
|
451
|
+
phoneNumber: import_zod8.z.string()
|
452
|
+
})
|
453
|
+
});
|
454
|
+
var scrollToElementLinkSchema = import_zod8.z.object({
|
455
|
+
type: import_zod8.z.literal("SCROLL_TO_ELEMENT"),
|
456
|
+
payload: import_zod8.z.object({
|
457
|
+
elementIdConfig: import_zod8.z.object({
|
458
|
+
elementKey: import_zod8.z.string(),
|
459
|
+
propName: import_zod8.z.string()
|
460
|
+
}).nullable().optional(),
|
461
|
+
block: import_zod8.z.union([
|
462
|
+
import_zod8.z.literal("start"),
|
463
|
+
import_zod8.z.literal("center"),
|
464
|
+
import_zod8.z.literal("end")
|
465
|
+
])
|
466
|
+
}).transform((v) => ({
|
467
|
+
elementIdConfig: v.elementIdConfig,
|
468
|
+
...v
|
469
|
+
}))
|
470
|
+
});
|
471
|
+
var linkDataSchema = import_zod8.z.union([
|
472
|
+
openPageLinkSchema,
|
473
|
+
openURLLinkSchema,
|
474
|
+
sendEmailLinkSchema,
|
475
|
+
callPhoneLinkSchema,
|
476
|
+
scrollToElementLinkSchema
|
477
|
+
]);
|
478
|
+
var linkPropControllerDataV0Schema = linkDataSchema;
|
412
479
|
var LinkPropControllerDataV1Type = "prop-controllers::link::v1";
|
413
|
-
|
480
|
+
var linkPropControllerDataV1Schema = import_zod8.z.object({
|
481
|
+
[ControlDataTypeKey]: import_zod8.z.literal(LinkPropControllerDataV1Type),
|
482
|
+
value: linkDataSchema
|
483
|
+
});
|
484
|
+
var linkPropControllerDataSchema = import_zod8.z.union([
|
485
|
+
linkPropControllerDataV0Schema,
|
486
|
+
linkPropControllerDataV1Schema
|
487
|
+
]);
|
488
|
+
function Link(options = {}) {
|
489
|
+
return { type: Types.Link, version: 1, options };
|
490
|
+
}
|
491
|
+
function getLinkPropControllerDataLinkData(data) {
|
414
492
|
return (0, import_ts_pattern6.match)(data).with(
|
415
493
|
{ [ControlDataTypeKey]: LinkPropControllerDataV1Type },
|
416
494
|
(v1) => v1.value
|
417
495
|
).otherwise((v0) => v0);
|
418
496
|
}
|
497
|
+
function createLinkPropControllerDataFromLinkData(value, definition) {
|
498
|
+
return (0, import_ts_pattern6.match)(definition).with(
|
499
|
+
{ version: 1 },
|
500
|
+
() => ({
|
501
|
+
[ControlDataTypeKey]: LinkPropControllerDataV1Type,
|
502
|
+
value
|
503
|
+
})
|
504
|
+
).otherwise(() => value);
|
505
|
+
}
|
419
506
|
function getLinkPropControllerPageIds(linkData) {
|
420
507
|
if (linkData == null)
|
421
508
|
return [];
|
422
|
-
const link =
|
509
|
+
const link = getLinkPropControllerDataLinkData(linkData);
|
423
510
|
switch (link.type) {
|
424
511
|
case "OPEN_PAGE":
|
425
512
|
return link.payload.pageId == null ? [] : [link.payload.pageId];
|
@@ -427,10 +514,8 @@ function getLinkPropControllerPageIds(linkData) {
|
|
427
514
|
return [];
|
428
515
|
}
|
429
516
|
}
|
430
|
-
function
|
431
|
-
|
432
|
-
return data;
|
433
|
-
let value = getLinkPropControllerValue(data);
|
517
|
+
function copyLinkData(data, context) {
|
518
|
+
let value = data;
|
434
519
|
switch (value?.type) {
|
435
520
|
case "OPEN_PAGE":
|
436
521
|
{
|
@@ -465,26 +550,31 @@ function copyLinkPropControllerData(data, context) {
|
|
465
550
|
break;
|
466
551
|
}
|
467
552
|
}
|
553
|
+
return value;
|
554
|
+
}
|
555
|
+
function copyLinkPropControllerData(data, context) {
|
556
|
+
if (data == null)
|
557
|
+
return data;
|
558
|
+
const value = copyLinkData(getLinkPropControllerDataLinkData(data), context);
|
559
|
+
if (value == null)
|
560
|
+
return value;
|
468
561
|
return (0, import_ts_pattern6.match)(data).with({ [ControlDataTypeKey]: LinkPropControllerDataV1Type }, (v1) => ({
|
469
562
|
...v1,
|
470
563
|
value
|
471
564
|
})).otherwise((_) => value);
|
472
565
|
}
|
473
|
-
function Link(options = {}) {
|
474
|
-
return { type: Types.Link, version: 1, options };
|
475
|
-
}
|
476
566
|
|
477
567
|
// src/margin/margin.ts
|
478
568
|
var import_ts_pattern7 = require("ts-pattern");
|
479
|
-
var
|
480
|
-
var marginSideDataSchema =
|
481
|
-
|
482
|
-
value:
|
483
|
-
unit:
|
569
|
+
var import_zod9 = require("zod");
|
570
|
+
var marginSideDataSchema = import_zod9.z.union([
|
571
|
+
import_zod9.z.object({
|
572
|
+
value: import_zod9.z.number(),
|
573
|
+
unit: import_zod9.z.literal("px")
|
484
574
|
}),
|
485
|
-
|
575
|
+
import_zod9.z.literal("auto")
|
486
576
|
]);
|
487
|
-
var marginDataSchema =
|
577
|
+
var marginDataSchema = import_zod9.z.object({
|
488
578
|
marginTop: marginSideDataSchema.nullable().optional(),
|
489
579
|
marginRight: marginSideDataSchema.nullable().optional(),
|
490
580
|
marginBottom: marginSideDataSchema.nullable().optional(),
|
@@ -498,11 +588,11 @@ var marginDataSchema = import_zod8.z.object({
|
|
498
588
|
var responsiveMarginDataSchema = createResponsiveValueSchema(marginDataSchema);
|
499
589
|
var marginPropControllerDataV0Schema = responsiveMarginDataSchema;
|
500
590
|
var MarginPropControllerDataV1Type = "prop-controllers::margin::v1";
|
501
|
-
var marginPropControllerDataV1Schema =
|
502
|
-
[ControlDataTypeKey]:
|
591
|
+
var marginPropControllerDataV1Schema = import_zod9.z.object({
|
592
|
+
[ControlDataTypeKey]: import_zod9.z.literal(MarginPropControllerDataV1Type),
|
503
593
|
value: responsiveMarginDataSchema
|
504
594
|
});
|
505
|
-
var marginPropControllerDataSchema =
|
595
|
+
var marginPropControllerDataSchema = import_zod9.z.union([
|
506
596
|
marginPropControllerDataV0Schema,
|
507
597
|
marginPropControllerDataV1Schema
|
508
598
|
]);
|
@@ -531,96 +621,64 @@ function createMarginPropControllerDataFromResponsiveMarginData(responsiveMargin
|
|
531
621
|
).otherwise(() => responsiveMarginData);
|
532
622
|
}
|
533
623
|
|
534
|
-
// src/
|
535
|
-
var
|
536
|
-
var
|
537
|
-
var numberPropControllerDataV0Schema = import_zod9.z.number();
|
538
|
-
var NumberPropControllerDataV1Type = "prop-controllers::number::v1";
|
539
|
-
var numberPropControllerDataV1Schema = import_zod9.z.object({
|
540
|
-
[ControlDataTypeKey]: import_zod9.z.literal(NumberPropControllerDataV1Type),
|
541
|
-
value: import_zod9.z.number()
|
542
|
-
});
|
543
|
-
var numberPropControllerDataSchema = import_zod9.z.union([
|
544
|
-
numberPropControllerDataV0Schema,
|
545
|
-
numberPropControllerDataV1Schema
|
546
|
-
]);
|
547
|
-
function Number(options = {}) {
|
548
|
-
return { type: Types.Number, version: 1, options };
|
549
|
-
}
|
550
|
-
function getNumberPropControllerDataNumber(data) {
|
551
|
-
return (0, import_ts_pattern8.match)(data).with(
|
552
|
-
{ [ControlDataTypeKey]: NumberPropControllerDataV1Type },
|
553
|
-
(v1) => v1.value
|
554
|
-
).otherwise((v0) => v0);
|
555
|
-
}
|
556
|
-
function createNumberPropControllerDataFromNumber(value, definition) {
|
557
|
-
return (0, import_ts_pattern8.match)(definition).with(
|
558
|
-
{ version: 1 },
|
559
|
-
import_ts_pattern8.P.nullish,
|
560
|
-
() => ({
|
561
|
-
[ControlDataTypeKey]: NumberPropControllerDataV1Type,
|
562
|
-
value
|
563
|
-
})
|
564
|
-
).otherwise(() => value);
|
565
|
-
}
|
624
|
+
// src/navigation-links/navigation-links.ts
|
625
|
+
var import_ts_pattern10 = require("ts-pattern");
|
626
|
+
var import_zod12 = require("zod");
|
566
627
|
|
567
|
-
// src/
|
568
|
-
var
|
628
|
+
// src/text-style/text-style.ts
|
629
|
+
var import_ts_pattern8 = require("ts-pattern");
|
569
630
|
var import_zod10 = require("zod");
|
570
|
-
var
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
631
|
+
var textStyleDataSchema = import_zod10.z.object({
|
632
|
+
fontFamily: import_zod10.z.string().optional().nullable(),
|
633
|
+
letterSpacing: import_zod10.z.number().optional().nullable(),
|
634
|
+
fontSize: import_zod10.z.object({
|
635
|
+
value: import_zod10.z.number(),
|
636
|
+
unit: import_zod10.z.literal("px")
|
637
|
+
}).optional().nullable(),
|
638
|
+
fontWeight: import_zod10.z.number().optional().nullable(),
|
639
|
+
textTransform: import_zod10.z.array(import_zod10.z.literal("uppercase")),
|
640
|
+
fontStyle: import_zod10.z.array(import_zod10.z.literal("italic"))
|
579
641
|
}).transform((v) => ({
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
642
|
+
...v,
|
643
|
+
letterSpacing: v.letterSpacing,
|
644
|
+
fontSize: v.fontSize,
|
645
|
+
fontWeight: v.fontWeight,
|
646
|
+
textTransform: v.textTransform,
|
647
|
+
fontStyle: v.fontStyle
|
584
648
|
}));
|
585
|
-
var
|
586
|
-
var
|
587
|
-
var
|
588
|
-
var
|
589
|
-
[ControlDataTypeKey]: import_zod10.z.literal(
|
590
|
-
value:
|
649
|
+
var responsiveTextStyleDataSchema = createResponsiveValueSchema(textStyleDataSchema);
|
650
|
+
var textStylePropControllerDataV0Schema = responsiveTextStyleDataSchema;
|
651
|
+
var TextStylePropControllerDataV1Type = "prop-controllers::text-style::v1";
|
652
|
+
var textStylePropControllerDataV1Schema = import_zod10.z.object({
|
653
|
+
[ControlDataTypeKey]: import_zod10.z.literal(TextStylePropControllerDataV1Type),
|
654
|
+
value: responsiveTextStyleDataSchema
|
591
655
|
});
|
592
|
-
var
|
593
|
-
|
594
|
-
|
656
|
+
var textStylePropControllerDataSchema = import_zod10.z.union([
|
657
|
+
textStylePropControllerDataV0Schema,
|
658
|
+
textStylePropControllerDataV1Schema
|
595
659
|
]);
|
596
|
-
|
597
|
-
|
598
|
-
ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
|
599
|
-
};
|
600
|
-
function Padding(options = {}) {
|
601
|
-
return { type: Types.Padding, version: 1, options };
|
660
|
+
function TextStyle(options = {}) {
|
661
|
+
return { type: Types.TextStyle, version: 1, options };
|
602
662
|
}
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
{ [ControlDataTypeKey]: PaddingPropControllerDataV1Type },
|
663
|
+
function getTextStylePropControllerDataResponsiveTextStyleData(data) {
|
664
|
+
return (0, import_ts_pattern8.match)(data).with(
|
665
|
+
{ [ControlDataTypeKey]: TextStylePropControllerDataV1Type },
|
607
666
|
(v1) => v1.value
|
608
667
|
).otherwise((v0) => v0);
|
609
668
|
}
|
610
|
-
function
|
611
|
-
return (0,
|
669
|
+
function createTextStylePropControllerDataFromResponsiveTextStyleData(responsiveTextStyleData, definition) {
|
670
|
+
return (0, import_ts_pattern8.match)(definition).with(
|
612
671
|
{ version: 1 },
|
613
|
-
import_ts_pattern9.P.nullish,
|
614
672
|
() => ({
|
615
|
-
[ControlDataTypeKey]:
|
616
|
-
value:
|
673
|
+
[ControlDataTypeKey]: TextStylePropControllerDataV1Type,
|
674
|
+
value: responsiveTextStyleData
|
617
675
|
})
|
618
|
-
).otherwise(() =>
|
676
|
+
).otherwise(() => responsiveTextStyleData);
|
619
677
|
}
|
620
678
|
|
621
679
|
// src/responsive-color.ts
|
622
680
|
var import_zod11 = require("zod");
|
623
|
-
var
|
681
|
+
var import_ts_pattern9 = require("ts-pattern");
|
624
682
|
var responsiveColorDataSchema = createResponsiveValueSchema(colorDataSchema);
|
625
683
|
var responsiveColorPropControllerDataV0Schema = responsiveColorDataSchema;
|
626
684
|
var ResponsiveColorPropControllerDataV1Type = "prop-controllers::responsive-color::v1";
|
@@ -636,13 +694,13 @@ function ResponsiveColor(options = {}) {
|
|
636
694
|
return { type: Types.ResponsiveColor, version: 1, options };
|
637
695
|
}
|
638
696
|
function getResponsiveColorPropControllerDataResponsiveColorData(data) {
|
639
|
-
return (0,
|
697
|
+
return (0, import_ts_pattern9.match)(data).with(
|
640
698
|
{ [ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type },
|
641
699
|
(v1) => v1.value
|
642
700
|
).otherwise((v0) => v0);
|
643
701
|
}
|
644
702
|
function createResponsiveColorPropControllerDataFromResponsiveColorData(definition, responsiveColorData) {
|
645
|
-
return (0,
|
703
|
+
return (0, import_ts_pattern9.match)(definition).with(
|
646
704
|
{ version: 1 },
|
647
705
|
() => ({
|
648
706
|
[ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type,
|
@@ -673,7 +731,7 @@ function copyResponsiveColorData(data, context) {
|
|
673
731
|
}
|
674
732
|
}
|
675
733
|
function copyResponsiveColorPropControllerData(data, context) {
|
676
|
-
return (0,
|
734
|
+
return (0, import_ts_pattern9.match)(data).with(void 0, () => void 0).with(
|
677
735
|
{ [ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type },
|
678
736
|
(v1) => ({
|
679
737
|
[ControlDataTypeKey]: ResponsiveColorPropControllerDataV1Type,
|
@@ -682,17 +740,283 @@ function copyResponsiveColorPropControllerData(data, context) {
|
|
682
740
|
).otherwise((v0) => copyResponsiveColorData(v0, context));
|
683
741
|
}
|
684
742
|
|
685
|
-
// src/
|
686
|
-
var
|
743
|
+
// src/navigation-links/navigation-links.ts
|
744
|
+
var buttonVariantSchema = import_zod12.z.enum([
|
745
|
+
"flat",
|
746
|
+
"outline",
|
747
|
+
"shadow",
|
748
|
+
"clear",
|
749
|
+
"blocky",
|
750
|
+
"bubbly",
|
751
|
+
"skewed"
|
752
|
+
]);
|
753
|
+
var buttonShapeSchema = import_zod12.z.enum(["pill", "rounded", "square"]);
|
754
|
+
var buttonSizeSchema = import_zod12.z.enum(["small", "medium", "large"]);
|
755
|
+
var navigationButtonSchema = import_zod12.z.object({
|
756
|
+
id: import_zod12.z.string(),
|
757
|
+
type: import_zod12.z.literal("button"),
|
758
|
+
payload: import_zod12.z.object({
|
759
|
+
label: import_zod12.z.string(),
|
760
|
+
link: linkDataSchema.optional(),
|
761
|
+
variant: createResponsiveValueSchema(buttonVariantSchema).optional(),
|
762
|
+
shape: createResponsiveValueSchema(buttonShapeSchema).optional(),
|
763
|
+
size: createResponsiveValueSchema(buttonSizeSchema).optional(),
|
764
|
+
textColor: createResponsiveValueSchema(colorDataSchema).optional(),
|
765
|
+
color: createResponsiveValueSchema(colorDataSchema).optional(),
|
766
|
+
textStyle: createResponsiveValueSchema(textStyleDataSchema).optional()
|
767
|
+
})
|
768
|
+
});
|
769
|
+
var navigationDropdownCaretTypeSchema = import_zod12.z.union([
|
770
|
+
import_zod12.z.literal("caret"),
|
771
|
+
import_zod12.z.literal("plus"),
|
772
|
+
import_zod12.z.literal("arrow-down"),
|
773
|
+
import_zod12.z.literal("chevron-down")
|
774
|
+
]);
|
775
|
+
var navigationDropdownLinkSchema = import_zod12.z.object({
|
776
|
+
id: import_zod12.z.string(),
|
777
|
+
payload: import_zod12.z.object({
|
778
|
+
label: import_zod12.z.string(),
|
779
|
+
link: linkDataSchema.optional(),
|
780
|
+
color: createResponsiveValueSchema(colorDataSchema).optional(),
|
781
|
+
textStyle: createResponsiveValueSchema(textStyleDataSchema).optional()
|
782
|
+
})
|
783
|
+
});
|
784
|
+
var navigationDropdownSchema = import_zod12.z.object({
|
785
|
+
id: import_zod12.z.string(),
|
786
|
+
type: import_zod12.z.literal("dropdown"),
|
787
|
+
payload: import_zod12.z.object({
|
788
|
+
label: import_zod12.z.string(),
|
789
|
+
caret: navigationDropdownCaretTypeSchema.optional(),
|
790
|
+
links: import_zod12.z.array(navigationDropdownLinkSchema).optional(),
|
791
|
+
variant: createResponsiveValueSchema(buttonVariantSchema).optional(),
|
792
|
+
shape: createResponsiveValueSchema(buttonShapeSchema).optional(),
|
793
|
+
size: createResponsiveValueSchema(buttonSizeSchema).optional(),
|
794
|
+
textColor: createResponsiveValueSchema(colorDataSchema).optional(),
|
795
|
+
color: createResponsiveValueSchema(colorDataSchema).optional(),
|
796
|
+
textStyle: createResponsiveValueSchema(textStyleDataSchema).optional()
|
797
|
+
})
|
798
|
+
});
|
799
|
+
var navigationLinksDataSchema = import_zod12.z.array(
|
800
|
+
import_zod12.z.union([navigationButtonSchema, navigationDropdownSchema])
|
801
|
+
);
|
802
|
+
var navigationLinksPropControllerDataV0Schema = navigationLinksDataSchema;
|
803
|
+
var NavigationLinksPropControllerDataV1Type = "prop-controllers::navigation-links::v1";
|
804
|
+
var navigationLinksPropControllerDataV1Schema = import_zod12.z.object({
|
805
|
+
[ControlDataTypeKey]: import_zod12.z.literal(NavigationLinksPropControllerDataV1Type),
|
806
|
+
value: navigationLinksDataSchema
|
807
|
+
});
|
808
|
+
var navigationLinksPropControllerDataSchema = import_zod12.z.union([
|
809
|
+
navigationLinksPropControllerDataV0Schema,
|
810
|
+
navigationLinksPropControllerDataV1Schema
|
811
|
+
]);
|
812
|
+
function NavigationLinks(options = {}) {
|
813
|
+
return { type: Types.NavigationLinks, version: 1, options };
|
814
|
+
}
|
815
|
+
function getNavigationLinksPropControllerDataNavigationLinksData(data) {
|
816
|
+
return (0, import_ts_pattern10.match)(data).with(
|
817
|
+
{ [ControlDataTypeKey]: NavigationLinksPropControllerDataV1Type },
|
818
|
+
(v1) => v1.value
|
819
|
+
).otherwise((v0) => v0);
|
820
|
+
}
|
821
|
+
function createNavigationLinksPropControllerDataFromNavigationLinksData(navigationLinksData, definition) {
|
822
|
+
return (0, import_ts_pattern10.match)(definition).with(
|
823
|
+
{ version: 1 },
|
824
|
+
() => ({
|
825
|
+
[ControlDataTypeKey]: NavigationLinksPropControllerDataV1Type,
|
826
|
+
value: navigationLinksData
|
827
|
+
})
|
828
|
+
).otherwise(() => navigationLinksData);
|
829
|
+
}
|
830
|
+
function getNavigationLinksPropControllerPageIds(data) {
|
831
|
+
if (data == null)
|
832
|
+
return [];
|
833
|
+
const value = getNavigationLinksPropControllerDataNavigationLinksData(data);
|
834
|
+
return value?.flatMap((item) => {
|
835
|
+
switch (item.type) {
|
836
|
+
case "button": {
|
837
|
+
if (item.payload.link == null)
|
838
|
+
return [];
|
839
|
+
switch (item.payload.link.type) {
|
840
|
+
case "OPEN_PAGE":
|
841
|
+
return item.payload.link.payload.pageId == null ? [] : [item.payload.link.payload.pageId];
|
842
|
+
default:
|
843
|
+
return [];
|
844
|
+
}
|
845
|
+
}
|
846
|
+
case "dropdown": {
|
847
|
+
return item.payload.links?.flatMap((link) => {
|
848
|
+
if (link.payload.link == null)
|
849
|
+
return [];
|
850
|
+
switch (link.payload.link.type) {
|
851
|
+
case "OPEN_PAGE":
|
852
|
+
return link.payload.link.payload.pageId == null ? [] : [link.payload.link.payload.pageId];
|
853
|
+
default:
|
854
|
+
return [];
|
855
|
+
}
|
856
|
+
}) ?? [];
|
857
|
+
}
|
858
|
+
}
|
859
|
+
}) ?? [];
|
860
|
+
}
|
861
|
+
function getNavigationLinksPropControllerSwatchIds(data) {
|
862
|
+
if (data == null)
|
863
|
+
return [];
|
864
|
+
const value = getNavigationLinksPropControllerDataNavigationLinksData(data);
|
865
|
+
return value?.flatMap((item) => {
|
866
|
+
switch (item.type) {
|
867
|
+
case "button":
|
868
|
+
case "dropdown":
|
869
|
+
return [
|
870
|
+
...item.payload.color?.map((override) => override.value).map((color) => color.swatchId) ?? [],
|
871
|
+
...item.payload.textColor?.map((override) => override.value).map((color) => color.swatchId) ?? []
|
872
|
+
];
|
873
|
+
}
|
874
|
+
}) ?? [];
|
875
|
+
}
|
876
|
+
function copyNavigationLinksData(data, context) {
|
877
|
+
return data?.map((item) => {
|
878
|
+
switch (item.type) {
|
879
|
+
case "button": {
|
880
|
+
const { color, link } = item.payload;
|
881
|
+
return {
|
882
|
+
...item,
|
883
|
+
payload: {
|
884
|
+
...item.payload,
|
885
|
+
link: copyLinkData(link, context),
|
886
|
+
color: color != null ? copyResponsiveColorData(color, context) : void 0
|
887
|
+
}
|
888
|
+
};
|
889
|
+
}
|
890
|
+
case "dropdown": {
|
891
|
+
const { color, links } = item.payload;
|
892
|
+
return {
|
893
|
+
...item,
|
894
|
+
payload: {
|
895
|
+
...item.payload,
|
896
|
+
links: links != null ? links.map((link) => ({
|
897
|
+
...link,
|
898
|
+
payload: {
|
899
|
+
...link.payload,
|
900
|
+
link: copyLinkData(link.payload.link, context)
|
901
|
+
}
|
902
|
+
})) : void 0,
|
903
|
+
color: color != null ? copyResponsiveColorData(color, context) : void 0
|
904
|
+
}
|
905
|
+
};
|
906
|
+
}
|
907
|
+
default:
|
908
|
+
return item;
|
909
|
+
}
|
910
|
+
});
|
911
|
+
}
|
912
|
+
function copyNavigationLinksPropControllerData(data, context) {
|
913
|
+
return (0, import_ts_pattern10.match)(data).with(void 0, () => void 0).with(
|
914
|
+
{ [ControlDataTypeKey]: NavigationLinksPropControllerDataV1Type },
|
915
|
+
(v1) => ({
|
916
|
+
[ControlDataTypeKey]: NavigationLinksPropControllerDataV1Type,
|
917
|
+
value: copyNavigationLinksData(v1.value, context)
|
918
|
+
})
|
919
|
+
).otherwise((v0) => copyNavigationLinksData(v0, context));
|
920
|
+
}
|
921
|
+
|
922
|
+
// src/number.ts
|
923
|
+
var import_zod13 = require("zod");
|
687
924
|
var import_ts_pattern11 = require("ts-pattern");
|
925
|
+
var numberPropControllerDataV0Schema = import_zod13.z.number();
|
926
|
+
var NumberPropControllerDataV1Type = "prop-controllers::number::v1";
|
927
|
+
var numberPropControllerDataV1Schema = import_zod13.z.object({
|
928
|
+
[ControlDataTypeKey]: import_zod13.z.literal(NumberPropControllerDataV1Type),
|
929
|
+
value: import_zod13.z.number()
|
930
|
+
});
|
931
|
+
var numberPropControllerDataSchema = import_zod13.z.union([
|
932
|
+
numberPropControllerDataV0Schema,
|
933
|
+
numberPropControllerDataV1Schema
|
934
|
+
]);
|
935
|
+
function Number(options = {}) {
|
936
|
+
return { type: Types.Number, version: 1, options };
|
937
|
+
}
|
938
|
+
function getNumberPropControllerDataNumber(data) {
|
939
|
+
return (0, import_ts_pattern11.match)(data).with(
|
940
|
+
{ [ControlDataTypeKey]: NumberPropControllerDataV1Type },
|
941
|
+
(v1) => v1.value
|
942
|
+
).otherwise((v0) => v0);
|
943
|
+
}
|
944
|
+
function createNumberPropControllerDataFromNumber(value, definition) {
|
945
|
+
return (0, import_ts_pattern11.match)(definition).with(
|
946
|
+
{ version: 1 },
|
947
|
+
import_ts_pattern11.P.nullish,
|
948
|
+
() => ({
|
949
|
+
[ControlDataTypeKey]: NumberPropControllerDataV1Type,
|
950
|
+
value
|
951
|
+
})
|
952
|
+
).otherwise(() => value);
|
953
|
+
}
|
954
|
+
|
955
|
+
// src/padding/padding.ts
|
956
|
+
var import_ts_pattern12 = require("ts-pattern");
|
957
|
+
var import_zod14 = require("zod");
|
958
|
+
var paddingSideDataSchema = import_zod14.z.object({
|
959
|
+
value: import_zod14.z.number(),
|
960
|
+
unit: import_zod14.z.literal("px")
|
961
|
+
});
|
962
|
+
var paddingDataSchema = import_zod14.z.object({
|
963
|
+
paddingTop: paddingSideDataSchema.nullable().optional(),
|
964
|
+
paddingRight: paddingSideDataSchema.nullable().optional(),
|
965
|
+
paddingBottom: paddingSideDataSchema.nullable().optional(),
|
966
|
+
paddingLeft: paddingSideDataSchema.nullable().optional()
|
967
|
+
}).transform((v) => ({
|
968
|
+
paddingTop: v.paddingTop,
|
969
|
+
paddingRight: v.paddingRight,
|
970
|
+
paddingBottom: v.paddingBottom,
|
971
|
+
paddingLeft: v.paddingLeft
|
972
|
+
}));
|
973
|
+
var responsivePaddingDataSchema = createResponsiveValueSchema(paddingDataSchema);
|
974
|
+
var paddingPropControllerDataV0Schema = responsivePaddingDataSchema;
|
975
|
+
var PaddingPropControllerDataV1Type = "prop-controllers::padding::v1";
|
976
|
+
var paddingPropControllerDataV1Schema = import_zod14.z.object({
|
977
|
+
[ControlDataTypeKey]: import_zod14.z.literal(PaddingPropControllerDataV1Type),
|
978
|
+
value: responsivePaddingDataSchema
|
979
|
+
});
|
980
|
+
var paddingPropControllerDataSchema = import_zod14.z.union([
|
981
|
+
paddingPropControllerDataV0Schema,
|
982
|
+
paddingPropControllerDataV1Schema
|
983
|
+
]);
|
984
|
+
var PaddingPropControllerFormat = {
|
985
|
+
ClassName: "makeswift::prop-controllers::padding::format::class-name",
|
986
|
+
ResponsiveValue: "makeswift::prop-controllers::padding::format::responsive-value"
|
987
|
+
};
|
988
|
+
function Padding(options = {}) {
|
989
|
+
return { type: Types.Padding, version: 1, options };
|
990
|
+
}
|
991
|
+
Padding.Format = PaddingPropControllerFormat;
|
992
|
+
function getPaddingPropControllerDataResponsivePaddingData(data) {
|
993
|
+
return (0, import_ts_pattern12.match)(data).with(
|
994
|
+
{ [ControlDataTypeKey]: PaddingPropControllerDataV1Type },
|
995
|
+
(v1) => v1.value
|
996
|
+
).otherwise((v0) => v0);
|
997
|
+
}
|
998
|
+
function createPaddingPropControllerDataFromResponsivePaddingData(responsivePaddingData, definition) {
|
999
|
+
return (0, import_ts_pattern12.match)(definition).with(
|
1000
|
+
{ version: 1 },
|
1001
|
+
import_ts_pattern12.P.nullish,
|
1002
|
+
() => ({
|
1003
|
+
[ControlDataTypeKey]: PaddingPropControllerDataV1Type,
|
1004
|
+
value: responsivePaddingData
|
1005
|
+
})
|
1006
|
+
).otherwise(() => responsivePaddingData);
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
// src/responsive-length.ts
|
1010
|
+
var import_zod15 = require("zod");
|
1011
|
+
var import_ts_pattern13 = require("ts-pattern");
|
688
1012
|
var responsiveLengthDataSchema = createResponsiveValueSchema(lengthDataSchema);
|
689
1013
|
var responsiveLengthPropControllerDataV0Schema = responsiveLengthDataSchema;
|
690
1014
|
var ResponsiveLengthPropControllerDataV1Type = "prop-controllers::responsive-length::v1";
|
691
|
-
var responsiveLengthPropControllerDataV1Schema =
|
692
|
-
[ControlDataTypeKey]:
|
1015
|
+
var responsiveLengthPropControllerDataV1Schema = import_zod15.z.object({
|
1016
|
+
[ControlDataTypeKey]: import_zod15.z.literal(ResponsiveLengthPropControllerDataV1Type),
|
693
1017
|
value: responsiveLengthDataSchema
|
694
1018
|
});
|
695
|
-
var responsiveLengthPropControllerDataSchema =
|
1019
|
+
var responsiveLengthPropControllerDataSchema = import_zod15.z.union([
|
696
1020
|
responsiveLengthPropControllerDataV0Schema,
|
697
1021
|
responsiveLengthPropControllerDataV1Schema
|
698
1022
|
]);
|
@@ -700,13 +1024,13 @@ function ResponsiveLength(options = {}) {
|
|
700
1024
|
return { type: Types.ResponsiveLength, version: 1, options };
|
701
1025
|
}
|
702
1026
|
function getResponsiveLengthPropControllerDataResponsiveLengthData(data) {
|
703
|
-
return (0,
|
1027
|
+
return (0, import_ts_pattern13.match)(data).with(
|
704
1028
|
{ [ControlDataTypeKey]: ResponsiveLengthPropControllerDataV1Type },
|
705
1029
|
(v1) => v1.value
|
706
1030
|
).otherwise((v0) => v0);
|
707
1031
|
}
|
708
1032
|
function createResponsiveLengthPropControllerDataFromResponsiveLengthData(definition, responsiveLengthData) {
|
709
|
-
return (0,
|
1033
|
+
return (0, import_ts_pattern13.match)(definition).with(
|
710
1034
|
{ version: 1 },
|
711
1035
|
() => ({
|
712
1036
|
[ControlDataTypeKey]: ResponsiveLengthPropControllerDataV1Type,
|
@@ -716,30 +1040,30 @@ function createResponsiveLengthPropControllerDataFromResponsiveLengthData(defini
|
|
716
1040
|
}
|
717
1041
|
|
718
1042
|
// src/shadows.ts
|
719
|
-
var
|
720
|
-
var
|
721
|
-
var shadowDataSchema =
|
1043
|
+
var import_ts_pattern14 = require("ts-pattern");
|
1044
|
+
var import_zod16 = require("zod");
|
1045
|
+
var shadowDataSchema = import_zod16.z.object({
|
722
1046
|
color: colorDataSchema.nullable().optional(),
|
723
|
-
blurRadius:
|
724
|
-
spreadRadius:
|
725
|
-
offsetX:
|
726
|
-
offsetY:
|
727
|
-
inset:
|
1047
|
+
blurRadius: import_zod16.z.number().optional(),
|
1048
|
+
spreadRadius: import_zod16.z.number().optional(),
|
1049
|
+
offsetX: import_zod16.z.number().optional(),
|
1050
|
+
offsetY: import_zod16.z.number().optional(),
|
1051
|
+
inset: import_zod16.z.boolean().optional()
|
728
1052
|
});
|
729
|
-
var shadowsDataSchema =
|
730
|
-
|
731
|
-
id:
|
1053
|
+
var shadowsDataSchema = import_zod16.z.array(
|
1054
|
+
import_zod16.z.object({
|
1055
|
+
id: import_zod16.z.string(),
|
732
1056
|
payload: shadowDataSchema
|
733
1057
|
})
|
734
1058
|
);
|
735
1059
|
var responsiveShadowsDataSchema = createResponsiveValueSchema(shadowsDataSchema);
|
736
1060
|
var shadowsPropControllerDataV0Schema = responsiveShadowsDataSchema;
|
737
1061
|
var ShadowsPropControllerDataV1Type = "prop-controllers::shadows::v1";
|
738
|
-
var shadowsPropControllerDataV1Schema =
|
739
|
-
[ControlDataTypeKey]:
|
1062
|
+
var shadowsPropControllerDataV1Schema = import_zod16.z.object({
|
1063
|
+
[ControlDataTypeKey]: import_zod16.z.literal(ShadowsPropControllerDataV1Type),
|
740
1064
|
value: responsiveShadowsDataSchema
|
741
1065
|
});
|
742
|
-
var shadowsPropControllerDataSchema =
|
1066
|
+
var shadowsPropControllerDataSchema = import_zod16.z.union([
|
743
1067
|
shadowsPropControllerDataV0Schema,
|
744
1068
|
shadowsPropControllerDataV1Schema
|
745
1069
|
]);
|
@@ -752,13 +1076,13 @@ function Shadows(options = {}) {
|
|
752
1076
|
}
|
753
1077
|
Shadows.Format = ShadowsPropControllerFormat;
|
754
1078
|
function getShadowsPropControllerDataResponsiveShadowsData(data) {
|
755
|
-
return (0,
|
1079
|
+
return (0, import_ts_pattern14.match)(data).with(
|
756
1080
|
{ [ControlDataTypeKey]: ShadowsPropControllerDataV1Type },
|
757
1081
|
(v1) => v1.value
|
758
1082
|
).otherwise((v0) => v0);
|
759
1083
|
}
|
760
1084
|
function createShadowsPropControllerDataFromResponsiveShadowsData(definition, responsiveShadowsData) {
|
761
|
-
return (0,
|
1085
|
+
return (0, import_ts_pattern14.match)(definition).with(
|
762
1086
|
{ version: 1 },
|
763
1087
|
() => ({
|
764
1088
|
[ControlDataTypeKey]: ShadowsPropControllerDataV1Type,
|
@@ -792,7 +1116,7 @@ function copyResponsiveShadowsData(data, context) {
|
|
792
1116
|
}));
|
793
1117
|
}
|
794
1118
|
function copyShadowsPropControllerData(data, context) {
|
795
|
-
return (0,
|
1119
|
+
return (0, import_ts_pattern14.match)(data).with(void 0, () => void 0).with(
|
796
1120
|
{ [ControlDataTypeKey]: ShadowsPropControllerDataV1Type },
|
797
1121
|
(v1) => ({
|
798
1122
|
[ControlDataTypeKey]: ShadowsPropControllerDataV1Type,
|
@@ -802,16 +1126,16 @@ function copyShadowsPropControllerData(data, context) {
|
|
802
1126
|
}
|
803
1127
|
|
804
1128
|
// src/table/table.ts
|
805
|
-
var
|
806
|
-
var
|
807
|
-
var tableIdSchema =
|
1129
|
+
var import_zod17 = require("zod");
|
1130
|
+
var import_ts_pattern15 = require("ts-pattern");
|
1131
|
+
var tableIdSchema = import_zod17.z.string();
|
808
1132
|
var tablePropControllerDataV0Schema = tableIdSchema;
|
809
1133
|
var TablePropControllerDataV1Type = "prop-controllers::table::v1";
|
810
|
-
var tablePropControllerDataV1Schema =
|
811
|
-
[ControlDataTypeKey]:
|
1134
|
+
var tablePropControllerDataV1Schema = import_zod17.z.object({
|
1135
|
+
[ControlDataTypeKey]: import_zod17.z.literal(TablePropControllerDataV1Type),
|
812
1136
|
value: tableIdSchema
|
813
1137
|
});
|
814
|
-
var tablePropControllerDataSchema =
|
1138
|
+
var tablePropControllerDataSchema = import_zod17.z.union([
|
815
1139
|
tablePropControllerDataV0Schema,
|
816
1140
|
tablePropControllerDataV1Schema
|
817
1141
|
]);
|
@@ -819,15 +1143,15 @@ function Table(options = {}) {
|
|
819
1143
|
return { type: Types.Table, version: 1, options };
|
820
1144
|
}
|
821
1145
|
function getTablePropControllerDataTableId(data) {
|
822
|
-
return (0,
|
1146
|
+
return (0, import_ts_pattern15.match)(data).with(
|
823
1147
|
{ [ControlDataTypeKey]: TablePropControllerDataV1Type },
|
824
1148
|
(v1) => v1.value
|
825
1149
|
).otherwise((v0) => v0);
|
826
1150
|
}
|
827
1151
|
function createTablePropControllerDataFromTableId(value, definition) {
|
828
|
-
return (0,
|
1152
|
+
return (0, import_ts_pattern15.match)(definition).with(
|
829
1153
|
{ version: 1 },
|
830
|
-
|
1154
|
+
import_ts_pattern15.P.nullish,
|
831
1155
|
() => ({
|
832
1156
|
[ControlDataTypeKey]: TablePropControllerDataV1Type,
|
833
1157
|
value
|
@@ -840,7 +1164,7 @@ function copyTableId(data, context) {
|
|
840
1164
|
return context.replacementContext.tableIds.get(data) ?? data;
|
841
1165
|
}
|
842
1166
|
function copyTablePropControllerData(data, context) {
|
843
|
-
return (0,
|
1167
|
+
return (0, import_ts_pattern15.match)(data).with(void 0, () => void 0).with(
|
844
1168
|
{ [ControlDataTypeKey]: TablePropControllerDataV1Type },
|
845
1169
|
(v1) => ({
|
846
1170
|
[ControlDataTypeKey]: TablePropControllerDataV1Type,
|
@@ -853,67 +1177,16 @@ function getTablePropControllerDataTableIds(data) {
|
|
853
1177
|
return value ? [value] : [];
|
854
1178
|
}
|
855
1179
|
|
856
|
-
// src/text-style/text-style.ts
|
857
|
-
var import_ts_pattern14 = require("ts-pattern");
|
858
|
-
var import_zod15 = require("zod");
|
859
|
-
var textStyleDataSchema = import_zod15.z.object({
|
860
|
-
fontFamily: import_zod15.z.string().optional().nullable(),
|
861
|
-
letterSpacing: import_zod15.z.number().optional().nullable(),
|
862
|
-
fontSize: import_zod15.z.object({
|
863
|
-
value: import_zod15.z.number(),
|
864
|
-
unit: import_zod15.z.literal("px")
|
865
|
-
}).optional().nullable(),
|
866
|
-
fontWeight: import_zod15.z.number().optional().nullable(),
|
867
|
-
textTransform: import_zod15.z.array(import_zod15.z.literal("uppercase")),
|
868
|
-
fontStyle: import_zod15.z.array(import_zod15.z.literal("italic"))
|
869
|
-
}).transform((v) => ({
|
870
|
-
...v,
|
871
|
-
letterSpacing: v.letterSpacing,
|
872
|
-
fontSize: v.fontSize,
|
873
|
-
fontWeight: v.fontWeight,
|
874
|
-
textTransform: v.textTransform,
|
875
|
-
fontStyle: v.fontStyle
|
876
|
-
}));
|
877
|
-
var responsiveTextStyleDataSchema = createResponsiveValueSchema(textStyleDataSchema);
|
878
|
-
var textStylePropControllerDataV0Schema = responsiveTextStyleDataSchema;
|
879
|
-
var TextStylePropControllerDataV1Type = "prop-controllers::text-style::v1";
|
880
|
-
var textStylePropControllerDataV1Schema = import_zod15.z.object({
|
881
|
-
[ControlDataTypeKey]: import_zod15.z.literal(TextStylePropControllerDataV1Type),
|
882
|
-
value: responsiveTextStyleDataSchema
|
883
|
-
});
|
884
|
-
var textStylePropControllerDataSchema = import_zod15.z.union([
|
885
|
-
textStylePropControllerDataV0Schema,
|
886
|
-
textStylePropControllerDataV1Schema
|
887
|
-
]);
|
888
|
-
function TextStyle(options = {}) {
|
889
|
-
return { type: Types.TextStyle, version: 1, options };
|
890
|
-
}
|
891
|
-
function getTextStylePropControllerDataResponsiveTextStyleData(data) {
|
892
|
-
return (0, import_ts_pattern14.match)(data).with(
|
893
|
-
{ [ControlDataTypeKey]: TextStylePropControllerDataV1Type },
|
894
|
-
(v1) => v1.value
|
895
|
-
).otherwise((v0) => v0);
|
896
|
-
}
|
897
|
-
function createTextStylePropControllerDataFromResponsiveTextStyleData(responsiveTextStyleData, definition) {
|
898
|
-
return (0, import_ts_pattern14.match)(definition).with(
|
899
|
-
{ version: 1 },
|
900
|
-
() => ({
|
901
|
-
[ControlDataTypeKey]: TextStylePropControllerDataV1Type,
|
902
|
-
value: responsiveTextStyleData
|
903
|
-
})
|
904
|
-
).otherwise(() => responsiveTextStyleData);
|
905
|
-
}
|
906
|
-
|
907
1180
|
// src/width/width.ts
|
908
|
-
var
|
909
|
-
var
|
1181
|
+
var import_ts_pattern16 = require("ts-pattern");
|
1182
|
+
var import_zod18 = require("zod");
|
910
1183
|
var widthPropControllerDataV0Schema = responsiveLengthDataSchema;
|
911
1184
|
var WidthPropControllerDataV1Type = "prop-controllers::width::v1";
|
912
|
-
var widthPropControllerDataV1Schema =
|
913
|
-
[ControlDataTypeKey]:
|
1185
|
+
var widthPropControllerDataV1Schema = import_zod18.z.object({
|
1186
|
+
[ControlDataTypeKey]: import_zod18.z.literal(WidthPropControllerDataV1Type),
|
914
1187
|
value: responsiveLengthDataSchema
|
915
1188
|
});
|
916
|
-
var widthPropControllerDataSchema =
|
1189
|
+
var widthPropControllerDataSchema = import_zod18.z.union([
|
917
1190
|
widthPropControllerDataV0Schema,
|
918
1191
|
widthPropControllerDataV1Schema
|
919
1192
|
]);
|
@@ -926,15 +1199,15 @@ function Width(options = {}) {
|
|
926
1199
|
}
|
927
1200
|
Width.Format = WidthPropControllerFormat;
|
928
1201
|
function getWidthPropControllerDataResponsiveLengthData(data) {
|
929
|
-
return (0,
|
1202
|
+
return (0, import_ts_pattern16.match)(data).with(
|
930
1203
|
{ [ControlDataTypeKey]: WidthPropControllerDataV1Type },
|
931
1204
|
(v1) => v1.value
|
932
1205
|
).otherwise((v0) => v0);
|
933
1206
|
}
|
934
1207
|
function createWidthPropControllerDataFromResponsiveLengthData(responsiveLengthData, definition) {
|
935
|
-
return (0,
|
1208
|
+
return (0, import_ts_pattern16.match)(definition).with(
|
936
1209
|
{ version: 1 },
|
937
|
-
|
1210
|
+
import_ts_pattern16.P.nullish,
|
938
1211
|
() => ({
|
939
1212
|
[ControlDataTypeKey]: WidthPropControllerDataV1Type,
|
940
1213
|
value: responsiveLengthData
|
@@ -943,22 +1216,22 @@ function createWidthPropControllerDataFromResponsiveLengthData(responsiveLengthD
|
|
943
1216
|
}
|
944
1217
|
|
945
1218
|
// src/video/video.ts
|
946
|
-
var
|
947
|
-
var
|
948
|
-
var videoDataSchema =
|
949
|
-
url:
|
950
|
-
muted:
|
951
|
-
playing:
|
952
|
-
loop:
|
953
|
-
controls:
|
1219
|
+
var import_zod19 = require("zod");
|
1220
|
+
var import_ts_pattern17 = require("ts-pattern");
|
1221
|
+
var videoDataSchema = import_zod19.z.object({
|
1222
|
+
url: import_zod19.z.string().optional(),
|
1223
|
+
muted: import_zod19.z.boolean().optional(),
|
1224
|
+
playing: import_zod19.z.boolean().optional(),
|
1225
|
+
loop: import_zod19.z.boolean().optional(),
|
1226
|
+
controls: import_zod19.z.boolean().optional()
|
954
1227
|
});
|
955
1228
|
var videoPropControllerDataV0Schema = videoDataSchema;
|
956
1229
|
var VideoPropControllerDataV1Type = "prop-controllers::video::v1";
|
957
|
-
var videoPropControllerDataV1Schema =
|
958
|
-
[ControlDataTypeKey]:
|
1230
|
+
var videoPropControllerDataV1Schema = import_zod19.z.object({
|
1231
|
+
[ControlDataTypeKey]: import_zod19.z.literal(VideoPropControllerDataV1Type),
|
959
1232
|
value: videoDataSchema
|
960
1233
|
});
|
961
|
-
var videoPropControllerDataSchema =
|
1234
|
+
var videoPropControllerDataSchema = import_zod19.z.union([
|
962
1235
|
videoPropControllerDataV1Schema,
|
963
1236
|
videoPropControllerDataV0Schema
|
964
1237
|
]);
|
@@ -966,15 +1239,15 @@ function Video(options = {}) {
|
|
966
1239
|
return { type: Types.Video, version: 1, options };
|
967
1240
|
}
|
968
1241
|
function getVideoPropControllerDataVideoData(data) {
|
969
|
-
return (0,
|
1242
|
+
return (0, import_ts_pattern17.match)(data).with(
|
970
1243
|
{ [ControlDataTypeKey]: VideoPropControllerDataV1Type },
|
971
1244
|
(v1) => v1.value
|
972
1245
|
).otherwise((v0) => v0);
|
973
1246
|
}
|
974
1247
|
function createVideoPropControllerDataFromVideoData(value, definition) {
|
975
|
-
return (0,
|
1248
|
+
return (0, import_ts_pattern17.match)(definition).with(
|
976
1249
|
{ version: 1 },
|
977
|
-
|
1250
|
+
import_ts_pattern17.P.nullish,
|
978
1251
|
() => ({
|
979
1252
|
[ControlDataTypeKey]: VideoPropControllerDataV1Type,
|
980
1253
|
value
|
@@ -992,9 +1265,9 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
|
|
992
1265
|
Date,
|
993
1266
|
Font,
|
994
1267
|
Link,
|
995
|
-
LinkPropControllerDataV1Type,
|
996
1268
|
Margin,
|
997
1269
|
MarginPropControllerFormat,
|
1270
|
+
NavigationLinks,
|
998
1271
|
Number,
|
999
1272
|
Padding,
|
1000
1273
|
PaddingPropControllerFormat,
|
@@ -1013,6 +1286,7 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
|
|
1013
1286
|
checkboxPropControllerDataSchema,
|
1014
1287
|
copyBorderPropControllerData,
|
1015
1288
|
copyLinkPropControllerData,
|
1289
|
+
copyNavigationLinksPropControllerData,
|
1016
1290
|
copyResponsiveColorPropControllerData,
|
1017
1291
|
copyShadowsPropControllerData,
|
1018
1292
|
copyTablePropControllerData,
|
@@ -1021,7 +1295,9 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
|
|
1021
1295
|
createCheckboxPropControllerDataFromBoolean,
|
1022
1296
|
createDatePropControllerDataFromString,
|
1023
1297
|
createFontPropControllerDataFromResponsiveFontData,
|
1298
|
+
createLinkPropControllerDataFromLinkData,
|
1024
1299
|
createMarginPropControllerDataFromResponsiveMarginData,
|
1300
|
+
createNavigationLinksPropControllerDataFromNavigationLinksData,
|
1025
1301
|
createNumberPropControllerDataFromNumber,
|
1026
1302
|
createPaddingPropControllerDataFromResponsivePaddingData,
|
1027
1303
|
createResponsiveColorPropControllerDataFromResponsiveColorData,
|
@@ -1040,9 +1316,12 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
|
|
1040
1316
|
getCheckboxPropControllerDataBoolean,
|
1041
1317
|
getDatePropControllerDataString,
|
1042
1318
|
getFontPropControllerDataResponsiveFontData,
|
1319
|
+
getLinkPropControllerDataLinkData,
|
1043
1320
|
getLinkPropControllerPageIds,
|
1044
|
-
getLinkPropControllerValue,
|
1045
1321
|
getMarginPropControllerDataResponsiveMarginData,
|
1322
|
+
getNavigationLinksPropControllerDataNavigationLinksData,
|
1323
|
+
getNavigationLinksPropControllerPageIds,
|
1324
|
+
getNavigationLinksPropControllerSwatchIds,
|
1046
1325
|
getNumberPropControllerDataNumber,
|
1047
1326
|
getPaddingPropControllerDataResponsivePaddingData,
|
1048
1327
|
getResponsiveColorDataSwatchIds,
|
@@ -1056,7 +1335,10 @@ function createVideoPropControllerDataFromVideoData(value, definition) {
|
|
1056
1335
|
getTextStylePropControllerDataResponsiveTextStyleData,
|
1057
1336
|
getVideoPropControllerDataVideoData,
|
1058
1337
|
getWidthPropControllerDataResponsiveLengthData,
|
1338
|
+
linkDataSchema,
|
1339
|
+
linkPropControllerDataSchema,
|
1059
1340
|
marginPropControllerDataSchema,
|
1341
|
+
navigationLinksPropControllerDataSchema,
|
1060
1342
|
numberPropControllerDataSchema,
|
1061
1343
|
paddingPropControllerDataSchema,
|
1062
1344
|
responsiveColorPropControllerDataSchema,
|