@primer/styled-react 0.0.0-20251202220556 → 0.0.0-20251202222316

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.
Files changed (59) hide show
  1. package/dist/{packages/styled-react/src/components → components}/BaseStyles.js +2 -3
  2. package/dist/{packages/styled-react/src/components → components}/ThemeProvider.js +3 -5
  3. package/dist/{packages/styled-react/src/index.js → index.js} +1 -3
  4. package/dist/sx.js +9 -0
  5. package/package.json +6 -3
  6. package/dist/_virtual/rolldown_runtime.js +0 -29
  7. package/dist/node_modules/clsx/dist/clsx.js +0 -17
  8. package/dist/node_modules/deepmerge/dist/cjs.js +0 -88
  9. package/dist/node_modules/focus-visible/dist/focus-visible.js +0 -212
  10. package/dist/packages/styled-react/src/sx.js +0 -11
  11. /package/dist/{packages/styled-react/src/components → components}/ActionList.js +0 -0
  12. /package/dist/{packages/styled-react/src/components → components}/ActionMenu.js +0 -0
  13. /package/dist/{packages/styled-react/src/components → components}/Autocomplete.js +0 -0
  14. /package/dist/{packages/styled-react/src/components → components}/Avatar.js +0 -0
  15. /package/dist/{packages/styled-react/src/components → components}/Box.js +0 -0
  16. /package/dist/{packages/styled-react/src/components → components}/Breadcrumbs.js +0 -0
  17. /package/dist/{packages/styled-react/src/components → components}/Button.js +0 -0
  18. /package/dist/{packages/styled-react/src/components → components}/Checkbox.js +0 -0
  19. /package/dist/{packages/styled-react/src/components → components}/CheckboxGroup.js +0 -0
  20. /package/dist/{packages/styled-react/src/components → components}/CircleBadge.js +0 -0
  21. /package/dist/{packages/styled-react/src/components → components}/CounterLabel.js +0 -0
  22. /package/dist/{packages/styled-react/src/components → components}/DataTable.js +0 -0
  23. /package/dist/{packages/styled-react/src/components → components}/Dialog.js +0 -0
  24. /package/dist/{packages/styled-react/src/components → components}/Flash.js +0 -0
  25. /package/dist/{packages/styled-react/src/components → components}/FormControl.js +0 -0
  26. /package/dist/{packages/styled-react/src/components → components}/Header.js +0 -0
  27. /package/dist/{packages/styled-react/src/components → components}/Heading.js +0 -0
  28. /package/dist/{packages/styled-react/src/components → components}/IconButton.js +0 -0
  29. /package/dist/{packages/styled-react/src/components → components}/Label.js +0 -0
  30. /package/dist/{packages/styled-react/src/components → components}/Link.js +0 -0
  31. /package/dist/{packages/styled-react/src/components → components}/LinkButton.js +0 -0
  32. /package/dist/{packages/styled-react/src/components → components}/NavList.js +0 -0
  33. /package/dist/{packages/styled-react/src/components → components}/Overlay.js +0 -0
  34. /package/dist/{packages/styled-react/src/components → components}/PageHeader.js +0 -0
  35. /package/dist/{packages/styled-react/src/components → components}/RadioGroup.js +0 -0
  36. /package/dist/{packages/styled-react/src/components → components}/RelativeTime.js +0 -0
  37. /package/dist/{packages/styled-react/src/components → components}/SegmentedControl.js +0 -0
  38. /package/dist/{packages/styled-react/src/components → components}/Select.js +0 -0
  39. /package/dist/{packages/styled-react/src/components → components}/Spinner.js +0 -0
  40. /package/dist/{packages/styled-react/src/components → components}/StateLabel.js +0 -0
  41. /package/dist/{packages/styled-react/src/components → components}/SubNav.js +0 -0
  42. /package/dist/{packages/styled-react/src/components → components}/Text.js +0 -0
  43. /package/dist/{packages/styled-react/src/components → components}/TextInput.js +0 -0
  44. /package/dist/{packages/styled-react/src/components → components}/Textarea.js +0 -0
  45. /package/dist/{packages/styled-react/src/components → components}/Timeline.js +0 -0
  46. /package/dist/{packages/styled-react/src/components → components}/ToggleSwitch.js +0 -0
  47. /package/dist/{packages/styled-react/src/components → components}/Token.js +0 -0
  48. /package/dist/{packages/styled-react/src/components → components}/Tooltip.js +0 -0
  49. /package/dist/{packages/styled-react/src/components → components}/Truncate.js +0 -0
  50. /package/dist/{packages/styled-react/src/components → components}/UnderlineNav.js +0 -0
  51. /package/dist/{packages/styled-react/src/components → components}/UnderlinePanels.js +0 -0
  52. /package/dist/{packages/styled-react/src/components → components}/deprecated/ActionList.js +0 -0
  53. /package/dist/{packages/styled-react/src/components → components}/deprecated/DialogV1.js +0 -0
  54. /package/dist/{packages/styled-react/src/components → components}/deprecated/Octicon.js +0 -0
  55. /package/dist/{packages/styled-react/src/components → components}/deprecated/TabNav.js +0 -0
  56. /package/dist/{packages/styled-react/src/components → components}/deprecated/Tooltip.js +0 -0
  57. /package/dist/{packages/styled-react/src/deprecated.js → deprecated.js} +0 -0
  58. /package/dist/{packages/styled-react/src/experimental.js → experimental.js} +0 -0
  59. /package/dist/{packages/styled-react/src/theme-get.js → theme-get.js} +0 -0
