chiplet 0.3.0-dev.3 → 0.3.0-dev.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.
Files changed (186) hide show
  1. package/README.md +5 -4
  2. package/dist/component/button/Interactive.js +1 -0
  3. package/dist/component/button/Interactive.js.map +1 -1
  4. package/dist/component/button/style/index.css +37 -37
  5. package/dist/component/button/style/index.css.vanilla.js +1 -1
  6. package/dist/component/checkbox/Checkbox.js +1 -1
  7. package/dist/component/checkbox/Checkbox.js.map +1 -1
  8. package/dist/component/checkbox/CheckboxGroup.js +1 -0
  9. package/dist/component/checkbox/CheckboxGroup.js.map +1 -1
  10. package/dist/component/checkbox/Radio.js +1 -0
  11. package/dist/component/checkbox/Radio.js.map +1 -1
  12. package/dist/component/checkbox/RadioGroup.js +1 -0
  13. package/dist/component/checkbox/RadioGroup.js.map +1 -1
  14. package/dist/component/checkbox/icon/index.js +2 -0
  15. package/dist/component/checkbox/icon/index.js.map +1 -1
  16. package/dist/component/checkbox/style/index.css +79 -71
  17. package/dist/component/checkbox/style/index.css.vanilla.js +10 -10
  18. package/dist/component/index.js +1 -0
  19. package/dist/component/index.js.map +1 -1
  20. package/dist/component/input/Input.js +1 -0
  21. package/dist/component/input/Input.js.map +1 -1
  22. package/dist/component/input/SearchInput.js +1 -0
  23. package/dist/component/input/SearchInput.js.map +1 -1
  24. package/dist/component/input/style/index.css +29 -30
  25. package/dist/component/input/style/index.css.vanilla.js +4 -4
  26. package/dist/component/menu/Menu.js +2 -0
  27. package/dist/component/menu/Menu.js.map +1 -1
  28. package/dist/component/menu/MenuItem.js +1 -0
  29. package/dist/component/menu/MenuItem.js.map +1 -1
  30. package/dist/component/menu/MenuItemCheckbox.js +2 -0
  31. package/dist/component/menu/MenuItemCheckbox.js.map +1 -1
  32. package/dist/component/menu/MenuItemRadio.js +2 -0
  33. package/dist/component/menu/MenuItemRadio.js.map +1 -1
  34. package/dist/component/popover/Dialog.js +1 -0
  35. package/dist/component/popover/Dialog.js.map +1 -1
  36. package/dist/component/popover/DismissButton.js +1 -0
  37. package/dist/component/popover/DismissButton.js.map +1 -1
  38. package/dist/component/popover/Popover.js +1 -0
  39. package/dist/component/popover/Popover.js.map +1 -1
  40. package/dist/component/popover/Tooltip.js +1 -0
  41. package/dist/component/popover/Tooltip.js.map +1 -1
  42. package/dist/component/popover/style/index.css +96 -104
  43. package/dist/component/popover/style/index.css.vanilla.js +4 -4
  44. package/dist/component/select/AutoComplete.js +2 -0
  45. package/dist/component/select/AutoComplete.js.map +1 -1
  46. package/dist/component/select/Group.js +13 -4
  47. package/dist/component/select/Group.js.map +1 -1
  48. package/dist/component/select/Option.js +1 -0
  49. package/dist/component/select/Option.js.map +1 -1
  50. package/dist/component/select/Select.js +2 -0
  51. package/dist/component/select/Select.js.map +1 -1
  52. package/dist/component/select/style/index.css +78 -75
  53. package/dist/component/select/style/index.css.vanilla.js +12 -11
  54. package/dist/component/select/style/index.css.vanilla.js.map +1 -1
  55. package/dist/component/style/article.css +143 -0
  56. package/dist/component/style/article.css.vanilla.js +6 -0
  57. package/dist/component/style/article.css.vanilla.js.map +1 -0
  58. package/dist/component/style/index.js +3 -0
  59. package/dist/component/style/index.js.map +1 -0
  60. package/dist/hook/accessibility/keyboard/Keyboard.js +7 -2
  61. package/dist/hook/accessibility/keyboard/Keyboard.js.map +1 -1
  62. package/dist/hook/accessibility/keyboard/Roving.js +1 -0
  63. package/dist/hook/accessibility/keyboard/Roving.js.map +1 -1
  64. package/dist/hook/accessibility/keyboard/hook/useLastFocused.js +1 -0
  65. package/dist/hook/accessibility/keyboard/hook/useLastFocused.js.map +1 -1
  66. package/dist/hook/accessibility/keyboard/hook/useMoveFocus.js.map +1 -1
  67. package/dist/hook/accessibility/keyboard/hook/useNavigate.js +2 -4
  68. package/dist/hook/accessibility/keyboard/hook/useNavigate.js.map +1 -1
  69. package/dist/hook/accessibility/keyboard/resolve.js +1 -0
  70. package/dist/hook/accessibility/keyboard/resolve.js.map +1 -1
  71. package/dist/hook/accessibility/keyboard/sort.js +1 -1
  72. package/dist/hook/accessibility/keyboard/sort.js.map +1 -1
  73. package/dist/hook/accessibility/keyboard/tree.js +1 -0
  74. package/dist/hook/accessibility/keyboard/tree.js.map +1 -1
  75. package/dist/hook/accessibility/keyboard/useController.js +1 -0
  76. package/dist/hook/accessibility/keyboard/useController.js.map +1 -1
  77. package/dist/hook/accessibility/keyboard/useKeyboard.js +1 -0
  78. package/dist/hook/accessibility/keyboard/useKeyboard.js.map +1 -1
  79. package/dist/hook/document/useHighlight.js +1 -1
  80. package/dist/hook/document/useHighlight.js.map +1 -1
  81. package/dist/hook/form/useAutoComplete.js +1 -3
  82. package/dist/hook/form/useAutoComplete.js.map +1 -1
  83. package/dist/hook/form/useCheckbox.js +1 -0
  84. package/dist/hook/form/useCheckbox.js.map +1 -1
  85. package/dist/hook/form/useChecked.js +1 -0
  86. package/dist/hook/form/useChecked.js.map +1 -1
  87. package/dist/hook/form/useDefault.js +2 -0
  88. package/dist/hook/form/useDefault.js.map +1 -1
  89. package/dist/hook/form/useForm.js +2 -1
  90. package/dist/hook/form/useForm.js.map +1 -1
  91. package/dist/hook/form/useGroup.js +1 -0
  92. package/dist/hook/form/useGroup.js.map +1 -1
  93. package/dist/hook/form/useOption.js +1 -0
  94. package/dist/hook/form/useOption.js.map +1 -1
  95. package/dist/hook/form/useRadio.js +1 -0
  96. package/dist/hook/form/useRadio.js.map +1 -1
  97. package/dist/hook/form/useSelect.js +1 -0
  98. package/dist/hook/form/useSelect.js.map +1 -1
  99. package/dist/hook/form/useValue.js +1 -0
  100. package/dist/hook/form/useValue.js.map +1 -1
  101. package/dist/hook/popover/useAnchorPositioning.js +1 -0
  102. package/dist/hook/popover/useAnchorPositioning.js.map +1 -1
  103. package/dist/hook/popover/useDialog.js +1 -0
  104. package/dist/hook/popover/useDialog.js.map +1 -1
  105. package/dist/hook/popover/useLightDismiss.js +1 -1
  106. package/dist/hook/popover/useLightDismiss.js.map +1 -1
  107. package/dist/hook/popover/useOverlay.js +1 -0
  108. package/dist/hook/popover/useOverlay.js.map +1 -1
  109. package/dist/hook/popover/usePopover.js +6 -2
  110. package/dist/hook/popover/usePopover.js.map +1 -1
  111. package/dist/hook/popover/usePositioning.js +1 -0
  112. package/dist/hook/popover/usePositioning.js.map +1 -1
  113. package/dist/hook/popover/useTooltip.js +2 -1
  114. package/dist/hook/popover/useTooltip.js.map +1 -1
  115. package/dist/hook/react/refValue.js +1 -0
  116. package/dist/hook/react/refValue.js.map +1 -1
  117. package/dist/hook/react/useActivate.js +1 -1
  118. package/dist/hook/react/useActivate.js.map +1 -1
  119. package/dist/hook/react/useInteractive.js +1 -0
  120. package/dist/hook/react/useInteractive.js.map +1 -1
  121. package/dist/hook/react/useUniqueId.js +3 -2
  122. package/dist/hook/react/useUniqueId.js.map +1 -1
  123. package/dist/index.js +5 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/infra/logging/logger.js +10 -12
  126. package/dist/infra/logging/logger.js.map +1 -1
  127. package/dist/theme/defineTheme.js +1 -0
  128. package/dist/theme/defineTheme.js.map +1 -1
  129. package/dist/theme/global.css +7 -7
  130. package/dist/theme/global.css.vanilla.js +8 -8
  131. package/dist/theme/theme.css +23 -27
  132. package/dist/theme/theme.css.vanilla.js +1 -1
  133. package/dist/util/document/accessibility.css.vanilla.js +4 -4
  134. package/dist/util/index.js +4 -1
  135. package/dist/util/index.js.map +1 -1
  136. package/dist/util/random/generateDeterministicId.js +12 -0
  137. package/dist/util/random/generateDeterministicId.js.map +1 -0
  138. package/dist/util/random/generateDigest.js +12 -0
  139. package/dist/util/random/generateDigest.js.map +1 -0
  140. package/dist/util/random/generateUniqueId.js +9 -0
  141. package/dist/util/random/generateUniqueId.js.map +1 -0
  142. package/dist/util/random/index.js +4 -1
  143. package/dist/util/random/index.js.map +1 -1
  144. package/dist/util/random/toHex.js +10 -0
  145. package/dist/util/random/toHex.js.map +1 -0
  146. package/package.json +77 -80
  147. package/src/component/button/style/index.css.ts +1 -1
  148. package/src/component/checkbox/Checkbox.tsx +1 -1
  149. package/src/component/checkbox/style/index.css.ts +34 -25
  150. package/src/component/index.ts +1 -0
  151. package/src/component/input/style/index.css.ts +42 -41
  152. package/src/component/popover/style/index.css.ts +100 -103
  153. package/src/component/select/Group.tsx +11 -3
  154. package/src/component/select/style/index.css.ts +59 -53
  155. package/src/component/style/article.css.ts +189 -0
  156. package/src/component/style/index.ts +1 -0
  157. package/src/hook/accessibility/keyboard/Keyboard.tsx +6 -1
  158. package/src/hook/accessibility/keyboard/hook/useMoveFocus.ts +2 -0
  159. package/src/hook/accessibility/keyboard/hook/useNavigate.ts +5 -5
  160. package/src/hook/accessibility/keyboard/sort.ts +1 -1
  161. package/src/hook/document/useHighlight.ts +1 -27
  162. package/src/hook/form/useAutoComplete.ts +3 -3
  163. package/src/hook/form/useDefault.ts +2 -0
  164. package/src/hook/form/useForm.ts +2 -2
  165. package/src/hook/popover/useLightDismiss.ts +1 -1
  166. package/src/hook/popover/usePopover.ts +6 -12
  167. package/src/hook/popover/useTooltip.ts +2 -1
  168. package/src/hook/react/useActivate.ts +1 -1
  169. package/src/hook/react/useUniqueId.ts +2 -2
  170. package/src/infra/logging/logger.ts +26 -13
  171. package/src/theme/global.css.ts +2 -2
  172. package/src/theme/theme.css.ts +1 -5
  173. package/src/util/document/accessibility.css.ts +3 -3
  174. package/src/util/random/generateDeterministicId.ts +10 -0
  175. package/src/util/random/generateDigest.ts +11 -0
  176. package/src/util/random/{createUniqueId.ts → generateUniqueId.ts} +4 -6
  177. package/src/util/random/index.ts +4 -1
  178. package/src/util/random/toHex.ts +6 -0
  179. package/dist/util/random/createUniqueId.js +0 -8
  180. package/dist/util/random/createUniqueId.js.map +0 -1
  181. package/src/component/style/font/font.css +0 -23
  182. package/src/component/style/font/proxima-nova-bold.woff +0 -0
  183. package/src/component/style/font/proxima-nova-light.woff +0 -0
  184. package/src/component/style/font/proxima-nova-regular.woff +0 -0
  185. package/src/component/style/font/proxima-nova-semibold.woff +0 -0
  186. package/src/component/style/press.module.css +0 -204
