@open-tender/store 0.5.3 → 0.5.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/.DS_Store
CHANGED
|
Binary file
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Dimensions, HEX, Rems, ThemeCloud } from '../types';
|
|
2
2
|
export declare const remsToPixels: (rems: string, ratio: number) => string;
|
|
3
3
|
export declare const remsToNumber: (rems: Rems) => number;
|
|
4
|
+
export declare const makeRatio: (width: number, height: number) => number;
|
|
5
|
+
export declare const makeWidthRatio: (width: number) => number;
|
|
6
|
+
export declare const makeHeightRatio: (height: number) => number;
|
|
4
7
|
export declare const decorateTheme: (theme: ThemeCloud, dimensions: Dimensions, responsive?: boolean) => ThemeCloud;
|
|
5
8
|
export declare function hexToRgbA(hex: HEX, opacity: string): string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hexToRgbA = exports.decorateTheme = exports.remsToNumber = exports.remsToPixels = void 0;
|
|
3
|
+
exports.hexToRgbA = exports.decorateTheme = exports.makeHeightRatio = exports.makeWidthRatio = exports.makeRatio = exports.remsToNumber = exports.remsToPixels = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var remsToPixels = function (rems, ratio) {
|
|
6
6
|
var pixels = parseFloat(rems.replace('rem', '')) * 10;
|
|
@@ -163,10 +163,20 @@ var DEFAULT_HEIGHT = 844;
|
|
|
163
163
|
var makeRatio = function (width, height) {
|
|
164
164
|
return (width * height) / (DEFAULT_WIDTH * DEFAULT_HEIGHT);
|
|
165
165
|
};
|
|
166
|
+
exports.makeRatio = makeRatio;
|
|
167
|
+
var makeWidthRatio = function (width) {
|
|
168
|
+
return width / DEFAULT_WIDTH;
|
|
169
|
+
};
|
|
170
|
+
exports.makeWidthRatio = makeWidthRatio;
|
|
171
|
+
var makeHeightRatio = function (height) {
|
|
172
|
+
return height / DEFAULT_HEIGHT;
|
|
173
|
+
};
|
|
174
|
+
exports.makeHeightRatio = makeHeightRatio;
|
|
166
175
|
var decorateTheme = function (theme, dimensions, responsive) {
|
|
167
176
|
if (responsive === void 0) { responsive = true; }
|
|
168
|
-
var width = dimensions.width
|
|
169
|
-
|
|
177
|
+
var width = dimensions.width;
|
|
178
|
+
// const ratio = responsive ? makeRatio(width, height) : 1.0
|
|
179
|
+
var ratio = responsive ? (0, exports.makeWidthRatio)(width) : 1.0;
|
|
170
180
|
var border = makeBorder(theme.border, ratio);
|
|
171
181
|
var buttons = makeButtons(theme.buttons, ratio);
|
|
172
182
|
var cards = makeCards(theme.cards, ratio);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Dimensions, HEX, Rems, ThemeCloud } from '../types';
|
|
2
2
|
export declare const remsToPixels: (rems: string, ratio: number) => string;
|
|
3
3
|
export declare const remsToNumber: (rems: Rems) => number;
|
|
4
|
+
export declare const makeRatio: (width: number, height: number) => number;
|
|
5
|
+
export declare const makeWidthRatio: (width: number) => number;
|
|
6
|
+
export declare const makeHeightRatio: (height: number) => number;
|
|
4
7
|
export declare const decorateTheme: (theme: ThemeCloud, dimensions: Dimensions, responsive?: boolean) => ThemeCloud;
|
|
5
8
|
export declare function hexToRgbA(hex: HEX, opacity: string): string | null;
|
|
@@ -155,13 +155,20 @@ var makeWelcomes = function (welcomes, ratio) {
|
|
|
155
155
|
};
|
|
156
156
|
var DEFAULT_WIDTH = 390;
|
|
157
157
|
var DEFAULT_HEIGHT = 844;
|
|
158
|
-
var makeRatio = function (width, height) {
|
|
158
|
+
export var makeRatio = function (width, height) {
|
|
159
159
|
return (width * height) / (DEFAULT_WIDTH * DEFAULT_HEIGHT);
|
|
160
160
|
};
|
|
161
|
+
export var makeWidthRatio = function (width) {
|
|
162
|
+
return width / DEFAULT_WIDTH;
|
|
163
|
+
};
|
|
164
|
+
export var makeHeightRatio = function (height) {
|
|
165
|
+
return height / DEFAULT_HEIGHT;
|
|
166
|
+
};
|
|
161
167
|
export var decorateTheme = function (theme, dimensions, responsive) {
|
|
162
168
|
if (responsive === void 0) { responsive = true; }
|
|
163
|
-
var width = dimensions.width
|
|
164
|
-
|
|
169
|
+
var width = dimensions.width;
|
|
170
|
+
// const ratio = responsive ? makeRatio(width, height) : 1.0
|
|
171
|
+
var ratio = responsive ? makeWidthRatio(width) : 1.0;
|
|
165
172
|
var border = makeBorder(theme.border, ratio);
|
|
166
173
|
var buttons = makeButtons(theme.buttons, ratio);
|
|
167
174
|
var cards = makeCards(theme.cards, ratio);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|