@@ -1,11 +1,10 @@
1
1
  import { useTheme } from "./ThemeProvider.js";
2
- import { clsx } from "../../../../node_modules/clsx/dist/clsx.js";
3
- import { require_focus_visible } from "../../../../node_modules/focus-visible/dist/focus-visible.js";
4
2
  import { createGlobalStyle } from "styled-components";
5
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { clsx } from "clsx";
5
+ import "focus-visible";
6
6
 
7
7
  //#region src/components/BaseStyles.tsx
8
- var import_focus_visible = require_focus_visible();
9
8
  const GlobalStyle = createGlobalStyle(["*{box-sizing:border-box;}body{margin:0;}table{border-collapse:collapse;}[data-color-mode='light'] input{color-scheme:light;}[data-color-mode='dark'] input{color-scheme:dark;}@media (prefers-color-scheme:light){[data-color-mode='auto'][data-light-theme*='light']{color-scheme:light;}}@media (prefers-color-scheme:dark){[data-color-mode='auto'][data-dark-theme*='dark']{color-scheme:dark;}}[role='button']:focus:not(:focus-visible):not(:global(.focus-visible)),[role='tabpanel'][tabindex='0']:focus:not(:focus-visible):not(:global(.focus-visible)),button:focus:not(:focus-visible):not(:global(.focus-visible)),summary:focus:not(:focus-visible):not(:global(.focus-visible)),a:focus:not(:focus-visible):not(:global(.focus-visible)){outline:none;box-shadow:none;}[tabindex='0']:focus:not(:focus-visible):not(:global(.focus-visible)),details-dialog:focus:not(:focus-visible):not(:global(.focus-visible)){outline:none;}.BaseStyles{font-family:var(--BaseStyles-fontFamily,var(--fontStack-system));line-height:var(--BaseStyles-lineHeight,1.5);color:var(--BaseStyles-fgColor,var(--fgColor-default));&:has([data-color-mode='light']){input &{color-scheme:light;}}&:has([data-color-mode='dark']){input &{color-scheme:dark;}}:where(a:not([class*='prc-']):not([class*='PRC-']):not([class*='Primer_Brand__'])){color:var(--fgColor-accent,var(--color-accent-fg));text-decoration:none;&:hover{text-decoration:underline;}}}"]);
10
9
  function BaseStyles({ children, color, fontFamily, lineHeight, className, as: Component = "div", style, ...rest }) {
11
10
  const { colorMode, colorScheme, dayScheme, nightScheme } = useTheme();
@@ -1,13 +1,11 @@
1
- import { __toESM } from "../../../../_virtual/rolldown_runtime.js";
2
- import { require_cjs } from "../../../../node_modules/deepmerge/dist/cjs.js";
3
1
  import { ThemeProvider } from "styled-components";
2
+ import deepmerge from "deepmerge";
4
3
  import { theme, useId, useSyncedState } from "@primer/react";
5
4
  import React from "react";
6
5
  import ReactDOM from "react-dom";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
8
7
 
9
8
  //#region src/components/ThemeProvider.tsx
10
- var import_cjs = /* @__PURE__ */ __toESM(require_cjs());
11
9
  const defaultColorMode = "day";
12
10
  const defaultDayScheme = "light";
13
11
  const defaultNightScheme = "dark";
@@ -138,12 +136,12 @@ function applyColorScheme(theme$1, colorScheme) {
138
136
  console.error(`\`${colorScheme}\` scheme not defined in \`theme.colorSchemes\``);
139
137
  const defaultColorScheme = Object.keys(theme$1.colorSchemes)[0];
140
138
  return {
141
- resolvedTheme: (0, import_cjs.default)(theme$1, theme$1.colorSchemes[defaultColorScheme]),
139
+ resolvedTheme: deepmerge(theme$1, theme$1.colorSchemes[defaultColorScheme]),
142
140
  resolvedColorScheme: defaultColorScheme
143
141
  };
144
142
  }
145
143
  return {
146
- resolvedTheme: (0, import_cjs.default)(theme$1, theme$1.colorSchemes[colorScheme]),
144
+ resolvedTheme: deepmerge(theme$1, theme$1.colorSchemes[colorScheme]),
147
145
  resolvedColorScheme: colorScheme
148
146
  };
149
147
  }
