@tapcart/mobile-components 0.7.9 → 0.7.10
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/components/hooks/use-tap.d.ts +8 -0
- package/dist/components/hooks/use-tap.d.ts.map +1 -0
- package/dist/components/hooks/use-tap.js +100 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +13 -0
- package/dist/styles.css +13 -0
- package/package.json +1 -1
- package/dist/components/hooks/use-style-utils.d.ts +0 -69
- package/dist/components/hooks/use-style-utils.d.ts.map +0 -1
- package/dist/components/hooks/use-style-utils.js +0 -77
- package/dist/lib/block-utils.d.ts +0 -97
- package/dist/lib/block-utils.d.ts.map +0 -1
- package/dist/lib/block-utils.js +0 -77
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const useTap: (tapThreshold?: number) => {
|
|
3
|
+
onTap: (handler: (event: any) => void) => (event: any) => void;
|
|
4
|
+
isPressed: boolean;
|
|
5
|
+
ref: React.MutableRefObject<null>;
|
|
6
|
+
};
|
|
7
|
+
export { useTap };
|
|
8
|
+
//# sourceMappingURL=use-tap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-tap.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAuFvE,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useEffect, useCallback, useRef } from "react";
|
|
3
|
+
// Shared manager for all instances of the hook
|
|
4
|
+
const tapManager = (() => {
|
|
5
|
+
const elements = new Map();
|
|
6
|
+
let isListening = false;
|
|
7
|
+
const startListening = () => {
|
|
8
|
+
if (isListening)
|
|
9
|
+
return;
|
|
10
|
+
const handleTouchStart = (e) => {
|
|
11
|
+
const touch = e.touches[0];
|
|
12
|
+
elements.forEach((data, el) => {
|
|
13
|
+
if (el.contains(touch.target)) {
|
|
14
|
+
data.touchStarted = true;
|
|
15
|
+
data.touchMoved = false;
|
|
16
|
+
data.startPosition = { x: touch.clientX, y: touch.clientY };
|
|
17
|
+
// Don't set isPressed here, wait to determine if it's a tap or drag
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const handleTouchMove = (e) => {
|
|
22
|
+
const touch = e.touches[0];
|
|
23
|
+
elements.forEach((data, el) => {
|
|
24
|
+
if (data.touchStarted) {
|
|
25
|
+
const deltaX = Math.abs(touch.clientX - data.startPosition.x);
|
|
26
|
+
const deltaY = Math.abs(touch.clientY - data.startPosition.y);
|
|
27
|
+
if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
|
|
28
|
+
data.touchMoved = true;
|
|
29
|
+
data.setIsPressed(false);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const handleTouchEnd = () => {
|
|
35
|
+
elements.forEach((data) => {
|
|
36
|
+
if (data.touchStarted) {
|
|
37
|
+
data.touchStarted = false;
|
|
38
|
+
if (!data.touchMoved) {
|
|
39
|
+
// It's a tap, set isPressed briefly
|
|
40
|
+
data.setIsPressed(true);
|
|
41
|
+
setTimeout(() => data.setIsPressed(false), 100);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
document.addEventListener("touchstart", (e) => handleTouchStart(e), { passive: true });
|
|
47
|
+
document.addEventListener("touchmove", (e) => handleTouchMove(e), { passive: true });
|
|
48
|
+
document.addEventListener("touchend", () => handleTouchEnd(), {
|
|
49
|
+
passive: true,
|
|
50
|
+
});
|
|
51
|
+
isListening = true;
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
register: (el, data) => {
|
|
55
|
+
elements.set(el, data);
|
|
56
|
+
startListening();
|
|
57
|
+
},
|
|
58
|
+
unregister: (el) => {
|
|
59
|
+
elements.delete(el);
|
|
60
|
+
},
|
|
61
|
+
elements,
|
|
62
|
+
};
|
|
63
|
+
})();
|
|
64
|
+
const useTap = (tapThreshold = 10) => {
|
|
65
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
66
|
+
const elementRef = useRef(null);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const element = elementRef.current;
|
|
69
|
+
if (!element)
|
|
70
|
+
return;
|
|
71
|
+
const data = {
|
|
72
|
+
touchStarted: false,
|
|
73
|
+
touchMoved: false,
|
|
74
|
+
startPosition: { x: 0, y: 0 },
|
|
75
|
+
setIsPressed,
|
|
76
|
+
tapThreshold,
|
|
77
|
+
};
|
|
78
|
+
tapManager.register(element, data);
|
|
79
|
+
return () => {
|
|
80
|
+
tapManager.unregister(element);
|
|
81
|
+
};
|
|
82
|
+
}, [tapThreshold]);
|
|
83
|
+
const onTap = useCallback((handler) => {
|
|
84
|
+
return (event) => {
|
|
85
|
+
const data = tapManager.elements.get(elementRef.current);
|
|
86
|
+
if (!data)
|
|
87
|
+
return;
|
|
88
|
+
if (event.type === "touchend" && !data.touchMoved) {
|
|
89
|
+
handler(event);
|
|
90
|
+
}
|
|
91
|
+
else if (event.type === "click" && !data.touchStarted) {
|
|
92
|
+
handler(event);
|
|
93
|
+
setIsPressed(true);
|
|
94
|
+
setTimeout(() => setIsPressed(false), 100);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
98
|
+
return { onTap, isPressed, ref: elementRef };
|
|
99
|
+
};
|
|
100
|
+
export { useTap };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
|
|
1
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
|
|
2
2
|
export * from "./components/hooks/use-collection";
|
|
3
3
|
export * from "./components/hooks/use-infinite-scroll";
|
|
4
4
|
export * from "./components/hooks/use-recommendations";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAA;AACpB,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,oCAAoC,CAAA;AAClD,cAAc,wCAAwC,CAAA;AACtD,cAAc,6BAA6B,CAAA;AAC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C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sCAAsC,CAAA;AACpD,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// component exports
|
|
2
|
-
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
|
|
2
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
|
|
3
3
|
export * from "./components/hooks/use-collection";
|
|
4
4
|
export * from "./components/hooks/use-infinite-scroll";
|
|
5
5
|
export * from "./components/hooks/use-recommendations";
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ClassValue } from "clsx";
|
|
2
|
+
import { Integrations } from "app-studio-types";
|
|
2
3
|
export type Color = {
|
|
3
4
|
type: "custom" | "brand-kit";
|
|
4
5
|
value: string;
|
|
@@ -58,6 +59,17 @@ export declare const getPaddingStyle: (padding: Partial<Spacing> | undefined) =>
|
|
|
58
59
|
paddingLeft: string | undefined;
|
|
59
60
|
paddingRight: string | undefined;
|
|
60
61
|
};
|
|
62
|
+
export declare const getMarginStyle: (margin: Partial<Spacing> | undefined) => {
|
|
63
|
+
marginTop?: undefined;
|
|
64
|
+
marginBottom?: undefined;
|
|
65
|
+
marginLeft?: undefined;
|
|
66
|
+
marginRight?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
marginTop: string | undefined;
|
|
69
|
+
marginBottom: string | undefined;
|
|
70
|
+
marginLeft: string | undefined;
|
|
71
|
+
marginRight: string | undefined;
|
|
72
|
+
};
|
|
61
73
|
export type BackgroundAndPadding = {
|
|
62
74
|
backgroundColor?: Color;
|
|
63
75
|
borderSides?: BorderSides;
|
|
@@ -178,4 +190,5 @@ export declare const createCollectionImageMap: (collections: {
|
|
|
178
190
|
customImage: boolean;
|
|
179
191
|
image?: string;
|
|
180
192
|
}[]) => Record<string, string>;
|
|
193
|
+
export declare const isFavoriteIntegrationEnabled: (integrations: Integrations) => boolean;
|
|
181
194
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAA;AAMjE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAI9C,eAAO,MAAM,QAAQ,gBAAiB,KAAK,GAAG,SAAS,uBAUtD,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAU/B,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,M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AmBD,eAAO,MAAM,qBAAqB,SAC1B,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,iBAjBrC,MAAM,WAAW,kBAAkB,yBAE5C,MAAM,WAAW,kBAAkB,yBAO/B,MAAM,WAAW,kBAAkB,yBAEhC,MAAM,WAAW,kBAAkB,yBAS3D,CAAA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,YAOlD;AAED,eAAO,MAAM,wBAAwB,gBACtB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,2BAQpE,CAAA;AAED,eAAO,MAAM,4BAA4B,yCAIxC,CAAA"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -70,6 +70,16 @@ export const getPaddingStyle = (padding) => {
|
|
|
70
70
|
paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
|
+
export const getMarginStyle = (margin) => {
|
|
74
|
+
if (!margin)
|
|
75
|
+
return {};
|
|
76
|
+
return {
|
|
77
|
+
marginTop: (margin === null || margin === void 0 ? void 0 : margin.top) !== undefined ? `${margin.top}px` : undefined,
|
|
78
|
+
marginBottom: (margin === null || margin === void 0 ? void 0 : margin.bottom) !== undefined ? `${margin.bottom}px` : undefined,
|
|
79
|
+
marginLeft: (margin === null || margin === void 0 ? void 0 : margin.left) !== undefined ? `${margin.left}px` : undefined,
|
|
80
|
+
marginRight: (margin === null || margin === void 0 ? void 0 : margin.right) !== undefined ? `${margin.right}px` : undefined,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
73
83
|
export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
|
|
74
84
|
const { backgroundColor, borderSides, borderColor, cornerRadius, padding, borderRadius, } = backgroundAndPadding;
|
|
75
85
|
const radius = cornerRadius || borderRadius;
|
|
@@ -221,4 +231,7 @@ export const createCollectionImageMap = (collections) => {
|
|
|
221
231
|
return imageMap;
|
|
222
232
|
}, {});
|
|
223
233
|
};
|
|
234
|
+
export const isFavoriteIntegrationEnabled = (integrations) => {
|
|
235
|
+
return integrations.some(integration => (integration.name === "tapcart-wishlist" || integration.name === "swym") && integration.enabled);
|
|
236
|
+
};
|
|
224
237
|
// #endregion =-=-=-= END BLOCK UTILS =-=-=-=
|
package/dist/styles.css
CHANGED
|
@@ -829,6 +829,9 @@ video {
|
|
|
829
829
|
.mb-2 {
|
|
830
830
|
margin-bottom: 0.5rem;
|
|
831
831
|
}
|
|
832
|
+
.mb-3 {
|
|
833
|
+
margin-bottom: 0.75rem;
|
|
834
|
+
}
|
|
832
835
|
.mb-6 {
|
|
833
836
|
margin-bottom: 1.5rem;
|
|
834
837
|
}
|
|
@@ -862,6 +865,9 @@ video {
|
|
|
862
865
|
.mt-auto {
|
|
863
866
|
margin-top: auto;
|
|
864
867
|
}
|
|
868
|
+
.box-border {
|
|
869
|
+
box-sizing: border-box;
|
|
870
|
+
}
|
|
865
871
|
.line-clamp-1 {
|
|
866
872
|
overflow: hidden;
|
|
867
873
|
display: -webkit-box;
|
|
@@ -892,6 +898,9 @@ video {
|
|
|
892
898
|
.grid {
|
|
893
899
|
display: grid;
|
|
894
900
|
}
|
|
901
|
+
.contents {
|
|
902
|
+
display: contents;
|
|
903
|
+
}
|
|
895
904
|
.hidden {
|
|
896
905
|
display: none;
|
|
897
906
|
}
|
|
@@ -1640,6 +1649,10 @@ video {
|
|
|
1640
1649
|
padding-left: 2rem;
|
|
1641
1650
|
padding-right: 2rem;
|
|
1642
1651
|
}
|
|
1652
|
+
.py-0 {
|
|
1653
|
+
padding-top: 0px;
|
|
1654
|
+
padding-bottom: 0px;
|
|
1655
|
+
}
|
|
1643
1656
|
.py-1 {
|
|
1644
1657
|
padding-top: 0.25rem;
|
|
1645
1658
|
padding-bottom: 0.25rem;
|
package/package.json
CHANGED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
type BorderSide = "all" | "top" | "bottom" | "left" | "right";
|
|
2
|
-
type BorderSides = BorderSide[];
|
|
3
|
-
declare const getBorderSidesStyle: (borderSides: BorderSides) => {
|
|
4
|
-
borderWidth: string;
|
|
5
|
-
borderTopWidth?: undefined;
|
|
6
|
-
borderBottomWidth?: undefined;
|
|
7
|
-
borderLeftWidth?: undefined;
|
|
8
|
-
borderRightWidth?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
borderTopWidth: string | number;
|
|
11
|
-
borderBottomWidth: string | number;
|
|
12
|
-
borderLeftWidth: string | number;
|
|
13
|
-
borderRightWidth: string | number;
|
|
14
|
-
borderWidth?: undefined;
|
|
15
|
-
};
|
|
16
|
-
type VerticalAlignment = "top" | "middle" | "bottom";
|
|
17
|
-
type Spacing = {
|
|
18
|
-
top: number;
|
|
19
|
-
bottom: number;
|
|
20
|
-
left: number;
|
|
21
|
-
right: number;
|
|
22
|
-
};
|
|
23
|
-
interface AlignmentAndSpacing {
|
|
24
|
-
alignment: VerticalAlignment;
|
|
25
|
-
spacing: Spacing;
|
|
26
|
-
}
|
|
27
|
-
declare const getVerticalAlignmentStyle: (alignmentAndSpacing: AlignmentAndSpacing) => {
|
|
28
|
-
bottom: string;
|
|
29
|
-
top: string;
|
|
30
|
-
transform?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
top: string;
|
|
33
|
-
transform: string;
|
|
34
|
-
bottom?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
bottom?: undefined;
|
|
37
|
-
top?: undefined;
|
|
38
|
-
transform?: undefined;
|
|
39
|
-
};
|
|
40
|
-
type BackgroundAndPadding = {
|
|
41
|
-
backgroundColor?: ColorOption;
|
|
42
|
-
borderSides?: BorderSides;
|
|
43
|
-
borderColor?: ColorOption;
|
|
44
|
-
cornerRadius?: number;
|
|
45
|
-
padding?: Partial<Spacing>;
|
|
46
|
-
};
|
|
47
|
-
type ColorOption = {
|
|
48
|
-
type: "brand-kit" | "custom";
|
|
49
|
-
value: string;
|
|
50
|
-
} | undefined;
|
|
51
|
-
declare const getColor: (colorOption: ColorOption) => string | undefined;
|
|
52
|
-
type BackgroundAndSpacing = AlignmentAndSpacing & {
|
|
53
|
-
backgroundColor?: ColorOption;
|
|
54
|
-
borderColor?: ColorOption;
|
|
55
|
-
backgroundCorners?: number;
|
|
56
|
-
};
|
|
57
|
-
type TextStyle = {
|
|
58
|
-
font: {
|
|
59
|
-
family: string;
|
|
60
|
-
weight: number | string;
|
|
61
|
-
};
|
|
62
|
-
size: number | string;
|
|
63
|
-
color: ColorOption;
|
|
64
|
-
uppercase: boolean;
|
|
65
|
-
textAlignment: "left" | "center" | "right" | "justify";
|
|
66
|
-
};
|
|
67
|
-
type Headline = TextStyle;
|
|
68
|
-
type Subtext = TextStyle;
|
|
69
|
-
//# sourceMappingURL=use-style-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-style-utils.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-style-utils.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,QAAA,MAAM,mBAAmB;;;;;;;;;;;;CAUxB,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,iBAAiB,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,QAAA,MAAM,yBAAyB,wBACR,mBAAmB;;;;;;;;;;;;CAczC,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,eAAe,CAAC,EAAE,WAAW,CAAA;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAC3B,CAAA;AAED,KAAK,WAAW,GACZ;IACE,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;CACd,GACD,SAAS,CAAA;AAEb,QAAA,MAAM,QAAQ,gBAAiB,WAAW,KAAG,MAAM,GAAG,SAMrD,CAAA;AAqCD,KAAK,oBAAoB,GAAG,mBAAmB,GAAG;IAChD,eAAe,CAAC,EAAE,WAAW,CAAA;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAeD,KAAK,SAAS,GAAG;IACf,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KACxB,CAAA;IACD,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,KAAK,EAAE,WAAW,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;CACvD,CAAA;AAED,KAAK,QAAQ,GAAG,SAAS,CAAA;AACzB,KAAK,OAAO,GAAG,SAAS,CAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const getBorderSidesStyle = (borderSides) => {
|
|
3
|
-
const style = borderSides.includes("all")
|
|
4
|
-
? { borderWidth: "1px" }
|
|
5
|
-
: {
|
|
6
|
-
borderTopWidth: borderSides.includes("top") ? "1px" : 0,
|
|
7
|
-
borderBottomWidth: borderSides.includes("bottom") ? "1px" : 0,
|
|
8
|
-
borderLeftWidth: borderSides.includes("left") ? "1px" : 0,
|
|
9
|
-
borderRightWidth: borderSides.includes("right") ? "1px" : 0,
|
|
10
|
-
};
|
|
11
|
-
return style;
|
|
12
|
-
};
|
|
13
|
-
const getVerticalAlignmentStyle = (alignmentAndSpacing) => {
|
|
14
|
-
const { alignment, spacing } = alignmentAndSpacing;
|
|
15
|
-
switch (alignment) {
|
|
16
|
-
case "bottom":
|
|
17
|
-
return { bottom: `${spacing.bottom}px`, top: "auto" };
|
|
18
|
-
case "middle":
|
|
19
|
-
return { top: "50%", transform: "translateY(-50%)" };
|
|
20
|
-
case "top":
|
|
21
|
-
return { top: `${spacing.top}px`, bottom: "auto" };
|
|
22
|
-
default:
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const getColor = (colorOption) => {
|
|
27
|
-
return colorOption
|
|
28
|
-
? colorOption.type === "brand-kit"
|
|
29
|
-
? `var(--${colorOption.value})`
|
|
30
|
-
: colorOption.value
|
|
31
|
-
: undefined;
|
|
32
|
-
};
|
|
33
|
-
function getBackgroundAndPaddingStyle(backgroundAndPadding) {
|
|
34
|
-
const { backgroundColor, borderSides, borderColor, cornerRadius, padding } = backgroundAndPadding;
|
|
35
|
-
return {
|
|
36
|
-
backgroundColor: getColor(backgroundColor),
|
|
37
|
-
borderColor: getColor(borderColor),
|
|
38
|
-
borderTopWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("top")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
39
|
-
? "1px"
|
|
40
|
-
: undefined,
|
|
41
|
-
borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
42
|
-
? "1px"
|
|
43
|
-
: undefined,
|
|
44
|
-
borderLeftWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("left")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
45
|
-
? "1px"
|
|
46
|
-
: undefined,
|
|
47
|
-
borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
48
|
-
? "1px"
|
|
49
|
-
: undefined,
|
|
50
|
-
paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
|
|
51
|
-
paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
|
|
52
|
-
paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
|
|
53
|
-
paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
|
|
54
|
-
borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined,
|
|
55
|
-
borderRadius: cornerRadius !== undefined ? `${cornerRadius}px` : undefined,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function getBackgroundAndSpacingStyle(backgroundAndSpacing) {
|
|
59
|
-
const { spacing, borderColor, backgroundColor, backgroundCorners } = backgroundAndSpacing;
|
|
60
|
-
return {
|
|
61
|
-
padding: `${spacing.top}px ${spacing.right}px ${spacing.bottom}px ${spacing.left}px`,
|
|
62
|
-
borderColor: borderColor ? borderColor.value : "transparent",
|
|
63
|
-
backgroundColor: getColor(backgroundColor) || "transparent",
|
|
64
|
-
borderRadius: `${backgroundCorners !== null && backgroundCorners !== void 0 ? backgroundCorners : 0}px`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function getTextStyle(textStyle) {
|
|
68
|
-
const { font, size, color, uppercase, textAlignment } = textStyle;
|
|
69
|
-
return {
|
|
70
|
-
fontFamily: font.family,
|
|
71
|
-
fontWeight: font.weight,
|
|
72
|
-
fontSize: size,
|
|
73
|
-
color: getColor(color),
|
|
74
|
-
textTransform: uppercase ? "uppercase" : "none",
|
|
75
|
-
textAlign: textAlignment,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
type BorderSide = "all" | "top" | "bottom" | "left" | "right";
|
|
2
|
-
type BorderSides = BorderSide[];
|
|
3
|
-
declare const getBorderSidesStyle: (borderSides: BorderSides) => {
|
|
4
|
-
borderWidth: string;
|
|
5
|
-
borderTopWidth?: undefined;
|
|
6
|
-
borderBottomWidth?: undefined;
|
|
7
|
-
borderLeftWidth?: undefined;
|
|
8
|
-
borderRightWidth?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
borderTopWidth: string | number;
|
|
11
|
-
borderBottomWidth: string | number;
|
|
12
|
-
borderLeftWidth: string | number;
|
|
13
|
-
borderRightWidth: string | number;
|
|
14
|
-
borderWidth?: undefined;
|
|
15
|
-
};
|
|
16
|
-
type VerticalAlignment = "top" | "middle" | "bottom";
|
|
17
|
-
type Spacing = {
|
|
18
|
-
top: number;
|
|
19
|
-
bottom: number;
|
|
20
|
-
left: number;
|
|
21
|
-
right: number;
|
|
22
|
-
};
|
|
23
|
-
interface AlignmentAndSpacing {
|
|
24
|
-
alignment: VerticalAlignment;
|
|
25
|
-
spacing: Spacing;
|
|
26
|
-
}
|
|
27
|
-
declare const getVerticalAlignmentStyle: (alignmentAndSpacing: AlignmentAndSpacing) => {
|
|
28
|
-
bottom: string;
|
|
29
|
-
top: string;
|
|
30
|
-
transform?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
top: string;
|
|
33
|
-
transform: string;
|
|
34
|
-
bottom?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
bottom?: undefined;
|
|
37
|
-
top?: undefined;
|
|
38
|
-
transform?: undefined;
|
|
39
|
-
};
|
|
40
|
-
type BackgroundAndPadding = {
|
|
41
|
-
backgroundColor?: ColorOption;
|
|
42
|
-
borderSides?: BorderSides;
|
|
43
|
-
borderColor?: ColorOption;
|
|
44
|
-
cornerRadius?: number;
|
|
45
|
-
padding?: Partial<Spacing>;
|
|
46
|
-
};
|
|
47
|
-
type ColorOption = {
|
|
48
|
-
type: "brand-kit" | "custom";
|
|
49
|
-
value: string;
|
|
50
|
-
} | undefined;
|
|
51
|
-
declare const getColor: (colorOption: ColorOption) => string | undefined;
|
|
52
|
-
declare function getBackgroundAndPaddingStyle(backgroundAndPadding: BackgroundAndPadding): {
|
|
53
|
-
backgroundColor: string | undefined;
|
|
54
|
-
borderColor: string | undefined;
|
|
55
|
-
borderTopWidth: string | undefined;
|
|
56
|
-
borderBottomWidth: string | undefined;
|
|
57
|
-
borderLeftWidth: string | undefined;
|
|
58
|
-
borderRightWidth: string | undefined;
|
|
59
|
-
paddingTop: string | undefined;
|
|
60
|
-
paddingBottom: string | undefined;
|
|
61
|
-
paddingLeft: string | undefined;
|
|
62
|
-
paddingRight: string | undefined;
|
|
63
|
-
borderStyle: string | undefined;
|
|
64
|
-
borderRadius: string | undefined;
|
|
65
|
-
};
|
|
66
|
-
type BackgroundAndSpacing = AlignmentAndSpacing & {
|
|
67
|
-
backgroundColor?: ColorOption;
|
|
68
|
-
borderColor?: ColorOption;
|
|
69
|
-
backgroundCorners?: number;
|
|
70
|
-
};
|
|
71
|
-
declare function getBackgroundAndSpacingStyle(backgroundAndSpacing: BackgroundAndSpacing): {
|
|
72
|
-
padding: string;
|
|
73
|
-
borderColor: string;
|
|
74
|
-
backgroundColor: string;
|
|
75
|
-
borderRadius: string;
|
|
76
|
-
};
|
|
77
|
-
type TextStyle = {
|
|
78
|
-
font: {
|
|
79
|
-
family: string;
|
|
80
|
-
weight: number | string;
|
|
81
|
-
};
|
|
82
|
-
size: number | string;
|
|
83
|
-
color: ColorOption;
|
|
84
|
-
uppercase: boolean;
|
|
85
|
-
textAlignment: "left" | "center" | "right" | "justify";
|
|
86
|
-
};
|
|
87
|
-
type Headline = TextStyle;
|
|
88
|
-
type Subtext = TextStyle;
|
|
89
|
-
declare function getTextStyle(textStyle: Headline | Subtext): {
|
|
90
|
-
fontFamily: string;
|
|
91
|
-
fontWeight: string | number;
|
|
92
|
-
fontSize: string | number;
|
|
93
|
-
color: string | undefined;
|
|
94
|
-
textTransform: string;
|
|
95
|
-
textAlign: "center" | "left" | "right" | "justify";
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=block-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block-utils.d.ts","sourceRoot":"","sources":["../../lib/block-utils.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,QAAA,MAAM,mBAAmB;;;;;;;;;;;;CAUxB,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,iBAAiB,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,QAAA,MAAM,yBAAyB,wBACR,mBAAmB;;;;;;;;;;;;CAczC,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,eAAe,CAAC,EAAE,WAAW,CAAA;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAC3B,CAAA;AAED,KAAK,WAAW,GACZ;IACE,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;CACd,GACD,SAAS,CAAA;AAEb,QAAA,MAAM,QAAQ,gBAAiB,WAAW,KAAG,MAAM,GAAG,SAMrD,CAAA;AAED,iBAAS,4BAA4B,CACnC,oBAAoB,EAAE,oBAAoB;;;;;;;;;;;;;EAgC3C;AAED,KAAK,oBAAoB,GAAG,mBAAmB,GAAG;IAChD,eAAe,CAAC,EAAE,WAAW,CAAA;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,iBAAS,4BAA4B,CACnC,oBAAoB,EAAE,oBAAoB;;;;;EAU3C;AAED,KAAK,SAAS,GAAG;IACf,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KACxB,CAAA;IACD,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,KAAK,EAAE,WAAW,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;CACvD,CAAA;AAED,KAAK,QAAQ,GAAG,SAAS,CAAA;AACzB,KAAK,OAAO,GAAG,SAAS,CAAA;AAExB,iBAAS,YAAY,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO;;;;;;;EAUlD"}
|
package/dist/lib/block-utils.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const getBorderSidesStyle = (borderSides) => {
|
|
3
|
-
const style = borderSides.includes("all")
|
|
4
|
-
? { borderWidth: "1px" }
|
|
5
|
-
: {
|
|
6
|
-
borderTopWidth: borderSides.includes("top") ? "1px" : 0,
|
|
7
|
-
borderBottomWidth: borderSides.includes("bottom") ? "1px" : 0,
|
|
8
|
-
borderLeftWidth: borderSides.includes("left") ? "1px" : 0,
|
|
9
|
-
borderRightWidth: borderSides.includes("right") ? "1px" : 0,
|
|
10
|
-
};
|
|
11
|
-
return style;
|
|
12
|
-
};
|
|
13
|
-
const getVerticalAlignmentStyle = (alignmentAndSpacing) => {
|
|
14
|
-
const { alignment, spacing } = alignmentAndSpacing;
|
|
15
|
-
switch (alignment) {
|
|
16
|
-
case "bottom":
|
|
17
|
-
return { bottom: `${spacing.bottom}px`, top: "auto" };
|
|
18
|
-
case "middle":
|
|
19
|
-
return { top: "50%", transform: "translateY(-50%)" };
|
|
20
|
-
case "top":
|
|
21
|
-
return { top: `${spacing.top}px`, bottom: "auto" };
|
|
22
|
-
default:
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const getColor = (colorOption) => {
|
|
27
|
-
return colorOption
|
|
28
|
-
? colorOption.type === "brand-kit"
|
|
29
|
-
? `var(--${colorOption.value})`
|
|
30
|
-
: colorOption.value
|
|
31
|
-
: undefined;
|
|
32
|
-
};
|
|
33
|
-
function getBackgroundAndPaddingStyle(backgroundAndPadding) {
|
|
34
|
-
const { backgroundColor, borderSides, borderColor, cornerRadius, padding } = backgroundAndPadding;
|
|
35
|
-
return {
|
|
36
|
-
backgroundColor: getColor(backgroundColor),
|
|
37
|
-
borderColor: getColor(borderColor),
|
|
38
|
-
borderTopWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("top")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
39
|
-
? "1px"
|
|
40
|
-
: undefined,
|
|
41
|
-
borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
42
|
-
? "1px"
|
|
43
|
-
: undefined,
|
|
44
|
-
borderLeftWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("left")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
45
|
-
? "1px"
|
|
46
|
-
: undefined,
|
|
47
|
-
borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
48
|
-
? "1px"
|
|
49
|
-
: undefined,
|
|
50
|
-
paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
|
|
51
|
-
paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
|
|
52
|
-
paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
|
|
53
|
-
paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
|
|
54
|
-
borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined,
|
|
55
|
-
borderRadius: cornerRadius !== undefined ? `${cornerRadius}px` : undefined,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function getBackgroundAndSpacingStyle(backgroundAndSpacing) {
|
|
59
|
-
const { spacing, borderColor, backgroundColor, backgroundCorners } = backgroundAndSpacing;
|
|
60
|
-
return {
|
|
61
|
-
padding: `${spacing.top}px ${spacing.right}px ${spacing.bottom}px ${spacing.left}px`,
|
|
62
|
-
borderColor: borderColor ? borderColor.value : "transparent",
|
|
63
|
-
backgroundColor: getColor(backgroundColor) || "transparent",
|
|
64
|
-
borderRadius: `${backgroundCorners !== null && backgroundCorners !== void 0 ? backgroundCorners : 0}px`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function getTextStyle(textStyle) {
|
|
68
|
-
const { font, size, color, uppercase, textAlignment } = textStyle;
|
|
69
|
-
return {
|
|
70
|
-
fontFamily: font.family,
|
|
71
|
-
fontWeight: font.weight,
|
|
72
|
-
fontSize: size,
|
|
73
|
-
color: getColor(color),
|
|
74
|
-
textTransform: uppercase ? "uppercase" : "none",
|
|
75
|
-
textAlign: textAlignment,
|
|
76
|
-
};
|
|
77
|
-
}
|