@open-tender/store 0.5.3 → 0.5.5

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
@@ -170,6 +170,7 @@ export interface TCFont {
170
170
  fontSmoothing: string;
171
171
  letterSpacing: string;
172
172
  lineHeight: number | string;
173
+ lineHeights?: TCFontSizes;
173
174
  textTransform: string;
174
175
  url?: string;
175
176
  weight: string;
@@ -196,6 +197,7 @@ export interface TCFonts {
196
197
  body: TCFont;
197
198
  headings: TCFont;
198
199
  headline: TCFont;
200
+ lineHeights?: TCFontSizes;
199
201
  preface: TCFont;
200
202
  sizes: TCFontSizes;
201
203
  }
@@ -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;
@@ -85,12 +85,12 @@ var makeFont = function (font, sizes, ratio) {
85
85
  };
86
86
  var makeFonts = function (fonts, lineHeight, ratio) {
87
87
  var sizes = fontSizesToPixels(fonts.sizes, ratio);
88
- var lineHeights = makeLineHeights(sizes, lineHeight, ratio);
88
+ var lineHeights = makeLineHeights(fonts.sizes, lineHeight, ratio);
89
89
  var headline = makeFont(fonts.headline, sizes, ratio);
90
90
  var headings = makeFont(fonts.headings, sizes, ratio);
91
91
  var body = makeFont(fonts.body, sizes, ratio);
92
92
  var preface = makeFont(fonts.preface, sizes, ratio);
93
- return tslib_1.__assign(tslib_1.__assign({}, fonts), { headline: headline, headings: headings, body: body, preface: preface, sizes: sizes, lineHeights: lineHeights });
93
+ return { body: body, headings: headings, headline: headline, lineHeights: lineHeights, preface: preface, sizes: sizes };
94
94
  };
95
95
  var makeBorder = function (border, ratio) {
96
96
  return tslib_1.__assign(tslib_1.__assign({}, border), { radius: (0, exports.remsToPixels)(border.radius, ratio), radiusSmall: (0, exports.remsToPixels)(border.radiusSmall, ratio), width: (0, exports.remsToPixels)(border.width, ratio), widthApp: (0, exports.remsToPixels)(border.widthApp, ratio) });
@@ -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, height = dimensions.height;
169
- var ratio = responsive ? makeRatio(width, height) : 1.0;
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);
@@ -170,6 +170,7 @@ export interface TCFont {
170
170
  fontSmoothing: string;
171
171
  letterSpacing: string;
172
172
  lineHeight: number | string;
173
+ lineHeights?: TCFontSizes;
173
174
  textTransform: string;
174
175
  url?: string;
175
176
  weight: string;
@@ -196,6 +197,7 @@ export interface TCFonts {
196
197
  body: TCFont;
197
198
  headings: TCFont;
198
199
  headline: TCFont;
200
+ lineHeights?: TCFontSizes;
199
201
  preface: TCFont;
200
202
  sizes: TCFontSizes;
201
203
  }
@@ -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;
@@ -80,12 +80,12 @@ var makeFont = function (font, sizes, ratio) {
80
80
  };
81
81
  var makeFonts = function (fonts, lineHeight, ratio) {
82
82
  var sizes = fontSizesToPixels(fonts.sizes, ratio);
83
- var lineHeights = makeLineHeights(sizes, lineHeight, ratio);
83
+ var lineHeights = makeLineHeights(fonts.sizes, lineHeight, ratio);
84
84
  var headline = makeFont(fonts.headline, sizes, ratio);
85
85
  var headings = makeFont(fonts.headings, sizes, ratio);
86
86
  var body = makeFont(fonts.body, sizes, ratio);
87
87
  var preface = makeFont(fonts.preface, sizes, ratio);
88
- return __assign(__assign({}, fonts), { headline: headline, headings: headings, body: body, preface: preface, sizes: sizes, lineHeights: lineHeights });
88
+ return { body: body, headings: headings, headline: headline, lineHeights: lineHeights, preface: preface, sizes: sizes };
89
89
  };
90
90
  var makeBorder = function (border, ratio) {
91
91
  return __assign(__assign({}, border), { radius: remsToPixels(border.radius, ratio), radiusSmall: remsToPixels(border.radiusSmall, ratio), width: remsToPixels(border.width, ratio), widthApp: remsToPixels(border.widthApp, ratio) });
@@ -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, height = dimensions.height;
164
- var ratio = responsive ? makeRatio(width, height) : 1.0;
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",
3
+ "version": "0.5.5",
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",