@@ -1,7 +1,6 @@
1
- "use client";
2
1
  'use client';
3
2
 
4
- import { import_cjs, sx } from "./sx.js";
3
+ import { merge, sx } from "./sx.js";
5
4
  import { Box } from "./components/Box.js";
6
5
  import { ThemeProvider, useColorSchemeVar, useTheme } from "./components/ThemeProvider.js";
7
6
  import { BaseStyles } from "./components/BaseStyles.js";
@@ -46,5 +45,4 @@ import { Truncate } from "./components/Truncate.js";
46
45
  import { UnderlineNav } from "./components/UnderlineNav.js";
47
46
  import { Details, ProgressBar, theme } from "@primer/react";
48
47
 
49
- var merge = import_cjs.default;
50
48
  export { ActionList, ActionMenu, Autocomplete, Avatar, BaseStyles, Box, Breadcrumb, Breadcrumbs, ButtonComponent as Button, Checkbox, CheckboxGroup, CircleBadge, CounterLabel, Details, Dialog, Flash, FormControl, Header, Heading, IconButton, Label, Link, LinkButton, NavList, Overlay, PageHeader, ProgressBar, RadioGroup, RelativeTime, SegmentedControl, Select, Spinner, StateLabel, SubNav, Text, TextInput, Textarea, ThemeProvider, Timeline, ToggleSwitch, Token, Tooltip, Truncate, UnderlineNav, merge, sx, theme, get as themeGet, useColorSchemeVar, useTheme };
package/dist/sx.js ADDED
@@ -0,0 +1,9 @@
1
+ import css from "@styled-system/css";
2
+ import merge from "deepmerge";
3
+
4
+ //#region src/sx.ts
5
+ const sx = (props) => css(props.sx);
6
+ var sx_default = sx;
7
+
8
+ //#endregion
9
+ export { sx_default as default, merge, sx };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/styled-react",
3
- "version": "0.0.0-20251202220556",
3
+ "version": "0.0.0-20251202222316",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -38,12 +38,15 @@
38
38
  "@types/styled-system": "^5.1.23",
39
39
  "@types/styled-system__css": "^5.0.16",
40
40
  "@types/styled-system__theme-get": "^5.0.1",
41
+ "clsx": "^2.1.1",
42
+ "deepmerge": "^4.3.1",
43
+ "focus-visible": "^5.2.1",
41
44
  "styled-system": "^5.1.5"
42
45
  },
43
46
  "devDependencies": {
44
47
  "@babel/preset-react": "^7.28.5",
45
48
  "@babel/preset-typescript": "^7.28.5",
46
- "@primer/react": "0.0.0-20251202220556",
49
+ "@primer/react": "0.0.0-20251202222316",
47
50
  "@rollup/plugin-babel": "^6.1.0",
48
51
  "@types/react": "18.3.11",
49
52
  "@types/react-dom": "18.3.1",
@@ -60,7 +63,7 @@
60
63
  "typescript": "^5.9.2"
61
64
  },