@@ -5,6 +5,7 @@ import invariant from 'tiny-invariant'
5
5
  import { KeyboardContext } from './context'
6
6
  import {
7
7
  useLastFocused,
8
+ useMoveFocus,
8
9
  useNavigate,
9
10
  usePool,
10
11
  type Navigate,
@@ -62,10 +63,14 @@ export function Keyboard(props: KeyboardProps) {
62
63
 
63
64
  const [isActivated, activate, reset] = useActivate(onActivate)
64
65
 
65
- const [active, isFocusVisible, navigate] = useNavigate(
66
+ const [active, isFocusVisible, moveFocus] = useMoveFocus(tree)
67
+
68
+ const navigate = useNavigate(
66
69
  type,
67
70
  direction,
68
71
  tree,
72
+ active,
73
+ moveFocus,
69
74
  (...args) => {
70
75
  const target = props.parse?.(...args)
71
76
 
@@ -8,6 +8,8 @@ import {
8
8
  import { preferVirtualFocus } from '../resolve'
9
9
  import type { Tree } from '../tree'
10
10
 
11
+ export type MoveFocus = ReturnType<typeof useMoveFocus>[2]
12
+
11
13
  export function useMoveFocus(tree: Tree) {
12
14
  const [active, setActive] = useState<Element | null>(null)
13
15
  const [isFocusVisible, setIsFocusVisible] = useState(false)
@@ -2,7 +2,7 @@ import { useCallback, useLayoutEffect, useRef } from 'react'
2
2
  import type { NavigationDirection, NavigationType } from '..'
3
3
  import { resolve, type Parse } from '../resolve'
4
4
  import type { Tree } from '../tree'
5
- import { useMoveFocus } from './useMoveFocus'
5
+ import type { MoveFocus } from './useMoveFocus'
6
6
 
7
7
  export type NavigateCallback = (
8
8
  ev: KeyboardEvent | React.KeyboardEvent,
@@ -10,17 +10,17 @@ export type NavigateCallback = (
10
10
  from: Tree.Node | null
11
11
  ) => void
12
12
 
13
- export type Navigate = ReturnType<typeof useNavigate>[2]
13
+ export type Navigate = ReturnType<typeof useNavigate>
14
14
 
15
15
  export function useNavigate(
16
16
  type: NavigationType,
17
17
  direction: NavigationDirection,
18
18
  tree: Tree,
19
+ active: Tree.Node | null,
20
+ moveFocus: MoveFocus,
19
21
  parse: Parse,
20
22
  onNavigate?: NavigateCallback
21
23
  ) {
22
- const [active, isFocusVisible, moveFocus] = useMoveFocus(tree)
23
-
24
24
  const ref = useRef({
25
25
  tree,
26
26
  active,
@@ -87,5 +87,5 @@ export function useNavigate(
87
87
  }
88
88
  })
89
89
 
90
- return [active, isFocusVisible, navigate] as const
90
+ return navigate
91
91
  }
@@ -3,7 +3,7 @@ import { mergeSort } from '#util'
3
3
 
4
4
  export function sort<T extends TreeNode<Element>>(arr: readonly T[]) {
5
5
  return mergeSort(arr, ({ value: a }, { value: b }) => {
6
- /* istanbul ignore next -- @preserve */
6
+ /* istanbul ignore next */
7
7
  if (a === b) {
8
8
  return 0
9
9
  }
@@ -45,7 +45,7 @@ export function useHighlight(
45
45
  )
46
46
 
47
47
  useLayoutEffect(() => {
48
- /* istanbul ignore next -- @preserve */
48
+ /* istanbul ignore next */
49
49
  if (typeof Highlight !== 'function') return
50
50
 
51
51
  const el = refValue(ref)
@@ -76,29 +76,3 @@ export function useHighlight(
76
76
 
77
77
  return highlight
78
78
  }
79
-
80
- declare global {
81
- /**
82
- * https://developer.mozilla.org/en-US/docs/Web/API/Highlight
83
- */
84
- interface Highlight {
85
- readonly size: number
86
- add(range: Range): this
87
- clear(): void
88
- delete(range: Range): boolean
89
- entries(): IterableIterator<[Range, Range]>
90
- has(range: Range): boolean
91
- keys(): IterableIterator<Range>
92
- values(): IterableIterator<Range>
93
- }
94
-
95
- /**
96
- * https://developer.mozilla.org/en-US/docs/Web/API/HighlightRegistry
97
- */
98
- interface HighlightRegistry {
99
- readonly size: number
100
- delete(name: string): boolean
101
- set(name: string, highlight: Highlight): this
102
- values(): IterableIterator<Highlight>
103
- }
104
- }
@@ -194,7 +194,7 @@ export function useAutoComplete<
194
194
  (ev) => {
195
195
  onBlur?.(ev)
196
196
 
197
- /* istanbul ignore else -- @preserve */
197
+ /* istanbul ignore else */
198
198
  if (!ev.defaultPrevented) {
199
199
  setState({
200
200
  query: undefined,
@@ -228,7 +228,7 @@ export function useAutoComplete<
228
228
 
229
229
  const value = args[0].context.value
230
230
 
231
- /* istanbul ignore next -- @preserve */
231
+ /* istanbul ignore next */
232
232
  if (typeof value !== 'string') return
233
233
 
234
234
  const label = options?.find((option) => option.value === value)?.label
@@ -269,7 +269,7 @@ export function useAutoComplete<
269
269
 
270
270
  if (query != null) return query
271
271
 
272
- /* istanbul ignore next -- @preserve */
272
+ /* istanbul ignore next */
273
273
  if (multiple) return ''
274
274
 
275
275
  if (value === undefined) return ''
@@ -90,6 +90,7 @@ export function useDefault<E extends Partial<Event>, T, U extends T>(
90
90
  const isControlled = useConst(() => props.value !== undefined)
91
91
 
92
92
  invariant(
93
+ /* istanbul ignore next */
93
94
  process.env.NODE_ENV === 'production' ||
94
95
  isControlled === (props.value !== undefined),
95
96
  isControlled
@@ -119,6 +120,7 @@ export function useDefault<E extends Partial<Event>, T, U extends T>(
119
120
 
120
121
  const onChange = useCallback<ChangeCallback<E, V>>((ev, value, hint) => {
121
122
  invariant(
123
+ /* istanbul ignore next */
122
124
  process.env.NODE_ENV === 'production' || ref.current.isMounted,
123
125
  'Cannot call `onChange` within the `useLayoutEffect` hook of a child component, as the parent component has not been mounted yet.'
124
126
  )
@@ -1,6 +1,6 @@
1
1
  import { createElement, useMemo, type PropsWithChildren } from 'react'
2
- import { FormContext } from './context'
3
2
  import { useDefault, type ChangeCallback } from '.'
3
+ import { FormContext } from './context'
4
4
 
5
5
  interface Props<T extends object> extends PropsWithChildren {
6
6
  defaultValue?: T | undefined
@@ -21,7 +21,7 @@ export function useForm<P extends Props<{}>>(props: P) {
21
21
  )
22
22
 
23
23
  let { children } = props
24
- children = createElement(FormContext, { value: context }, props.children)
24
+ children = createElement(FormContext, { value: context }, children)
25
25
 
26
26
  props = {
27
27
  ...props,
@@ -136,6 +136,6 @@ function isInside(ev: MouseEvent | React.MouseEvent) {
136
136
 
137
137
  const { clientX: x, clientY: y } = ev
138
138
 
139
- /* istanbul ignore next -- @preserve */
139
+ /* istanbul ignore next */
140
140
  return x >= left && x <= right && y >= top && y <= bottom
141
141
  }
@@ -58,7 +58,7 @@ export function usePopover<T extends React.HTMLElementType = 'div'>(
58
58
 
59
59
  let anchorProps: OverlayAnchorProps = { ...anchor?.props }
60
60
  let positionedProps: React.JSX.IntrinsicElements[T] = { ...props }
61
- let keyboardProps: KeyboardProps = {}
61
+ let keyboardProps: KeyboardProps
62
62
 
63
63
  {
64
64
  const _id = useUniqueId('popover-')
@@ -103,7 +103,11 @@ export function usePopover<T extends React.HTMLElementType = 'div'>(
103
103
  const { anchor, positioned }: Overlay<HTMLElement> = overlay
104
104
 
105
105
  if (positioned && overlay.open && !positioned.matches(':popover-open')) {
106
- positioned.showPopover({ source: source || anchor || undefined })
106
+ const _source = source || anchor
107
+
108
+ positioned.showPopover(
109
+ _source instanceof HTMLElement ? { source: _source } : undefined
110
+ )
107
111
  }
108
112
  })
109
113
 
@@ -178,13 +182,3 @@ export function usePopover<T extends React.HTMLElementType = 'div'>(
178
182
  keyboard: { props: keyboardProps },
179
183
  }
180
184
  }
181
-
182
- declare global {
183
- interface ShowPopoverOptions {
184
- source?: Element | undefined
185
- }
186
-
187
- interface HTMLElement {
188
- showPopover(options?: ShowPopoverOptions): void
189
- }
190
- }
@@ -48,7 +48,7 @@ export function useTooltip(options: TooltipOptions) {
48
48
 
49
49
  let anchorProps: OverlayAnchorProps = { ...anchor?.props }
50
50
  let positionedProps: React.JSX.IntrinsicElements[TooltipTag] = { ...props }
51
- let arrowProps: React.ComponentProps<'div'> = {}
51
+ let arrowProps: React.ComponentProps<'div'>
52
52
 
53
53
  const _id = useUniqueId('tooltip-')
54
54
  positionedProps.id ||= _id
@@ -237,6 +237,7 @@ export function useTooltip(options: TooltipOptions) {
237
237
  ref: positionedRef,
238
238
  }
239
239
 
240
+ // eslint-disable-next-line prefer-const
240
241
  arrowProps = {
241
242
  style: {
242
243
  ...positioning.arrowStyle,
@@ -59,7 +59,7 @@ export function useActivate(onActivate?: ActivateCallback) {
59
59
  ref.current.onActivate?.(ev, target)
60
60
 
61
61
  if (!ev.defaultPrevented) {
62
- /* istanbul ignore next -- @preserve */
62
+ /* istanbul ignore next */
63
63
  const init: MouseEventInit = ev instanceof Event ? ev : ev.nativeEvent
64
64
  target.dispatchEvent(new MouseEvent('click', init))
65
65
  ev.preventDefault()
@@ -1,8 +1,8 @@
1
- import { createUniqueId } from '#util'
1
+ import { generateUniqueId } from '#util'
2
2
  import { useConst } from './useConst'
3
3
 
4
4
  export function useUniqueId(prefix?: string, suffix?: string) {
5
5
  return useConst(() => {
6
- return createUniqueId(prefix, suffix)
6
+ return generateUniqueId(prefix, suffix)
7
7
  })
8
8
  }
@@ -6,6 +6,7 @@ import {
6
6
  type Attributes,
7
7
  type AttributeValue,
8
8
  type MetricOptions,
9
+ type Span,
9
10
  } from '@opentelemetry/api'
10
11
  import { logs, SeverityNumber } from '@opentelemetry/api-logs'
11
12
  import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web'
@@ -51,8 +52,11 @@ import {
51
52
  } from '@opentelemetry/semantic-conventions/incubating'
52
53
  import { compact, isError } from 'lodash-es'
53
54
 
54
- export { SpanStatusCode } from '@opentelemetry/api'
55
- export { type Attributes, type AttributeValue } from '@opentelemetry/api'
55
+ export {
56
+ SpanStatusCode,
57
+ type Attributes,
58
+ type AttributeValue,
59
+ } from '@opentelemetry/api'
56
60
  export { SeverityNumber } from '@opentelemetry/api-logs'
57
61
  export { resourceFromAttributes } from '@opentelemetry/resources'
58
62
  export * from '@opentelemetry/semantic-conventions'
@@ -197,7 +201,7 @@ class Logger {
197
201
 
198
202
  this.#tracerProvider.register()
199
203
 
200
- /* istanbul ignore next -- @preserve */
204
+ /* istanbul ignore next */
201
205
  if (typeof window !== 'undefined') {
202
206
  this.#unregister = registerInstrumentations({
203
207
  instrumentations: [
@@ -341,19 +345,28 @@ class Logger {
341
345
  //#endregion
342
346
 
343
347
  //#region tracer
344
- span(name: string, attributes?: Attributes) {
345
- return this.#tracer.startSpan(name, {
346
- attributes: {
347
- ...this.#attributes,
348
- ...attributes,
349
- },
350
- })
351
- }
348
+ span(name: string, attributes?: Attributes | undefined): Span
352
349
 
353
- mark<T extends (...args: readonly never[]) => Promise<unknown>>(
350
+ span<T extends (...args: readonly never[]) => Promise<unknown>>(
354
351
  name: string,
355
352
  operation: T
353
+ ): T
354
+
355
+ span<T extends (...args: readonly never[]) => Promise<unknown>>(
356
+ name: string,
357
+ attributes?: Attributes | T
356
358
  ) {
359
+ if (typeof attributes !== 'function') {
360
+ return this.#tracer.startSpan(name, {
361
+ attributes: {
362
+ ...this.#attributes,
363
+ ...attributes,
364
+ },
365
+ })
366
+ }
367
+
368
+ const operation = attributes
369
+
357
370
  return ((...args) => {
358
371
  return this.#tracer.startActiveSpan(name, async (span) => {
359
372
  const startTime = performance.now()
@@ -364,7 +377,7 @@ class Logger {
364
377
  } catch (err) {
365
378
  status = SpanStatusCode.ERROR
366
379
 
367
- /* istanbul ignore else -- @preserve */
380
+ /* istanbul ignore else */
368
381
  if (isError(err) || typeof err === 'string') span.recordException(err)
369
382
 
370
383
  throw err
@@ -1,5 +1,5 @@
1
1
  import {
2
- createUniqueId,
2
+ generateDeterministicId,
3
3
  VirtualActiveSelector,
4
4
  VirtualDisabledSelector,
5
5
  VirtualFocusSelector,
@@ -15,7 +15,7 @@ import { tokenClass } from './token.css'
15
15
 
16
16
  export const radiusVar = createVar()
17
17
 
18
- export const HighlightName = createUniqueId('highlight-')
18
+ export const HighlightName = generateDeterministicId('highlight-')
19
19
 
20
20
  export const FocusSelector = `:where(:focus-visible, ${VirtualFocusSelector})`
21
21
 
@@ -258,8 +258,8 @@ export const [themeClass, theme] = createTheme({
258
258
  },
259
259
 
260
260
  checkbox: {
261
+ outset: gap,
261
262
  size: token.sizing.width,
262
- margin: gap,
263
263
  color: palette.neutral.foreground4,
264
264
  colorHover: palette.neutral.foreground1,
265
265
  colorActive: palette.neutral.foreground4,
@@ -324,8 +324,6 @@ export const [themeClass, theme] = createTheme({
324
324
  tooltip: {
325
325
  minHeight: token.sizing.height.medium,
326
326
  padding: token.spacing.padding.small,
327
- fontSize: token.typography.body2.fontSize,
328
- lineHeight: token.typography.body2.lineHeight,
329
327
  color: colorInverted,
330
328
  background: backgroundInverted,
331
329
  border: 'none',
@@ -346,8 +344,6 @@ export const [themeClass, theme] = createTheme({
346
344
  gap: token.spacing.gap.small,
347
345
  height: token.sizing.height.small,
348
346
  padding: token.spacing.padding.medium,
349
- fontSize: token.typography.body2.fontSize,
350
- lineHeight: token.typography.body2.lineHeight,
351
347
  radius,
352
348
  icon: token.sizing.width.small,
353
349
  },
@@ -1,8 +1,8 @@
1
- import { createUniqueId } from '../random'
1
+ import { generateDeterministicId } from '../random'
2
2
 
3
- export const VirtualFocus = createUniqueId('data-focus-visible-')
3
+ export const VirtualFocus = generateDeterministicId('data-focus-visible-')
4
4
  export const VirtualFocusSelector = `[${VirtualFocus}="true"]` as const
5
- export const VirtualActive = createUniqueId('data-active-')
5
+ export const VirtualActive = generateDeterministicId('data-active-')
6
6
  export const VirtualActiveSelector = `[${VirtualActive}="true"]` as const
7
7
  export const VirtualDisabled = 'aria-disabled'
8
8
  export const VirtualDisabledSelector = '[aria-disabled="true"]'
@@ -0,0 +1,10 @@
1
+ /* istanbul ignore file */
2
+ import { generateIdentifier } from '@vanilla-extract/css'
3
+
4
+ export function generateDeterministicId<P extends string>(prefix: P) {
5
+ return (prefix +
6
+ generateIdentifier({
7
+ debugId: '',
8
+ debugFileName: false,
9
+ })) as `${P}${string}`
10
+ }
@@ -0,0 +1,11 @@
1
+ import { toHex } from './toHex'
2
+
3
+ export async function generateDigest(message: string) {
4
+ const encoder = new TextEncoder()
5
+
6
+ const buffer = encoder.encode(message)
7
+
8
+ const hash = await crypto.subtle.digest('SHA-256', buffer)
9
+
10
+ return toHex(new Uint8Array(hash))
11
+ }
@@ -1,12 +1,10 @@
1
- export function createUniqueId<
1
+ import { toHex } from './toHex'
2
+
3
+ export function generateUniqueId<
2
4
  P extends string | undefined = '',
3
5
  S extends string | undefined = '',
4
6
  >(prefix: P = '' as P, suffix: S = '' as S) {
5
- const val = crypto
6
- .getRandomValues(new Uint8Array(4))
7
- .reduce((acc, byte) => acc + byte.toString(16).padStart(2, '0'), '')
8
-
9
7
  return (prefix +
10
- val +
8
+ toHex(crypto.getRandomValues(new Uint8Array(4))) +
11
9
  suffix) as `${NoInfer<P extends string ? P : ''>}${string}${NoInfer<S extends string ? S : ''>}`
12
10
  }
@@ -1,2 +1,5 @@
1
+ export * from './generateDeterministicId'
2
+ export * from './generateDigest'
3
+ export * from './generateUniqueId'
4
+ export * from './toHex'
1
5
  export * from './UUID'
2
- export * from './createUniqueId'
@@ -0,0 +1,6 @@
1
+ export function toHex(bytes: Uint8Array) {
2
+ return bytes.reduce(
3
+ (acc, byte) => acc + byte.toString(16).padStart(2, '0'),
4
+ ''
5
+ )
6
+ }
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- function createUniqueId(prefix = "", suffix = "") {
3
- const val = crypto.getRandomValues(new Uint8Array(4)).reduce((acc, byte) => acc + byte.toString(16).padStart(2, "0"), "");
4
- return prefix + val + suffix;
5
- }
6
-
7
- export { createUniqueId };
8
- //# sourceMappingURL=createUniqueId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUniqueId.js","sources":["../../../src/util/random/createUniqueId.ts"],"sourcesContent":["export function createUniqueId<\n P extends string | undefined = '',\n S extends string | undefined = '',\n>(prefix: P = '' as P, suffix: S = '' as S) {\n const val = crypto\n .getRandomValues(new Uint8Array(4))\n .reduce((acc, byte) => acc + byte.toString(16).padStart(2, '0'), '')\n\n return (prefix +\n val +\n suffix) as `${NoInfer<P extends string ? P : ''>}${string}${NoInfer<S extends string ? S : ''>}`\n}\n"],"names":[],"mappings":";AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAGd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,EAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAS;AAC1C,CAAA,CAAA,MAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EACT,eAAA,CAAgB,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAW,CAAC,CAAC,EACjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAC,CAAA,CAAA,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,GAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,EAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAE,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAG,GAAG,CAAA,CAAA,CAAG,EAAE,CAAA;AAErE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,IACN,CAAA,CAAA,CAAA,GACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACJ;;"}
@@ -1,23 +0,0 @@
1
- @font-face {
2
- font-family: 'Proxima Nova';
3
- font-weight: 300;
4
- src: url('./proxima-nova-light.woff') format('woff');
5
- }
6
-
7
- @font-face {
8
- font-family: 'Proxima Nova';
9
- font-weight: 400;
10
- src: url('./proxima-nova-regular.woff') format('woff');
11
- }
12
-
13
- @font-face {
14
- font-family: 'Proxima Nova';
15
- font-weight: 600;
16
- src: url('./proxima-nova-semibold.woff') format('woff');
17
- }
18
-
19
- @font-face {
20
- font-family: 'Proxima Nova';
21
- font-weight: 700;
22
- src: url('./proxima-nova-bold.woff') format('woff');
23
- }