chiplet 0.3.0 → 0.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/README.md +2 -5
- package/dist/assets/positioning.css.ts.vanilla-BLJ90UCF.css +60 -0
- package/dist/component/button/Button.js +5 -5
- package/dist/component/button/Button.js.map +1 -1
- package/dist/component/button/IconButton.js +1 -1
- package/dist/component/button/IconButton.js.map +1 -1
- package/dist/component/button/Interactive.js +2 -17
- package/dist/component/button/Interactive.js.map +1 -1
- package/dist/component/button/LinkButton.js +7 -5
- package/dist/component/button/LinkButton.js.map +1 -1
- package/dist/component/button/index.js +1 -0
- package/dist/component/button/index.js.map +1 -1
- package/dist/component/button/style/{index.css.vanilla.js → index.css.js} +5 -5
- package/dist/component/button/style/index.css.js.map +1 -0
- package/dist/component/checkbox/Checkbox.js +9 -19
- package/dist/component/checkbox/Checkbox.js.map +1 -1
- package/dist/component/checkbox/CheckboxGroup.js +2 -17
- package/dist/component/checkbox/CheckboxGroup.js.map +1 -1
- package/dist/component/checkbox/Radio.js +7 -18
- package/dist/component/checkbox/Radio.js.map +1 -1
- package/dist/component/checkbox/RadioGroup.js +2 -17
- package/dist/component/checkbox/RadioGroup.js.map +1 -1
- package/dist/component/checkbox/Switch.js +2 -2
- package/dist/component/checkbox/Switch.js.map +1 -1
- package/dist/component/checkbox/icon/index.js +0 -29
- package/dist/component/checkbox/icon/index.js.map +1 -1
- package/dist/component/checkbox/style/{index.css.vanilla.js → index.css.js} +4 -5
- package/dist/component/checkbox/style/index.css.js.map +1 -0
- package/dist/component/header/Header.js +2 -2
- package/dist/component/header/Header.js.map +1 -1
- package/dist/component/header/style/index.css.js +7 -0
- package/dist/component/header/style/index.css.js.map +1 -0
- package/dist/component/index.js +21 -19
- package/dist/component/index.js.map +1 -1
- package/dist/component/input/Input.js +7 -18
- package/dist/component/input/Input.js.map +1 -1
- package/dist/component/input/SearchInput.js +7 -13
- package/dist/component/input/SearchInput.js.map +1 -1
- package/dist/component/input/style/{index.css.vanilla.js → index.css.js} +5 -5
- package/dist/component/input/style/index.css.js.map +1 -0
- package/dist/component/menu/Menu.js +2 -28
- package/dist/component/menu/Menu.js.map +1 -1
- package/dist/component/menu/MenuButton.js +1 -3
- package/dist/component/menu/MenuButton.js.map +1 -1
- package/dist/component/menu/MenuItem.js +2 -18
- package/dist/component/menu/MenuItem.js.map +1 -1
- package/dist/component/menu/MenuItemCheckbox.js +4 -31
- package/dist/component/menu/MenuItemCheckbox.js.map +1 -1
- package/dist/component/menu/MenuItemRadio.js +5 -32
- package/dist/component/menu/MenuItemRadio.js.map +1 -1
- package/dist/component/menu/renderMenuItem.js +6 -2
- package/dist/component/menu/renderMenuItem.js.map +1 -1
- package/dist/component/popover/Dialog.js +2 -17
- package/dist/component/popover/Dialog.js.map +1 -1
- package/dist/component/popover/DismissButton.js +2 -19
- package/dist/component/popover/DismissButton.js.map +1 -1
- package/dist/component/popover/Popover.js +2 -17
- package/dist/component/popover/Popover.js.map +1 -1
- package/dist/component/popover/ShadowRoot.js +34 -0
- package/dist/component/popover/ShadowRoot.js.map +1 -0
- package/dist/component/popover/Tooltip.js +4 -18
- package/dist/component/popover/Tooltip.js.map +1 -1
- package/dist/component/popover/index.js +1 -0
- package/dist/component/popover/index.js.map +1 -1
- package/dist/component/popover/style/{index.css.vanilla.js → index.css.js} +5 -5
- package/dist/component/popover/style/index.css.js.map +1 -0
- package/dist/component/progress/Spinner.js +1 -1
- package/dist/component/progress/style/{index.css.vanilla.js → index.css.js} +4 -5
- package/dist/component/progress/style/index.css.js.map +1 -0
- package/dist/component/select/AutoComplete.js +7 -30
- package/dist/component/select/AutoComplete.js.map +1 -1
- package/dist/component/select/Group.js +3 -18
- package/dist/component/select/Group.js.map +1 -1
- package/dist/component/select/Option.js +7 -22
- package/dist/component/select/Option.js.map +1 -1
- package/dist/component/select/Select.js +6 -29
- package/dist/component/select/Select.js.map +1 -1
- package/dist/component/select/Separator.js +1 -1
- package/dist/component/select/style/{index.css.vanilla.js → index.css.js} +5 -5
- package/dist/component/select/style/index.css.js.map +1 -0
- package/dist/component/style/article.css.js +6 -0
- package/dist/component/style/article.css.js.map +1 -0
- package/dist/component/style/index.js +1 -1
- package/dist/component/typography/Body1.js +1 -1
- package/dist/component/typography/Body2.js +1 -1
- package/dist/component/typography/Body3.js +1 -1
- package/dist/component/typography/Caption1.js +1 -1
- package/dist/component/typography/Caption2.js +1 -1
- package/dist/component/typography/Heading1.js +1 -1
- package/dist/component/typography/Heading2.js +1 -1
- package/dist/component/typography/Heading3.js +1 -1
- package/dist/component/typography/Heading4.js +1 -1
- package/dist/component/typography/style/{index.css.vanilla.js → index.css.js} +4 -5
- package/dist/component/typography/style/index.css.js.map +1 -0
- package/dist/hook/accessibility/keyboard/Keyboard.js +6 -18
- package/dist/hook/accessibility/keyboard/Keyboard.js.map +1 -1
- package/dist/hook/accessibility/keyboard/Roving.js +0 -15
- package/dist/hook/accessibility/keyboard/Roving.js.map +1 -1
- package/dist/hook/accessibility/keyboard/context/index.js.map +1 -1
- package/dist/hook/accessibility/keyboard/hook/useLastFocused.js +1 -4
- package/dist/hook/accessibility/keyboard/hook/useLastFocused.js.map +1 -1
- package/dist/hook/accessibility/keyboard/hook/useNavigate.js.map +1 -1
- package/dist/hook/accessibility/keyboard/resolve.js +1 -4
- package/dist/hook/accessibility/keyboard/resolve.js.map +1 -1
- package/dist/hook/accessibility/keyboard/sort.js +0 -3
- package/dist/hook/accessibility/keyboard/sort.js.map +1 -1
- package/dist/hook/accessibility/keyboard/tree.js +1 -4
- package/dist/hook/accessibility/keyboard/tree.js.map +1 -1
- package/dist/hook/accessibility/keyboard/useController.js +2 -15
- package/dist/hook/accessibility/keyboard/useController.js.map +1 -1
- package/dist/hook/accessibility/keyboard/useKeyboard.js +2 -16
- package/dist/hook/accessibility/keyboard/useKeyboard.js.map +1 -1
- package/dist/hook/document/useHighlight.js +1 -6
- package/dist/hook/document/useHighlight.js.map +1 -1
- package/dist/hook/form/context/index.js.map +1 -1
- package/dist/hook/form/useAutoComplete.js +2 -16
- package/dist/hook/form/useAutoComplete.js.map +1 -1
- package/dist/hook/form/useChange.js.map +1 -1
- package/dist/hook/form/useCheckbox.js +0 -16
- package/dist/hook/form/useCheckbox.js.map +1 -1
- package/dist/hook/form/useChecked.js +1 -14
- package/dist/hook/form/useChecked.js.map +1 -1
- package/dist/hook/form/useForm.js +1 -15
- package/dist/hook/form/useForm.js.map +1 -1
- package/dist/hook/form/useGroup.js +18 -30
- package/dist/hook/form/useGroup.js.map +1 -1
- package/dist/hook/form/useName.js.map +1 -1
- package/dist/hook/form/useOption.js +0 -16
- package/dist/hook/form/useOption.js.map +1 -1
- package/dist/hook/form/useRadio.js +0 -16
- package/dist/hook/form/useRadio.js.map +1 -1
- package/dist/hook/form/useSelect.js +0 -16
- package/dist/hook/form/useSelect.js.map +1 -1
- package/dist/hook/form/useValue.js +0 -15
- package/dist/hook/form/useValue.js.map +1 -1
- package/dist/hook/index.js +22 -21
- package/dist/hook/index.js.map +1 -1
- package/dist/hook/observable/useObservable.js +6 -1
- package/dist/hook/observable/useObservable.js.map +1 -1
- package/dist/hook/popover/context/index.js.map +1 -1
- package/dist/hook/popover/index.js +2 -1
- package/dist/hook/popover/index.js.map +1 -1
- package/dist/hook/popover/style/positioning.css.js +13 -0
- package/dist/hook/popover/style/positioning.css.js.map +1 -0
- package/dist/hook/popover/useAnchorPositioning.js +6 -88
- package/dist/hook/popover/useAnchorPositioning.js.map +1 -1
- package/dist/hook/popover/useDialog.js +1 -15
- package/dist/hook/popover/useDialog.js.map +1 -1
- package/dist/hook/popover/useLightDismiss.js +16 -4
- package/dist/hook/popover/useLightDismiss.js.map +1 -1
- package/dist/hook/popover/useOverlay.js +8 -20
- package/dist/hook/popover/useOverlay.js.map +1 -1
- package/dist/hook/popover/usePopover.js +12 -23
- package/dist/hook/popover/usePopover.js.map +1 -1
- package/dist/hook/popover/usePositioning.js +10 -16
- package/dist/hook/popover/usePositioning.js.map +1 -1
- package/dist/hook/popover/useReturnFocus.js.map +1 -1
- package/dist/hook/popover/useTooltip.js +4 -15
- package/dist/hook/popover/useTooltip.js.map +1 -1
- package/dist/hook/promise/usePromise.js +1 -1
- package/dist/hook/promise/usePromise.js.map +1 -1
- package/dist/hook/react/refValue.js +0 -3
- package/dist/hook/react/refValue.js.map +1 -1
- package/dist/hook/react/useActivate.js +4 -4
- package/dist/hook/react/useActivate.js.map +1 -1
- package/dist/hook/react/useConst.js +3 -2
- package/dist/hook/react/useConst.js.map +1 -1
- package/dist/hook/react/useInteractive.js +1 -4
- package/dist/hook/react/useInteractive.js.map +1 -1
- package/dist/hook/react/useRefCallback.js.map +1 -1
- package/dist/hook/react/useUniqueId.js +1 -4
- package/dist/hook/react/useUniqueId.js.map +1 -1
- package/dist/index.js +112 -109
- package/dist/index.js.map +1 -1
- package/dist/infra/index.js +1 -1
- package/dist/infra/logging/logger.js +13 -10
- package/dist/infra/logging/logger.js.map +1 -1
- package/dist/theme/defineTheme.js +0 -3
- package/dist/theme/defineTheme.js.map +1 -1
- package/dist/theme/{global.css.vanilla.js → global.css.js} +4 -4
- package/dist/theme/global.css.js.map +1 -0
- package/dist/theme/index.js +5 -3
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/{theme.css.vanilla.js → theme.css.js} +3 -3
- package/dist/theme/theme.css.js.map +1 -0
- package/dist/theme/{token.css.vanilla.js → token.css.js} +2 -2
- package/dist/theme/token.css.js.map +1 -0
- package/dist/theme/useSystemColorScheme.js +16 -16
- package/dist/theme/useSystemColorScheme.js.map +1 -1
- package/dist/util/array/index.js +0 -1
- package/dist/util/array/index.js.map +1 -1
- package/dist/util/document/{accessibility.css.vanilla.js → accessibility.css.js} +1 -1
- package/dist/util/document/accessibility.css.js.map +1 -0
- package/dist/util/document/index.js +1 -1
- package/dist/util/file/readAsDataURL.js +15 -4
- package/dist/util/file/readAsDataURL.js.map +1 -1
- package/dist/util/index.js +28 -30
- package/dist/util/index.js.map +1 -1
- package/dist/util/linked-list/buildLinkedList.js.map +1 -1
- package/dist/util/lock/lock.js +0 -2
- package/dist/util/lock/lock.js.map +1 -1
- package/dist/util/random/index.js +0 -1
- package/dist/util/random/index.js.map +1 -1
- package/dist/util/tree/addTreeNode.js.map +1 -1
- package/dist/util/tree/attachChild.js +7 -1
- package/dist/util/tree/attachChild.js.map +1 -1
- package/dist/util/tree/buildTree.js.map +1 -1
- package/dist/util/tree/detachChild.js +3 -0
- package/dist/util/tree/detachChild.js.map +1 -1
- package/dist/util/tree/iterateChildren.js.map +1 -1
- package/dist/util/tree/iterateTree.js.map +1 -1
- package/package.json +49 -47
- package/src/component/button/Button.tsx +4 -5
- package/src/component/button/IconButton.tsx +1 -1
- package/src/component/button/LinkButton.tsx +14 -6
- package/src/component/button/index.ts +1 -0
- package/src/component/checkbox/Checkbox.tsx +8 -1
- package/src/component/checkbox/Radio.tsx +5 -1
- package/src/component/checkbox/Switch.tsx +1 -1
- package/src/component/checkbox/icon/index.ts +1 -1
- package/src/component/header/Header.tsx +1 -1
- package/src/component/input/Input.tsx +5 -1
- package/src/component/input/SearchInput.tsx +10 -9
- package/src/component/menu/Menu.tsx +1 -1
- package/src/component/menu/MenuItemCheckbox.tsx +1 -1
- package/src/component/menu/MenuItemRadio.tsx +1 -1
- package/src/component/menu/renderMenuItem.tsx +5 -1
- package/src/component/popover/ShadowRoot.tsx +42 -0
- package/src/component/popover/Tooltip.tsx +2 -2
- package/src/component/popover/index.ts +1 -0
- package/src/component/select/AutoComplete.tsx +3 -7
- package/src/component/select/Group.tsx +1 -1
- package/src/component/select/Option.tsx +1 -1
- package/src/component/select/Select.tsx +3 -7
- package/src/hook/accessibility/keyboard/Keyboard.tsx +1 -1
- package/src/hook/accessibility/keyboard/Roving.tsx +1 -1
- package/src/hook/accessibility/keyboard/context/index.ts +2 -2
- package/src/hook/accessibility/keyboard/hook/useLastFocused.ts +7 -1
- package/src/hook/accessibility/keyboard/hook/useNavigate.ts +1 -1
- package/src/hook/accessibility/keyboard/resolve.ts +1 -1
- package/src/hook/accessibility/keyboard/useController.ts +3 -2
- package/src/hook/accessibility/keyboard/useKeyboard.ts +3 -2
- package/src/hook/document/useHighlight.ts +5 -4
- package/src/hook/form/context/index.ts +1 -1
- package/src/hook/form/useAutoComplete.ts +14 -14
- package/src/hook/form/useChange.ts +1 -1
- package/src/hook/form/useCheckbox.ts +2 -2
- package/src/hook/form/useChecked.ts +3 -2
- package/src/hook/form/useForm.ts +1 -1
- package/src/hook/form/useGroup.ts +20 -21
- package/src/hook/form/useName.ts +1 -1
- package/src/hook/form/useOption.ts +2 -2
- package/src/hook/form/useRadio.ts +2 -2
- package/src/hook/form/useSelect.ts +15 -12
- package/src/hook/form/useValue.ts +3 -2
- package/src/hook/observable/useObservable.ts +14 -1
- package/src/hook/popover/context/index.ts +1 -1
- package/src/hook/popover/style/positioning.css.ts +112 -0
- package/src/hook/popover/useAnchorPositioning.ts +16 -105
- package/src/hook/popover/useDialog.ts +5 -4
- package/src/hook/popover/useLightDismiss.ts +27 -0
- package/src/hook/popover/useOverlay.ts +17 -8
- package/src/hook/popover/usePopover.ts +22 -24
- package/src/hook/popover/usePositioning.ts +17 -20
- package/src/hook/popover/useReturnFocus.ts +12 -3
- package/src/hook/popover/useTooltip.ts +10 -9
- package/src/hook/promise/usePromise.ts +4 -1
- package/src/hook/react/useActivate.ts +8 -1
- package/src/hook/react/useConst.ts +3 -3
- package/src/hook/react/useRefCallback.ts +3 -1
- package/src/infra/logging/logger.ts +43 -19
- package/src/theme/global.css.ts +1 -28
- package/src/theme/index.ts +4 -0
- package/src/theme/useSystemColorScheme.ts +22 -20
- package/src/util/array/index.ts +0 -1
- package/src/util/document/accessibility.css.ts +1 -1
- package/src/util/file/readAsDataURL.ts +17 -4
- package/src/util/linked-list/buildLinkedList.ts +1 -1
- package/src/util/number/index.ts +2 -0
- package/src/util/random/index.ts +4 -1
- package/src/util/tree/addTreeNode.ts +1 -1
- package/src/util/tree/attachChild.ts +13 -2
- package/src/util/tree/buildTree.ts +1 -1
- package/src/util/tree/detachChild.ts +7 -1
- package/src/util/tree/iterateChildren.ts +1 -1
- package/src/util/tree/iterateTree.ts +1 -1
- package/dist/component/button/style/index.css.vanilla.js.map +0 -1
- package/dist/component/checkbox/style/index.css.vanilla.js.map +0 -1
- package/dist/component/header/style/index.css.vanilla.js +0 -7
- package/dist/component/header/style/index.css.vanilla.js.map +0 -1
- package/dist/component/input/style/index.css.vanilla.js.map +0 -1
- package/dist/component/popover/style/index.css.vanilla.js.map +0 -1
- package/dist/component/progress/style/index.css.vanilla.js.map +0 -1
- package/dist/component/select/style/index.css.vanilla.js.map +0 -1
- package/dist/component/style/article.css.vanilla.js +0 -6
- package/dist/component/style/article.css.vanilla.js.map +0 -1
- package/dist/component/typography/style/index.css.vanilla.js.map +0 -1
- package/dist/theme/global.css.vanilla.js.map +0 -1
- package/dist/theme/theme.css.vanilla.js.map +0 -1
- package/dist/theme/token.css.vanilla.js.map +0 -1
- package/dist/util/array/fromAsync.js +0 -11
- package/dist/util/array/fromAsync.js.map +0 -1
- package/dist/util/document/accessibility.css.vanilla.js.map +0 -1
- package/src/util/array/fromAsync.ts +0 -11
- /package/dist/{article.css → assets/article.css.ts.vanilla-s_HEpsy3.css} +0 -0
- /package/dist/{global.css → assets/global.css.ts.vanilla-CTwjHiaM.css} +0 -0
- /package/dist/{index8.css → assets/index.css.ts.vanilla-9qGDrdgn.css} +0 -0
- /package/dist/{index6.css → assets/index.css.ts.vanilla-BsBngo8U.css} +0 -0
- /package/dist/{index2.css → assets/index.css.ts.vanilla-CVNLkHc9.css} +0 -0
- /package/dist/{index3.css → assets/index.css.ts.vanilla-C_RzxiYH.css} +0 -0
- /package/dist/{index5.css → assets/index.css.ts.vanilla-CvQQLJ-M.css} +0 -0
- /package/dist/{index.css → assets/index.css.ts.vanilla-DGmHFJbF.css} +0 -0
- /package/dist/{index4.css → assets/index.css.ts.vanilla-VHSAjLub.css} +0 -0
- /package/dist/{index7.css → assets/index.css.ts.vanilla-kgyRRvgH.css} +0 -0
- /package/dist/{theme.css → assets/theme.css.ts.vanilla-Bjn8sb_B.css} +0 -0
- /package/dist/{token.css → assets/token.css.ts.vanilla-B3LtFaO7.css} +0 -0
|
@@ -4,11 +4,15 @@ import {
|
|
|
4
4
|
SpanStatusCode,
|
|
5
5
|
trace,
|
|
6
6
|
type Attributes,
|
|
7
|
-
type AttributeValue,
|
|
8
7
|
type MetricOptions,
|
|
9
8
|
type Span,
|
|
10
9
|
} from '@opentelemetry/api'
|
|
11
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
logs,
|
|
12
|
+
SeverityNumber,
|
|
13
|
+
type LogAttributes,
|
|
14
|
+
type LogBody,
|
|
15
|
+
} from '@opentelemetry/api-logs'
|
|
12
16
|
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web'
|
|
13
17
|
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'
|
|
14
18
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'
|
|
@@ -114,7 +118,7 @@ class Logger {
|
|
|
114
118
|
|
|
115
119
|
#meter = metrics.getMeter(this.#name)
|
|
116
120
|
|
|
117
|
-
#attributes:
|
|
121
|
+
#attributes: LogAttributes = {}
|
|
118
122
|
|
|
119
123
|
async configure(config?: {
|
|
120
124
|
debug?: boolean | undefined
|
|
@@ -123,7 +127,7 @@ class Logger {
|
|
|
123
127
|
traceProcessors?: readonly SpanProcessor[] | undefined
|
|
124
128
|
metricReaders?: readonly IMetricReader[] | undefined
|
|
125
129
|
resource?: Resource | undefined
|
|
126
|
-
attributes?:
|
|
130
|
+
attributes?: LogAttributes | undefined
|
|
127
131
|
}) {
|
|
128
132
|
await this.dispose()
|
|
129
133
|
|
|
@@ -142,15 +146,17 @@ class Logger {
|
|
|
142
146
|
processors: compact<LogRecordProcessor>([
|
|
143
147
|
...(config?.logProcessors ?? []),
|
|
144
148
|
config?.collector
|
|
145
|
-
? new BatchLogRecordProcessor(
|
|
146
|
-
new OTLPLogExporter({
|
|
149
|
+
? new BatchLogRecordProcessor({
|
|
150
|
+
exporter: new OTLPLogExporter({
|
|
147
151
|
url: config.collector.url,
|
|
148
152
|
headers: { ...config.collector.headers },
|
|
149
|
-
})
|
|
150
|
-
)
|
|
153
|
+
}),
|
|
154
|
+
})
|
|
151
155
|
: null,
|
|
152
156
|
config?.debug && isDev
|
|
153
|
-
? new SimpleLogRecordProcessor(
|
|
157
|
+
? new SimpleLogRecordProcessor({
|
|
158
|
+
exporter: new ConsoleLogRecordExporter(),
|
|
159
|
+
})
|
|
154
160
|
: null,
|
|
155
161
|
]),
|
|
156
162
|
})
|
|
@@ -273,8 +279,8 @@ class Logger {
|
|
|
273
279
|
private collect(
|
|
274
280
|
level: SeverityNumber,
|
|
275
281
|
event: string,
|
|
276
|
-
body?:
|
|
277
|
-
attributes?:
|
|
282
|
+
body?: LogBody,
|
|
283
|
+
attributes?: LogAttributes
|
|
278
284
|
) {
|
|
279
285
|
this.#logger.emit({
|
|
280
286
|
eventName: event,
|
|
@@ -288,23 +294,27 @@ class Logger {
|
|
|
288
294
|
})
|
|
289
295
|
}
|
|
290
296
|
|
|
291
|
-
trace = (event: string, message?: string, attributes?:
|
|
297
|
+
trace = (event: string, message?: string, attributes?: LogAttributes) => {
|
|
292
298
|
this.collect(SeverityNumber.TRACE, event, message, attributes)
|
|
293
299
|
}
|
|
294
300
|
|
|
295
|
-
debug = (event: string, message?: string, attributes?:
|
|
301
|
+
debug = (event: string, message?: string, attributes?: LogAttributes) => {
|
|
296
302
|
this.collect(SeverityNumber.DEBUG, event, message, attributes)
|
|
297
303
|
}
|
|
298
304
|
|
|
299
|
-
info = (event: string, message?: string, attributes?:
|
|
305
|
+
info = (event: string, message?: string, attributes?: LogAttributes) => {
|
|
300
306
|
this.collect(SeverityNumber.INFO, event, message, attributes)
|
|
301
307
|
}
|
|
302
308
|
|
|
303
|
-
warn = (event: string, message?: string, attributes?:
|
|
309
|
+
warn = (event: string, message?: string, attributes?: LogAttributes) => {
|
|
304
310
|
this.collect(SeverityNumber.WARN, event, message, attributes)
|
|
305
311
|
}
|
|
306
312
|
|
|
307
|
-
error = (
|
|
313
|
+
error = (
|
|
314
|
+
event: string,
|
|
315
|
+
error?: Error | string,
|
|
316
|
+
attributes?: LogAttributes
|
|
317
|
+
) => {
|
|
308
318
|
this.collect(
|
|
309
319
|
SeverityNumber.ERROR,
|
|
310
320
|
event,
|
|
@@ -313,7 +323,11 @@ class Logger {
|
|
|
313
323
|
)
|
|
314
324
|
}
|
|
315
325
|
|
|
316
|
-
fatal = (
|
|
326
|
+
fatal = (
|
|
327
|
+
event: string,
|
|
328
|
+
error?: Error | string,
|
|
329
|
+
attributes?: LogAttributes
|
|
330
|
+
) => {
|
|
317
331
|
this.collect(
|
|
318
332
|
SeverityNumber.FATAL,
|
|
319
333
|
event,
|
|
@@ -322,7 +336,10 @@ class Logger {
|
|
|
322
336
|
)
|
|
323
337
|
}
|
|
324
338
|
|
|
325
|
-
private parseError(
|
|
339
|
+
private parseError(
|
|
340
|
+
error: unknown,
|
|
341
|
+
seen: Set<unknown> = new Set()
|
|
342
|
+
): LogAttributes | undefined {
|
|
326
343
|
if (typeof error === 'string') {
|
|
327
344
|
return {
|
|
328
345
|
[ATTR_EXCEPTION_MESSAGE]: error,
|
|
@@ -330,7 +347,14 @@ class Logger {
|
|
|
330
347
|
}
|
|
331
348
|
|
|
332
349
|
if (isError(error)) {
|
|
333
|
-
|
|
350
|
+
// Guard against circular 'cause' chains, which would otherwise recurse
|
|
351
|
+
// until the stack overflows.
|
|
352
|
+
let cause: LogAttributes | undefined
|
|
353
|
+
|
|
354
|
+
if (!seen.has(error)) {
|
|
355
|
+
seen.add(error)
|
|
356
|
+
cause = this.parseError(error.cause, seen)
|
|
357
|
+
}
|
|
334
358
|
|
|
335
359
|
return {
|
|
336
360
|
[ATTR_EXCEPTION_TYPE]: error.name,
|
package/src/theme/global.css.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
generateDeterministicId,
|
|
3
2
|
VirtualActiveSelector,
|
|
4
3
|
VirtualDisabledSelector,
|
|
5
4
|
VirtualFocusSelector,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
style,
|
|
11
10
|
type StyleRule,
|
|
12
11
|
} from '@vanilla-extract/css'
|
|
12
|
+
import { generateDeterministicId } from '../util/random/generateDeterministicId'
|
|
13
13
|
import { theme, themeClass } from './theme.css'
|
|
14
14
|
import { tokenClass } from './token.css'
|
|
15
15
|
|
|
@@ -67,30 +67,3 @@ export const SquircleStyle = style({
|
|
|
67
67
|
export const CircleStyle = style({
|
|
68
68
|
borderRadius: '100vmax',
|
|
69
69
|
})
|
|
70
|
-
|
|
71
|
-
declare module 'csstype' {
|
|
72
|
-
export interface StandardShorthandProperties<
|
|
73
|
-
TLength = (string & {}) | 0,
|
|
74
|
-
TTime = string & {},
|
|
75
|
-
> {
|
|
76
|
-
/**
|
|
77
|
-
* The corner-shape shorthand CSS property specifies the shape of a box's corners, within the area specified by its border-radius property value.
|
|
78
|
-
*
|
|
79
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/corner-shape
|
|
80
|
-
*/
|
|
81
|
-
cornerShape?: Property.CornerShape | undefined
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export namespace Property {
|
|
85
|
-
export type CornerShape =
|
|
86
|
-
| Globals
|
|
87
|
-
| 'round'
|
|
88
|
-
| 'scoop'
|
|
89
|
-
| 'bevel'
|
|
90
|
-
| 'notch'
|
|
91
|
-
| 'square'
|
|
92
|
-
| 'squircle'
|
|
93
|
-
| `superellipse(${number})`
|
|
94
|
-
| (string & {})
|
|
95
|
-
}
|
|
96
|
-
}
|
package/src/theme/index.ts
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useConst } from '#hook'
|
|
2
|
+
import { useRef, useSyncExternalStore } from 'react'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const [query] = useState(() =>
|
|
5
|
-
typeof window !== 'undefined'
|
|
6
|
-
? window.matchMedia('(prefers-color-scheme: dark)')
|
|
7
|
-
: null
|
|
8
|
-
)
|
|
4
|
+
const QUERY = '(prefers-color-scheme: dark)'
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
6
|
+
export function useSystemColorScheme() {
|
|
7
|
+
// Reuse one lazily created MediaQueryList per hook instance for both
|
|
8
|
+
// subscribing and snapshot reads; 'getSnapshot' runs on every render, so
|
|
9
|
+
// it must not allocate a fresh query each time.
|
|
10
|
+
const queryRef = useRef<MediaQueryList | null>(null)
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
12
|
+
const subscribe = useConst(() => (onStoreChange: () => void) => {
|
|
13
|
+
const query = (queryRef.current ??= window.matchMedia(QUERY))
|
|
20
14
|
|
|
21
|
-
query.addEventListener('change',
|
|
15
|
+
query.addEventListener('change', onStoreChange)
|
|
22
16
|
|
|
23
17
|
return () => {
|
|
24
|
-
query.removeEventListener('change',
|
|
18
|
+
query.removeEventListener('change', onStoreChange)
|
|
25
19
|
}
|
|
26
|
-
}
|
|
20
|
+
})
|
|
27
21
|
|
|
28
|
-
return
|
|
22
|
+
return useSyncExternalStore(
|
|
23
|
+
subscribe,
|
|
24
|
+
() => (queryRef.current ??= window.matchMedia(QUERY)).matches,
|
|
25
|
+
// Server rendering assumes the default 'light' preference so hydration
|
|
26
|
+
// matches; the client re-renders with the actual value after hydration.
|
|
27
|
+
() => false
|
|
28
|
+
)
|
|
29
|
+
? 'dark'
|
|
30
|
+
: 'light'
|
|
29
31
|
}
|
package/src/util/array/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateDeterministicId } from '../random'
|
|
1
|
+
import { generateDeterministicId } from '../random/generateDeterministicId'
|
|
2
2
|
|
|
3
3
|
export const VirtualFocus = generateDeterministicId('data-focus-visible-')
|
|
4
4
|
export const VirtualFocusSelector = `[${VirtualFocus}="true"]` as const
|
|
@@ -7,13 +7,26 @@ export function readAsDataURL(blob: Blob, signal?: AbortSignal | undefined) {
|
|
|
7
7
|
return new Promise<string>((resolve, reject) => {
|
|
8
8
|
const reader = new FileReader()
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const onAbort = () => reader.abort()
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const cleanup = () => signal?.removeEventListener('abort', onAbort)
|
|
13
13
|
|
|
14
|
-
reader.
|
|
14
|
+
reader.onabort = () => {
|
|
15
|
+
cleanup()
|
|
16
|
+
reject(AbortError())
|
|
17
|
+
}
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
reader.onerror = () => {
|
|
20
|
+
cleanup()
|
|
21
|
+
reject(reader.error)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
reader.onload = () => {
|
|
25
|
+
cleanup()
|
|
26
|
+
resolve(reader.result as string)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
signal?.addEventListener('abort', onAbort, { once: true })
|
|
17
30
|
|
|
18
31
|
reader.readAsDataURL(blob)
|
|
19
32
|
|
package/src/util/number/index.ts
CHANGED
package/src/util/random/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// 'generateDeterministicId' is deliberately not exported from this barrel:
|
|
2
|
+
// it imports '@vanilla-extract/css', which has side effects, so re-exporting
|
|
3
|
+
// it would pull them into every '#util' consumer. Import it by direct
|
|
4
|
+
// relative path instead.
|
|
2
5
|
export * from './generateDigest'
|
|
3
6
|
export * from './generateUniqueId'
|
|
4
7
|
export * from './toHex'
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { detachChild } from './detachChild'
|
|
2
|
+
import type { TreeNode } from './node'
|
|
2
3
|
|
|
3
4
|
export function attachChild<T extends TreeNode<unknown>>(parent: T, child: T) {
|
|
5
|
+
// Detach a child that is still attached to a tree first so re-attaching
|
|
6
|
+
// cannot leave stale or self-referential links behind.
|
|
7
|
+
if (child.parent != null) {
|
|
8
|
+
detachChild(child.parent, child)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Reset the child's sibling links so a node previously attached elsewhere
|
|
12
|
+
// cannot keep stale links into its former tree.
|
|
13
|
+
child.previousSibling = parent.lastChild ?? null
|
|
14
|
+
child.nextSibling = null
|
|
15
|
+
|
|
4
16
|
if (parent.firstChild == null) {
|
|
5
17
|
parent.firstChild = child
|
|
6
18
|
}
|
|
7
19
|
|
|
8
20
|
if (parent.lastChild) {
|
|
9
21
|
parent.lastChild.nextSibling = child
|
|
10
|
-
child.previousSibling = parent.lastChild
|
|
11
22
|
}
|
|
12
23
|
|
|
13
24
|
parent.lastChild = child
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TreeNode } from '
|
|
1
|
+
import type { TreeNode } from './node'
|
|
2
2
|
|
|
3
3
|
export function detachChild<T extends TreeNode<unknown>>(parent: T, child: T) {
|
|
4
4
|
if (parent.firstChild === child) {
|
|
@@ -17,5 +17,11 @@ export function detachChild<T extends TreeNode<unknown>>(parent: T, child: T) {
|
|
|
17
17
|
child.nextSibling.previousSibling = child.previousSibling ?? null
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// Detach the child's own links so it cannot reach back into the tree it
|
|
21
|
+
// was removed from.
|
|
22
|
+
child.parent = null
|
|
23
|
+
child.previousSibling = null
|
|
24
|
+
child.nextSibling = null
|
|
25
|
+
|
|
20
26
|
return parent
|
|
21
27
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"article.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fromAsync.js","sources":["../../../src/util/array/fromAsync.ts"],"sourcesContent":["export async function fromAsync<T>(\n iterator: AsyncIteratorObject<T> | IteratorObject<T>\n) {\n const array: T[] = []\n\n for await (const item of iterator) {\n array.push(item)\n }\n\n return array\n}\n"],"names":[],"mappings":";AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,IAAa,CAAA,CAAC;AAEpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,CAAA,CAAA,CAAA,KAAQ,QAAA,CAAA,CAAU;AACjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,EAAK,IAAI,CAAA;AAAA,CAAA,CACjB;AAEA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA;AACT;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.css.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|