62
65
  "peerDependencies": {
63
- "@primer/react": "0.0.0-20251202220556",
66
+ "@primer/react": "0.0.0-20251202222316",
64
67
  "@types/react": "18.x || 19.x",
65
68
  "@types/react-dom": "18.x || 19.x",
66
69
  "@types/react-is": "18.x || 19.x",
@@ -1,29 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
-
28
- //#endregion
29
- export { __commonJSMin, __toESM };
@@ -1,17 +0,0 @@
1
- //#region ../../node_modules/clsx/dist/clsx.mjs
2
- function r(e) {
3
- var t, f, n = "";
4
- if ("string" == typeof e || "number" == typeof e) n += e;
5
- else if ("object" == typeof e) if (Array.isArray(e)) {
6
- var o = e.length;
7
- for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
8
- } else for (f in e) e[f] && (n && (n += " "), n += f);
9
- return n;
10
- }
11
- function clsx() {
12
- for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
13
- return n;
14
- }
15
-
16
- //#endregion
17
- export { clsx };
@@ -1,88 +0,0 @@
1
- import { __commonJSMin } from "../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/deepmerge/dist/cjs.js
4
- var require_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- var isMergeableObject = function isMergeableObject$1(value) {
6
- return isNonNullObject(value) && !isSpecial(value);
7
- };
8
- function isNonNullObject(value) {
9
- return !!value && typeof value === "object";
10
- }
11
- function isSpecial(value) {
12
- var stringValue = Object.prototype.toString.call(value);
13
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
14
- }
15
- var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103;
16
- function isReactElement(value) {
17
- return value.$$typeof === REACT_ELEMENT_TYPE;
18
- }
19
- function emptyTarget(val) {
20
- return Array.isArray(val) ? [] : {};
21
- }
22
- function cloneUnlessOtherwiseSpecified(value, options) {
23
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
24
- }
25
- function defaultArrayMerge(target, source, options) {
26
- return target.concat(source).map(function(element) {
27
- return cloneUnlessOtherwiseSpecified(element, options);
28
- });
29
- }
30
- function getMergeFunction(key, options) {
31
- if (!options.customMerge) return deepmerge;
32
- var customMerge = options.customMerge(key);
33
- return typeof customMerge === "function" ? customMerge : deepmerge;
34
- }
35
- function getEnumerableOwnPropertySymbols(target) {
36
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
37
- return Object.propertyIsEnumerable.call(target, symbol);
38
- }) : [];
39
- }
40
- function getKeys(target) {
41
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
42
- }
43
- function propertyIsOnObject(object, property) {
44
- try {
45
- return property in object;
46
- } catch (_) {
47
- return false;
48
- }
49
- }
50
- function propertyIsUnsafe(target, key) {
51
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
52
- }
53
- function mergeObject(target, source, options) {
54
- var destination = {};
55
- if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) {
56
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
57
- });
58
- getKeys(source).forEach(function(key) {
59
- if (propertyIsUnsafe(target, key)) return;
60
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
61
- else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
62
- });
63
- return destination;
64
- }
65
- function deepmerge(target, source, options) {
66
- options = options || {};
67
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
68
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
69
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
70
- var sourceIsArray = Array.isArray(source);
71
- if (!(sourceIsArray === Array.isArray(target))) return cloneUnlessOtherwiseSpecified(source, options);
72
- else if (sourceIsArray) return options.arrayMerge(target, source, options);
73
- else return mergeObject(target, source, options);
74
- }
75
- deepmerge.all = function deepmergeAll(array, options) {
76
- if (!Array.isArray(array)) throw new Error("first argument should be an array");
77
- return array.reduce(function(prev, next) {
78
- return deepmerge(prev, next, options);
79
- }, {});
80
- };
81
- var deepmerge_1 = deepmerge;
82
- module.exports = deepmerge_1;
83
- }));
84
-
85
- //#endregion
86
- export default require_cjs();
87
-
88
- export { require_cjs };
@@ -1,212 +0,0 @@
1
- import { __commonJSMin } from "../../../_virtual/rolldown_runtime.js";
2
-
3
- //#region ../../node_modules/focus-visible/dist/focus-visible.js
4
- var require_focus_visible = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- (function(global, factory) {
6
- typeof exports === "object" && typeof module !== "undefined" ? factory() : typeof define === "function" && define.amd ? define(factory) : factory();
7
- })(exports, (function() {
8
- "use strict";
9
- /**
10
- * Applies the :focus-visible polyfill at the given scope.
11
- * A scope in this case is either the top-level Document or a Shadow Root.
12
- *
13
- * @param {(Document|ShadowRoot)} scope
14
- * @see https://github.com/WICG/focus-visible
15
- */
16
- function applyFocusVisiblePolyfill(scope) {
17
- var hadKeyboardEvent = true;
18
- var hadFocusVisibleRecently = false;
19
- var hadFocusVisibleRecentlyTimeout = null;
20
- var inputTypesAllowlist = {
21
- text: true,
22
- search: true,
23
- url: true,
24
- tel: true,
25
- email: true,
26
- password: true,
27
- number: true,
28
- date: true,
29
- month: true,
30
- week: true,
31
- time: true,
32
- datetime: true,
33
- "datetime-local": true
34
- };
35
- /**
36
- * Helper function for legacy browsers and iframes which sometimes focus
37
- * elements like document, body, and non-interactive SVG.
38
- * @param {Element} el
39
- */
40
- function isValidFocusTarget(el) {
41
- if (el && el !== document && el.nodeName !== "HTML" && el.nodeName !== "BODY" && "classList" in el && "contains" in el.classList) return true;
42
- return false;
43
- }
44
- /**
45
- * Computes whether the given element should automatically trigger the
46
- * `focus-visible` class being added, i.e. whether it should always match
47
- * `:focus-visible` when focused.
48
- * @param {Element} el
49
- * @return {boolean}
50
- */
51
- function focusTriggersKeyboardModality(el) {
52
- var type = el.type;
53
- var tagName = el.tagName;
54
- if (tagName === "INPUT" && inputTypesAllowlist[type] && !el.readOnly) return true;
55
- if (tagName === "TEXTAREA" && !el.readOnly) return true;
56
- if (el.isContentEditable) return true;
57
- return false;
58
- }
59
- /**
60
- * Add the `focus-visible` class to the given element if it was not added by
61
- * the author.
62
- * @param {Element} el
63
- */
64
- function addFocusVisibleClass(el) {
65
- if (el.classList.contains("focus-visible")) return;
66
- el.classList.add("focus-visible");
67
- el.setAttribute("data-focus-visible-added", "");
68
- }
69
- /**
70
- * Remove the `focus-visible` class from the given element if it was not
71
- * originally added by the author.
72
- * @param {Element} el
73
- */
74
- function removeFocusVisibleClass(el) {
75
- if (!el.hasAttribute("data-focus-visible-added")) return;
76
- el.classList.remove("focus-visible");
77
- el.removeAttribute("data-focus-visible-added");
78
- }
79
- /**
80
- * If the most recent user interaction was via the keyboard;
81
- * and the key press did not include a meta, alt/option, or control key;
82
- * then the modality is keyboard. Otherwise, the modality is not keyboard.
83
- * Apply `focus-visible` to any current active element and keep track
84
- * of our keyboard modality state with `hadKeyboardEvent`.
85
- * @param {KeyboardEvent} e
86
- */
87
- function onKeyDown(e) {
88
- if (e.metaKey || e.altKey || e.ctrlKey) return;
89
- if (isValidFocusTarget(scope.activeElement)) addFocusVisibleClass(scope.activeElement);
90
- hadKeyboardEvent = true;
91
- }
92
- /**
93
- * If at any point a user clicks with a pointing device, ensure that we change
94
- * the modality away from keyboard.
95
- * This avoids the situation where a user presses a key on an already focused
96
- * element, and then clicks on a different element, focusing it with a
97
- * pointing device, while we still think we're in keyboard modality.
98
- * @param {Event} e
99
- */
100
- function onPointerDown(e) {
101
- hadKeyboardEvent = false;
102
- }
103
- /**
104
- * On `focus`, add the `focus-visible` class to the target if:
105
- * - the target received focus as a result of keyboard navigation, or
106
- * - the event target is an element that will likely require interaction
107
- * via the keyboard (e.g. a text box)
108
- * @param {Event} e
109
- */
110
- function onFocus(e) {
111
- if (!isValidFocusTarget(e.target)) return;
112
- if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) addFocusVisibleClass(e.target);
113
- }
114
- /**
115
- * On `blur`, remove the `focus-visible` class from the target.
116
- * @param {Event} e
117
- */
118
- function onBlur(e) {
119
- if (!isValidFocusTarget(e.target)) return;
120
- if (e.target.classList.contains("focus-visible") || e.target.hasAttribute("data-focus-visible-added")) {
121
- hadFocusVisibleRecently = true;
122
- window.clearTimeout(hadFocusVisibleRecentlyTimeout);
123
- hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
124
- hadFocusVisibleRecently = false;
125
- }, 100);
126
- removeFocusVisibleClass(e.target);
127
- }
128
- }
129
- /**
130
- * If the user changes tabs, keep track of whether or not the previously
131
- * focused element had .focus-visible.
132
- * @param {Event} e
133
- */
134
- function onVisibilityChange(e) {
135
- if (document.visibilityState === "hidden") {
136
- if (hadFocusVisibleRecently) hadKeyboardEvent = true;
137
- addInitialPointerMoveListeners();
138
- }
139
- }
140
- /**
141
- * Add a group of listeners to detect usage of any pointing devices.
142
- * These listeners will be added when the polyfill first loads, and anytime
143
- * the window is blurred, so that they are active when the window regains
144
- * focus.
145
- */
146
- function addInitialPointerMoveListeners() {
147
- document.addEventListener("mousemove", onInitialPointerMove);
148
- document.addEventListener("mousedown", onInitialPointerMove);
149
- document.addEventListener("mouseup", onInitialPointerMove);
150
- document.addEventListener("pointermove", onInitialPointerMove);
151
- document.addEventListener("pointerdown", onInitialPointerMove);
152
- document.addEventListener("pointerup", onInitialPointerMove);
153
- document.addEventListener("touchmove", onInitialPointerMove);
154
- document.addEventListener("touchstart", onInitialPointerMove);
155
- document.addEventListener("touchend", onInitialPointerMove);
156
- }
157
- function removeInitialPointerMoveListeners() {
158
- document.removeEventListener("mousemove", onInitialPointerMove);
159
- document.removeEventListener("mousedown", onInitialPointerMove);
160
- document.removeEventListener("mouseup", onInitialPointerMove);
161
- document.removeEventListener("pointermove", onInitialPointerMove);
162
- document.removeEventListener("pointerdown", onInitialPointerMove);
163
- document.removeEventListener("pointerup", onInitialPointerMove);
164
- document.removeEventListener("touchmove", onInitialPointerMove);
165
- document.removeEventListener("touchstart", onInitialPointerMove);
166
- document.removeEventListener("touchend", onInitialPointerMove);
167
- }
168
- /**
169
- * When the polfyill first loads, assume the user is in keyboard modality.
170
- * If any event is received from a pointing device (e.g. mouse, pointer,
171
- * touch), turn off keyboard modality.
172
- * This accounts for situations where focus enters the page from the URL bar.
173
- * @param {Event} e
174
- */
175
- function onInitialPointerMove(e) {
176
- if (e.target.nodeName && e.target.nodeName.toLowerCase() === "html") return;
177
- hadKeyboardEvent = false;
178
- removeInitialPointerMoveListeners();
179
- }
180
- document.addEventListener("keydown", onKeyDown, true);
181
- document.addEventListener("mousedown", onPointerDown, true);
182
- document.addEventListener("pointerdown", onPointerDown, true);
183
- document.addEventListener("touchstart", onPointerDown, true);
184
- document.addEventListener("visibilitychange", onVisibilityChange, true);
185
- addInitialPointerMoveListeners();
186
- scope.addEventListener("focus", onFocus, true);
187
- scope.addEventListener("blur", onBlur, true);
188
- if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) scope.host.setAttribute("data-js-focus-visible", "");
189
- else if (scope.nodeType === Node.DOCUMENT_NODE) {
190
- document.documentElement.classList.add("js-focus-visible");
191
- document.documentElement.setAttribute("data-js-focus-visible", "");
192
- }
193
- }
194
- if (typeof window !== "undefined" && typeof document !== "undefined") {
195
- window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
196
- var event;
197
- try {
198
- event = new CustomEvent("focus-visible-polyfill-ready");
199
- } catch (error) {
200
- event = document.createEvent("CustomEvent");
201
- event.initCustomEvent("focus-visible-polyfill-ready", false, false, {});
202
- }
203
- window.dispatchEvent(event);
204
- }
205
- if (typeof document !== "undefined") applyFocusVisiblePolyfill(document);
206
- }));
207
- }));
208
-
209
- //#endregion
210
- export default require_focus_visible();
211
-
212
- export { require_focus_visible };
@@ -1,11 +0,0 @@
1
- import { __toESM } from "../../../_virtual/rolldown_runtime.js";
2
- import { require_cjs } from "../../../node_modules/deepmerge/dist/cjs.js";
3
- import css from "@styled-system/css";
4
-
5
- //#region src/sx.ts
6
- var import_cjs = /* @__PURE__ */ __toESM(require_cjs());
7
- const sx = (props) => css(props.sx);
8
- var sx_default = sx;
9
-
10
- //#endregion
11
- export { sx_default as default, import_cjs, sx };