@dereekb/browser 13.4.2 → 13.5.0

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/index.cjs.js CHANGED
@@ -379,7 +379,6 @@ function _ts_generator(thisArg, body) {
379
379
  }
380
380
  ();
381
381
 
382
- // https://dev.to/maciejtrzcinski/100vh-problem-with-ios-safari-3ge9
383
382
  /**
384
383
  * Default CSS custom property name used to store the viewport height value.
385
384
  */ var DEFAULT_VH100_VARIABLE_NAME = 'vh100';
@@ -389,7 +388,7 @@ function _ts_generator(thisArg, body) {
389
388
  * This is a workaround for the iOS Safari 100vh bug where `100vh` includes the browser chrome,
390
389
  * causing layout overflow. The returned function can be called to refresh the property value.
391
390
  *
392
- * @param cssVariableName - Name of the CSS custom property (without the `--` prefix)
391
+ * @param cssTokenName - Name of the CSS custom property (without the `--` prefix)
393
392
  * @returns A zero-argument function that updates the CSS property to the current inner height
394
393
  *
395
394
  * @example
@@ -398,8 +397,8 @@ function _ts_generator(thisArg, body) {
398
397
  * refresh(); // sets --vh100 to e.g. "812px"
399
398
  * ```
400
399
  */ function refreshVh100Function() {
401
- var cssVariableName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_VH100_VARIABLE_NAME;
402
- var cssProperty = "--".concat(cssVariableName);
400
+ var cssTokenName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_VH100_VARIABLE_NAME;
401
+ var cssProperty = "--".concat(cssTokenName);
403
402
  return function() {
404
403
  var doc = document.documentElement;
405
404
  doc.style.setProperty(cssProperty, "".concat(window.innerHeight, "px"));
@@ -408,9 +407,9 @@ function _ts_generator(thisArg, body) {
408
407
  /**
409
408
  * Adds window event listeners to populate the css variable `vh100`, or another input variable name, with the current window height.
410
409
  *
411
- * @param cssVariableName - Name of the CSS custom property to update; defaults to `vh100`
412
- */ function watchWindowAndUpdateVh100StyleProperty(cssVariableName) {
413
- var refreshPropertyValue = refreshVh100Function(cssVariableName);
410
+ * @param cssTokenName - Name of the CSS custom property to update; defaults to `vh100`
411
+ */ function watchWindowAndUpdateVh100StyleProperty(cssTokenName) {
412
+ var refreshPropertyValue = refreshVh100Function(cssTokenName);
414
413
  window.addEventListener('resize', refreshPropertyValue);
415
414
  window.addEventListener('orientationchange', refreshPropertyValue);
416
415
  refreshPropertyValue();
package/index.esm.js CHANGED
@@ -377,7 +377,6 @@ function _ts_generator(thisArg, body) {
377
377
  }
378
378
  ();
379
379
 
380
- // https://dev.to/maciejtrzcinski/100vh-problem-with-ios-safari-3ge9
381
380
  /**
382
381
  * Default CSS custom property name used to store the viewport height value.
383
382
  */ var DEFAULT_VH100_VARIABLE_NAME = 'vh100';
@@ -387,7 +386,7 @@ function _ts_generator(thisArg, body) {
387
386
  * This is a workaround for the iOS Safari 100vh bug where `100vh` includes the browser chrome,
388
387
  * causing layout overflow. The returned function can be called to refresh the property value.
389
388
  *
390
- * @param cssVariableName - Name of the CSS custom property (without the `--` prefix)
389
+ * @param cssTokenName - Name of the CSS custom property (without the `--` prefix)
391
390
  * @returns A zero-argument function that updates the CSS property to the current inner height
392
391
  *
393
392
  * @example
@@ -396,8 +395,8 @@ function _ts_generator(thisArg, body) {
396
395
  * refresh(); // sets --vh100 to e.g. "812px"
397
396
  * ```
398
397
  */ function refreshVh100Function() {
399
- var cssVariableName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_VH100_VARIABLE_NAME;
400
- var cssProperty = "--".concat(cssVariableName);
398
+ var cssTokenName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_VH100_VARIABLE_NAME;
399
+ var cssProperty = "--".concat(cssTokenName);
401
400
  return function() {
402
401
  var doc = document.documentElement;
403
402
  doc.style.setProperty(cssProperty, "".concat(window.innerHeight, "px"));
@@ -406,9 +405,9 @@ function _ts_generator(thisArg, body) {
406
405
  /**
407
406
  * Adds window event listeners to populate the css variable `vh100`, or another input variable name, with the current window height.
408
407
  *
409
- * @param cssVariableName - Name of the CSS custom property to update; defaults to `vh100`
410
- */ function watchWindowAndUpdateVh100StyleProperty(cssVariableName) {
411
- var refreshPropertyValue = refreshVh100Function(cssVariableName);
408
+ * @param cssTokenName - Name of the CSS custom property to update; defaults to `vh100`
409
+ */ function watchWindowAndUpdateVh100StyleProperty(cssTokenName) {
410
+ var refreshPropertyValue = refreshVh100Function(cssTokenName);
412
411
  window.addEventListener('resize', refreshPropertyValue);
413
412
  window.addEventListener('orientationchange', refreshPropertyValue);
414
413
  refreshPropertyValue();
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dereekb/browser",
3
- "version": "13.4.2",
3
+ "version": "13.5.0",
4
4
  "peerDependencies": {
5
- "@dereekb/util": "13.4.2",
6
- "@dereekb/rxjs": "13.4.2",
5
+ "@dereekb/util": "13.5.0",
6
+ "@dereekb/rxjs": "13.5.0",
7
7
  "rxjs": "^7.8.0"
8
8
  },
9
9
  "dependencies": {},
@@ -1,14 +1,15 @@
1
+ import { type CssTokenName } from '@dereekb/util';
1
2
  /**
2
3
  * Default CSS custom property name used to store the viewport height value.
3
4
  */
4
- export declare const DEFAULT_VH100_VARIABLE_NAME = "vh100";
5
+ export declare const DEFAULT_VH100_VARIABLE_NAME: CssTokenName;
5
6
  /**
6
7
  * Creates a function that sets a CSS custom property on `document.documentElement` to the current `window.innerHeight` in pixels.
7
8
  *
8
9
  * This is a workaround for the iOS Safari 100vh bug where `100vh` includes the browser chrome,
9
10
  * causing layout overflow. The returned function can be called to refresh the property value.
10
11
  *
11
- * @param cssVariableName - Name of the CSS custom property (without the `--` prefix)
12
+ * @param cssTokenName - Name of the CSS custom property (without the `--` prefix)
12
13
  * @returns A zero-argument function that updates the CSS property to the current inner height
13
14
  *
14
15
  * @example
@@ -17,10 +18,10 @@ export declare const DEFAULT_VH100_VARIABLE_NAME = "vh100";
17
18
  * refresh(); // sets --vh100 to e.g. "812px"
18
19
  * ```
19
20
  */
20
- export declare function refreshVh100Function(cssVariableName?: string): () => void;
21
+ export declare function refreshVh100Function(cssTokenName?: CssTokenName): () => void;
21
22
  /**
22
23
  * Adds window event listeners to populate the css variable `vh100`, or another input variable name, with the current window height.
23
24
  *
24
- * @param cssVariableName - Name of the CSS custom property to update; defaults to `vh100`
25
+ * @param cssTokenName - Name of the CSS custom property to update; defaults to `vh100`
25
26
  */
26
- export declare function watchWindowAndUpdateVh100StyleProperty(cssVariableName?: string): void;
27
+ export declare function watchWindowAndUpdateVh100StyleProperty(cssTokenName?: CssTokenName): void;