@open-tender/utils 0.1.110 → 0.1.111
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/.DS_Store +0 -0
- package/dist/cjs/utils/theme.js +23 -1
- package/dist/esm/utils/theme.js +23 -1
- package/package.json +1 -1
package/dist/.DS_Store
CHANGED
|
Binary file
|
package/dist/cjs/utils/theme.js
CHANGED
|
@@ -48,6 +48,12 @@ const paddingToPixels = (padding) => {
|
|
|
48
48
|
const [top, horizontal, bottom] = padding.split(' ');
|
|
49
49
|
return `${(0, exports.remsToPixels)(top)} ${(0, exports.remsToPixels)(horizontal)} ${(0, exports.remsToPixels)(bottom)}`;
|
|
50
50
|
};
|
|
51
|
+
const boxRemsToPixels = (box) => {
|
|
52
|
+
return box
|
|
53
|
+
.split(' ')
|
|
54
|
+
.map(i => (0, exports.remsToPixels)(i))
|
|
55
|
+
.join(' ');
|
|
56
|
+
};
|
|
51
57
|
const buttonToPixels = (button) => {
|
|
52
58
|
return Object.assign(Object.assign({}, button), { borderRadius: (0, exports.remsToPixels)(button.borderRadius), borderWidth: (0, exports.remsToPixels)(button.borderWidth), borderWidthApp: button.borderWidthApp
|
|
53
59
|
? (0, exports.remsToPixels)(button.borderWidthApp)
|
|
@@ -149,6 +155,21 @@ const makeItem = (item) => {
|
|
|
149
155
|
const { mobile } = item;
|
|
150
156
|
return Object.assign(Object.assign({}, mobile), { padding: (0, exports.remsToPixels)(mobile.padding), imagePadding: (0, exports.remsToPixels)(mobile.imagePadding), maxWidth: (0, exports.remsToPixels)(mobile.maxWidth), imageMinHeight: (0, exports.remsToPixels)(mobile.imageMinHeight), imageMaxHeight: (0, exports.remsToPixels)(mobile.imageMaxHeight) });
|
|
151
157
|
};
|
|
158
|
+
const makeMenuItems = (menuItems) => {
|
|
159
|
+
const { allergens, box, calories, container, content, image, price, tags, text, title } = menuItems;
|
|
160
|
+
return {
|
|
161
|
+
allergens: Object.assign(Object.assign({}, allergens), { fontSize: (0, exports.remsToPixels)(allergens.fontSize), fontSizeMobile: (0, exports.remsToPixels)(allergens.fontSizeMobile) }),
|
|
162
|
+
box: Object.assign(Object.assign({}, box), { border: boxRemsToPixels(box.border), borderMobile: boxRemsToPixels(box.borderMobile), borderRadius: (0, exports.remsToPixels)(box.borderRadius), borderRadiusMobile: (0, exports.remsToPixels)(box.borderRadiusMobile), margin: boxRemsToPixels(box.margin), marginMobile: boxRemsToPixels(box.marginMobile), minWidth: (0, exports.remsToPixels)(box.minWidth), minWidthMobile: (0, exports.remsToPixels)(box.minWidthMobile), padding: boxRemsToPixels(box.padding), paddingMobile: boxRemsToPixels(box.paddingMobile) }),
|
|
163
|
+
calories: Object.assign(Object.assign({}, calories), { fontSize: (0, exports.remsToPixels)(calories.fontSize), fontSizeMobile: (0, exports.remsToPixels)(calories.fontSizeMobile) }),
|
|
164
|
+
container: Object.assign(Object.assign({}, container), { gap: (0, exports.remsToPixels)(container.gap), gapHalf: (0, exports.remsToPixels)(container.gapHalf), gapHalfMobile: (0, exports.remsToPixels)(container.gapHalfMobile), gapMobile: (0, exports.remsToPixels)(container.gapMobile), margin: boxRemsToPixels(container.margin), marginMobile: boxRemsToPixels(container.marginMobile), maxWidth: (0, exports.remsToPixels)(container.maxWidth), padding: boxRemsToPixels(container.padding), paddingMobile: boxRemsToPixels(container.paddingMobile) }),
|
|
165
|
+
content: Object.assign(Object.assign({}, content), { padding: boxRemsToPixels(content.padding), paddingMobile: boxRemsToPixels(content.paddingMobile) }),
|
|
166
|
+
image: Object.assign(Object.assign({}, image), { border: boxRemsToPixels(image.border), borderMobile: boxRemsToPixels(image.borderMobile), borderRadius: (0, exports.remsToPixels)(image.borderRadius), borderRadiusMobile: (0, exports.remsToPixels)(image.borderRadiusMobile), margin: boxRemsToPixels(image.margin), marginMobile: boxRemsToPixels(image.marginMobile), minWidth: (0, exports.remsToPixels)(image.minWidth), minWidthMobile: (0, exports.remsToPixels)(image.minWidthMobile), padding: boxRemsToPixels(image.padding), paddingMobile: boxRemsToPixels(image.paddingMobile) }),
|
|
167
|
+
price: Object.assign(Object.assign({}, price), { fontSize: (0, exports.remsToPixels)(price.fontSize), fontSizeMobile: (0, exports.remsToPixels)(price.fontSizeMobile) }),
|
|
168
|
+
tags: Object.assign(Object.assign({}, tags), { fontSize: (0, exports.remsToPixels)(tags.fontSize), fontSizeMobile: (0, exports.remsToPixels)(tags.fontSizeMobile), gap: (0, exports.remsToPixels)(tags.gap), gapMobile: (0, exports.remsToPixels)(tags.gapMobile), width: (0, exports.remsToPixels)(tags.width), widthMobile: (0, exports.remsToPixels)(tags.widthMobile) }),
|
|
169
|
+
text: Object.assign(Object.assign({}, text), { fontSize: (0, exports.remsToPixels)(text.fontSize), fontSizeMobile: (0, exports.remsToPixels)(text.fontSizeMobile) }),
|
|
170
|
+
title: Object.assign(Object.assign({}, title), { fontSize: (0, exports.remsToPixels)(title.fontSize), fontSizeMobile: (0, exports.remsToPixels)(title.fontSizeMobile) })
|
|
171
|
+
};
|
|
172
|
+
};
|
|
152
173
|
const decorateTheme = (theme) => {
|
|
153
174
|
const fonts = makeFonts(theme.fonts, theme.lineHeight);
|
|
154
175
|
const lineHeight = (0, exports.makeLineHeight)(theme.lineHeight, fonts.sizes.main);
|
|
@@ -160,8 +181,9 @@ const decorateTheme = (theme) => {
|
|
|
160
181
|
const cards = makeCards(theme.cards);
|
|
161
182
|
const welcome = makeWelcome(theme.welcome);
|
|
162
183
|
const item = makeItem(theme.item);
|
|
184
|
+
const menuItems = makeMenuItems(theme.menuItems);
|
|
163
185
|
return Object.assign(Object.assign({}, theme), { fonts: fonts, lineHeight, layout: layout, buttons: buttons, border, inputs: inputs, counts,
|
|
164
|
-
cards, welcome: welcome, item: item });
|
|
186
|
+
cards, welcome: welcome, item: item, menuItems });
|
|
165
187
|
};
|
|
166
188
|
exports.decorateTheme = decorateTheme;
|
|
167
189
|
const hexToRgbA = (hex, opacity) => {
|
package/dist/esm/utils/theme.js
CHANGED
|
@@ -39,6 +39,12 @@ const paddingToPixels = (padding) => {
|
|
|
39
39
|
const [top, horizontal, bottom] = padding.split(' ');
|
|
40
40
|
return `${remsToPixels(top)} ${remsToPixels(horizontal)} ${remsToPixels(bottom)}`;
|
|
41
41
|
};
|
|
42
|
+
const boxRemsToPixels = (box) => {
|
|
43
|
+
return box
|
|
44
|
+
.split(' ')
|
|
45
|
+
.map(i => remsToPixels(i))
|
|
46
|
+
.join(' ');
|
|
47
|
+
};
|
|
42
48
|
const buttonToPixels = (button) => {
|
|
43
49
|
return Object.assign(Object.assign({}, button), { borderRadius: remsToPixels(button.borderRadius), borderWidth: remsToPixels(button.borderWidth), borderWidthApp: button.borderWidthApp
|
|
44
50
|
? remsToPixels(button.borderWidthApp)
|
|
@@ -140,6 +146,21 @@ const makeItem = (item) => {
|
|
|
140
146
|
const { mobile } = item;
|
|
141
147
|
return Object.assign(Object.assign({}, mobile), { padding: remsToPixels(mobile.padding), imagePadding: remsToPixels(mobile.imagePadding), maxWidth: remsToPixels(mobile.maxWidth), imageMinHeight: remsToPixels(mobile.imageMinHeight), imageMaxHeight: remsToPixels(mobile.imageMaxHeight) });
|
|
142
148
|
};
|
|
149
|
+
const makeMenuItems = (menuItems) => {
|
|
150
|
+
const { allergens, box, calories, container, content, image, price, tags, text, title } = menuItems;
|
|
151
|
+
return {
|
|
152
|
+
allergens: Object.assign(Object.assign({}, allergens), { fontSize: remsToPixels(allergens.fontSize), fontSizeMobile: remsToPixels(allergens.fontSizeMobile) }),
|
|
153
|
+
box: Object.assign(Object.assign({}, box), { border: boxRemsToPixels(box.border), borderMobile: boxRemsToPixels(box.borderMobile), borderRadius: remsToPixels(box.borderRadius), borderRadiusMobile: remsToPixels(box.borderRadiusMobile), margin: boxRemsToPixels(box.margin), marginMobile: boxRemsToPixels(box.marginMobile), minWidth: remsToPixels(box.minWidth), minWidthMobile: remsToPixels(box.minWidthMobile), padding: boxRemsToPixels(box.padding), paddingMobile: boxRemsToPixels(box.paddingMobile) }),
|
|
154
|
+
calories: Object.assign(Object.assign({}, calories), { fontSize: remsToPixels(calories.fontSize), fontSizeMobile: remsToPixels(calories.fontSizeMobile) }),
|
|
155
|
+
container: Object.assign(Object.assign({}, container), { gap: remsToPixels(container.gap), gapHalf: remsToPixels(container.gapHalf), gapHalfMobile: remsToPixels(container.gapHalfMobile), gapMobile: remsToPixels(container.gapMobile), margin: boxRemsToPixels(container.margin), marginMobile: boxRemsToPixels(container.marginMobile), maxWidth: remsToPixels(container.maxWidth), padding: boxRemsToPixels(container.padding), paddingMobile: boxRemsToPixels(container.paddingMobile) }),
|
|
156
|
+
content: Object.assign(Object.assign({}, content), { padding: boxRemsToPixels(content.padding), paddingMobile: boxRemsToPixels(content.paddingMobile) }),
|
|
157
|
+
image: Object.assign(Object.assign({}, image), { border: boxRemsToPixels(image.border), borderMobile: boxRemsToPixels(image.borderMobile), borderRadius: remsToPixels(image.borderRadius), borderRadiusMobile: remsToPixels(image.borderRadiusMobile), margin: boxRemsToPixels(image.margin), marginMobile: boxRemsToPixels(image.marginMobile), minWidth: remsToPixels(image.minWidth), minWidthMobile: remsToPixels(image.minWidthMobile), padding: boxRemsToPixels(image.padding), paddingMobile: boxRemsToPixels(image.paddingMobile) }),
|
|
158
|
+
price: Object.assign(Object.assign({}, price), { fontSize: remsToPixels(price.fontSize), fontSizeMobile: remsToPixels(price.fontSizeMobile) }),
|
|
159
|
+
tags: Object.assign(Object.assign({}, tags), { fontSize: remsToPixels(tags.fontSize), fontSizeMobile: remsToPixels(tags.fontSizeMobile), gap: remsToPixels(tags.gap), gapMobile: remsToPixels(tags.gapMobile), width: remsToPixels(tags.width), widthMobile: remsToPixels(tags.widthMobile) }),
|
|
160
|
+
text: Object.assign(Object.assign({}, text), { fontSize: remsToPixels(text.fontSize), fontSizeMobile: remsToPixels(text.fontSizeMobile) }),
|
|
161
|
+
title: Object.assign(Object.assign({}, title), { fontSize: remsToPixels(title.fontSize), fontSizeMobile: remsToPixels(title.fontSizeMobile) })
|
|
162
|
+
};
|
|
163
|
+
};
|
|
143
164
|
export const decorateTheme = (theme) => {
|
|
144
165
|
const fonts = makeFonts(theme.fonts, theme.lineHeight);
|
|
145
166
|
const lineHeight = makeLineHeight(theme.lineHeight, fonts.sizes.main);
|
|
@@ -151,8 +172,9 @@ export const decorateTheme = (theme) => {
|
|
|
151
172
|
const cards = makeCards(theme.cards);
|
|
152
173
|
const welcome = makeWelcome(theme.welcome);
|
|
153
174
|
const item = makeItem(theme.item);
|
|
175
|
+
const menuItems = makeMenuItems(theme.menuItems);
|
|
154
176
|
return Object.assign(Object.assign({}, theme), { fonts: fonts, lineHeight, layout: layout, buttons: buttons, border, inputs: inputs, counts,
|
|
155
|
-
cards, welcome: welcome, item: item });
|
|
177
|
+
cards, welcome: welcome, item: item, menuItems });
|
|
156
178
|
};
|
|
157
179
|
export const hexToRgbA = (hex, opacity) => {
|
|
158
180
|
let c;
|
package/package.json
CHANGED