@codecademy/gamut-styles 17.13.2-alpha.f27e78.0 → 17.13.2-alpha.f38273.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.
@@ -1,15 +1,23 @@
1
1
  import type { RefObject } from 'react';
2
- /** Resolved HTML `dir` keyword: effective writing direction after `dir`, then CSS `direction`, then document root. */
2
+ /**
3
+ * Resolved HTML `dir` keyword: effective writing direction after `dir`, then CSS
4
+ * `direction`, then document root.
5
+ */
3
6
  export type DirValue = 'rtl' | 'ltr';
4
7
  /**
5
8
  * Resolves the effective `dir` for an element (`rtl` or `ltr`), including JSDOM where
6
9
  * `getComputedStyle(el).direction` is often empty while `dir` is set on the root.
10
+ *
11
+ * @param el - DOM node whose effective direction is resolved.
12
+ * @returns `rtl` or `ltr`.
7
13
  */
8
14
  export declare function elementDir(el: Element): DirValue;
9
15
  /**
10
16
  * Ref whose `current` may be any DOM {@link Element} subclass (`HTMLElement`, `SVGElement`,
11
17
  * `HTMLButtonElement`, etc.). For structural/minimal types (e.g. tests), intersect with
12
18
  * `Element` so `current` is still typed as an `Element` (e.g. `Pick<HTMLAnchorElement, 'id'> & Element`).
19
+ *
20
+ * @template T - DOM element type for `current`; defaults to {@link Element}.
13
21
  */
14
22
  export type ElementDirRef<T extends Element = Element> = RefObject<T | null>;
15
23
  /**
@@ -17,6 +25,8 @@ export type ElementDirRef<T extends Element = Element> = RefObject<T | null>;
17
25
  * changes on the document subtree or after layout (so `ref.current` is current).
18
26
  * Resolution uses {@link elementDir}.
19
27
  *
28
+ * @template T - DOM element type for the optional ref; defaults to {@link Element}.
20
29
  * @param elementRef - Optional ref; when missing or `current` is not an `Element`, uses `document.documentElement`.
30
+ * @returns Effective direction for the resolved element, or `ltr` when `document` is undefined (SSR).
21
31
  */
22
32
  export declare function useElementDir<T extends Element = Element>(elementRef?: ElementDirRef<T>): DirValue;
@@ -1,10 +1,16 @@
1
1
  import { useEffect, useLayoutEffect, useReducer } from 'react';
2
2
 
3
- /** Resolved HTML `dir` keyword: effective writing direction after `dir`, then CSS `direction`, then document root. */
3
+ /**
4
+ * Resolved HTML `dir` keyword: effective writing direction after `dir`, then CSS
5
+ * `direction`, then document root.
6
+ */
4
7
 
5
8
  /**
6
9
  * Resolves the effective `dir` for an element (`rtl` or `ltr`), including JSDOM where
7
10
  * `getComputedStyle(el).direction` is often empty while `dir` is set on the root.
11
+ *
12
+ * @param el - DOM node whose effective direction is resolved.
13
+ * @returns `rtl` or `ltr`.
8
14
  */
9
15
  export function elementDir(el) {
10
16
  const ownDir = el.getAttribute('dir');
@@ -23,6 +29,8 @@ export function elementDir(el) {
23
29
  * Ref whose `current` may be any DOM {@link Element} subclass (`HTMLElement`, `SVGElement`,
24
30
  * `HTMLButtonElement`, etc.). For structural/minimal types (e.g. tests), intersect with
25
31
  * `Element` so `current` is still typed as an `Element` (e.g. `Pick<HTMLAnchorElement, 'id'> & Element`).
32
+ *
33
+ * @template T - DOM element type for `current`; defaults to {@link Element}.
26
34
  */
27
35
 
28
36
  function resolveElement(elementRef) {
@@ -34,7 +42,9 @@ function resolveElement(elementRef) {
34
42
  * changes on the document subtree or after layout (so `ref.current` is current).
35
43
  * Resolution uses {@link elementDir}.
36
44
  *
45
+ * @template T - DOM element type for the optional ref; defaults to {@link Element}.
37
46
  * @param elementRef - Optional ref; when missing or `current` is not an `Element`, uses `document.documentElement`.
47
+ * @returns Effective direction for the resolved element, or `ltr` when `document` is undefined (SSR).
38
48
  */
39
49
  export function useElementDir(elementRef) {
40
50
  const [, bump] = useReducer(n => n + 1, 0);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Whether Gamut system props emit logical CSS properties (`marginInlineStart`, etc.)
2
+ * Whether Gamut system props map to logical CSS properties (`marginInlineStart`, etc.)
3
3
  * vs physical (`marginLeft`, etc.).
4
4
  *
5
5
  * `GamutProvider` always merges an explicit boolean (default `false`).
@@ -1,7 +1,7 @@
1
1
  import { useTheme } from '@emotion/react';
2
2
 
3
3
  /**
4
- * Whether Gamut system props emit logical CSS properties (`marginInlineStart`, etc.)
4
+ * Whether Gamut system props map to logical CSS properties (`marginInlineStart`, etc.)
5
5
  * vs physical (`marginLeft`, etc.).
6
6
  *
7
7
  * `GamutProvider` always merges an explicit boolean (default `false`).
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@codecademy/gamut-styles",
3
3
  "description": "Styleguide & Component library for codecademy.com",
4
- "version": "17.13.2-alpha.f27e78.0",
4
+ "version": "17.13.2-alpha.f38273.0",
5
5
  "author": "Jake Hiller <jake@codecademy.com>",
6
6
  "dependencies": {
7
- "@codecademy/variance": "0.26.2-alpha.f27e78.0",
7
+ "@codecademy/variance": "0.26.2-alpha.f38273.0",
8
8
  "@emotion/is-prop-valid": "^1.1.0",
9
9
  "framer-motion": "^11.18.0",
10
10
  "get-nonce": "^1.0.0",