elements-kit 0.12.0 → 0.14.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/dist/{benchmark.CX_oY03V-CsUg-gW0.mjs → benchmark.CX_oY03V-CSLAXL5f.mjs} +1 -32
- package/dist/{element-Y3uP_2p9.mjs → element-D6xVuWdX.mjs} +116 -2
- package/dist/for.mjs +2 -2
- package/dist/integrations/react.mjs +2 -2
- package/dist/jsx-runtime/index.d.mts +1 -1
- package/dist/jsx-runtime/index.mjs +1 -1
- package/dist/{lib-Cg8fI7K5.mjs → lib-Dkc7cV5F.mjs} +31 -0
- package/dist/render.mjs +1 -1
- package/dist/{scope-De6rSJvq.mjs → scope-CnEvL9Nd.mjs} +1 -1
- package/dist/signals/index.mjs +1 -1
- package/dist/{test.BmQO5GaM-ZC2MPXQb.mjs → test.BmQO5GaM-Ddz9cDxc.mjs} +100 -1
- package/dist/ui/accordion/accordion.css +180 -0
- package/dist/ui/toggle/toggle.css +116 -0
- package/dist/utilities/_observe.mjs +1 -1
- package/dist/utilities/active-element.mjs +1 -1
- package/dist/utilities/active-element.test.mjs +2 -2
- package/dist/utilities/async.mjs +1 -1
- package/dist/utilities/async.test.mjs +3 -3
- package/dist/utilities/context.mjs +1 -1
- package/dist/utilities/context.test.mjs +3 -3
- package/dist/utilities/debounced.mjs +1 -1
- package/dist/utilities/debounced.test.mjs +3 -3
- package/dist/utilities/dom-lifecycle.bench.mjs +1 -1
- package/dist/utilities/dom-lifecycle.mjs +1 -1
- package/dist/utilities/dom-lifecycle.test.mjs +2 -2
- package/dist/utilities/element-rect.mjs +1 -1
- package/dist/utilities/element-rect.test.mjs +3 -3
- package/dist/utilities/element-scroll.test.mjs +3 -3
- package/dist/utilities/event-driven.mjs +1 -1
- package/dist/utilities/event-listener.mjs +1 -1
- package/dist/utilities/event-listener.test.mjs +3 -3
- package/dist/utilities/focus-within.mjs +1 -1
- package/dist/utilities/focus-within.test.mjs +3 -3
- package/dist/utilities/hover.mjs +1 -1
- package/dist/utilities/hover.test.mjs +3 -3
- package/dist/utilities/intersection-observer.test.mjs +3 -3
- package/dist/utilities/interval.mjs +1 -1
- package/dist/utilities/interval.test.mjs +3 -3
- package/dist/utilities/location.mjs +1 -1
- package/dist/utilities/location.test.mjs +2 -2
- package/dist/utilities/long-press.test.mjs +3 -3
- package/dist/utilities/media-devices.mjs +1 -1
- package/dist/utilities/media-devices.test.mjs +3 -3
- package/dist/utilities/media-player.test.mjs +3 -3
- package/dist/utilities/media-query.mjs +1 -1
- package/dist/utilities/mutation-observer.test.mjs +3 -3
- package/dist/utilities/network.mjs +1 -1
- package/dist/utilities/network.test.mjs +2 -2
- package/dist/utilities/on-click-outside.test.mjs +3 -3
- package/dist/utilities/orientation.mjs +1 -1
- package/dist/utilities/previous.mjs +1 -1
- package/dist/utilities/previous.test.mjs +3 -3
- package/dist/utilities/promise.mjs +1 -1
- package/dist/utilities/promise.test.mjs +3 -3
- package/dist/utilities/retry.mjs +1 -1
- package/dist/utilities/retry.test.mjs +3 -3
- package/dist/utilities/routing.mjs +1 -1
- package/dist/utilities/routing.test.mjs +2 -2
- package/dist/utilities/search-params.test.mjs +3 -3
- package/dist/utilities/ssr.test.mjs +2 -2
- package/dist/utilities/storage.test.mjs +3 -3
- package/dist/utilities/throttled.mjs +1 -1
- package/dist/utilities/throttled.test.mjs +3 -3
- package/dist/utilities/timeout.mjs +1 -1
- package/dist/utilities/timeout.test.mjs +3 -3
- package/dist/utilities/window-focus.mjs +1 -1
- package/dist/utilities/window-size.mjs +1 -1
- package/dist/utilities/window-size.test.mjs +2 -2
- package/package.json +2 -2
|
@@ -4099,14 +4099,6 @@ function afterEach(fn, timeout) {
|
|
|
4099
4099
|
};
|
|
4100
4100
|
return getCurrentSuite().on("afterEach", withTimeout(wrapper, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4101
4101
|
}
|
|
4102
|
-
createTestHook("onTestFailed", (test, handler, timeout) => {
|
|
4103
|
-
test.onFailed ||= [];
|
|
4104
|
-
test.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4105
|
-
});
|
|
4106
|
-
createTestHook("onTestFinished", (test, handler, timeout) => {
|
|
4107
|
-
test.onFinished ||= [];
|
|
4108
|
-
test.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
|
|
4109
|
-
});
|
|
4110
4102
|
/**
|
|
4111
4103
|
* Registers a callback function that wraps around all tests within the current suite.
|
|
4112
4104
|
* The callback receives a `runSuite` function that must be called to run the suite's tests.
|
|
@@ -4206,14 +4198,6 @@ function withSuiteFixtures(suiteHook, fn, context, stackTraceError, contextIndex
|
|
|
4206
4198
|
})();
|
|
4207
4199
|
};
|
|
4208
4200
|
}
|
|
4209
|
-
function createTestHook(name, handler) {
|
|
4210
|
-
return (fn, timeout) => {
|
|
4211
|
-
assertTypes(fn, `"${name}" callback`, ["function"]);
|
|
4212
|
-
const current = getCurrentTest();
|
|
4213
|
-
if (!current) throw new Error(`Hook ${name}() can only be called inside a test`);
|
|
4214
|
-
return handler(current, fn, timeout);
|
|
4215
|
-
};
|
|
4216
|
-
}
|
|
4217
4201
|
function findTestFileStackTrace(testFilePath, error) {
|
|
4218
4202
|
const lines = error.split("\n").slice(1);
|
|
4219
4203
|
for (const line of lines) {
|
|
@@ -4942,7 +4926,7 @@ function makeTimeoutError(isHook, timeout, stackTraceError) {
|
|
|
4942
4926
|
}
|
|
4943
4927
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
4944
4928
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
4945
|
-
|
|
4929
|
+
Date.now;
|
|
4946
4930
|
const { clearTimeout, setTimeout: setTimeout$1 } = getSafeTimers();
|
|
4947
4931
|
const packs = /* @__PURE__ */ new Map();
|
|
4948
4932
|
const eventsPacks = [];
|
|
@@ -4969,21 +4953,6 @@ async function finishSendTasksUpdate(runner) {
|
|
|
4969
4953
|
sendTasksUpdate(runner);
|
|
4970
4954
|
await Promise.all(pendingTasksUpdates);
|
|
4971
4955
|
}
|
|
4972
|
-
function throttle(fn, ms) {
|
|
4973
|
-
let last = 0;
|
|
4974
|
-
let pendingCall;
|
|
4975
|
-
return function call(...args) {
|
|
4976
|
-
const now = unixNow();
|
|
4977
|
-
if (now - last > ms) {
|
|
4978
|
-
last = now;
|
|
4979
|
-
clearTimeout(pendingCall);
|
|
4980
|
-
pendingCall = void 0;
|
|
4981
|
-
return fn.apply(this, args);
|
|
4982
|
-
}
|
|
4983
|
-
pendingCall ??= setTimeout$1(() => call.bind(this)(...args), ms);
|
|
4984
|
-
};
|
|
4985
|
-
}
|
|
4986
|
-
throttle(sendTasksUpdate, 100);
|
|
4987
4956
|
/**
|
|
4988
4957
|
* @experimental
|
|
4989
4958
|
* @advanced
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as effectScope, g as untracked, p as onCleanup, s as effect } from "./lib-
|
|
1
|
+
import { c as effectScope, g as untracked, p as onCleanup, s as effect } from "./lib-Dkc7cV5F.mjs";
|
|
2
2
|
import "./polyfill-CdZVCxdo.mjs";
|
|
3
3
|
import { isReactive, resolveProps } from "./signals/index.mjs";
|
|
4
4
|
import { on } from "./utilities/event-listener.mjs";
|
|
@@ -96,6 +96,116 @@ function svgNamespace(ns) {
|
|
|
96
96
|
if (ns === "xlink") return "http://www.w3.org/1999/xlink";
|
|
97
97
|
if (ns === "xml") return "http://www.w3.org/XML/1998/namespace";
|
|
98
98
|
}
|
|
99
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
100
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
101
|
+
/**
|
|
102
|
+
* Tag names that must be created in the SVG namespace. `document.createElement`
|
|
103
|
+
* (no namespace) produces an HTMLUnknownElement for these and the browser
|
|
104
|
+
* won't paint the visual; createElementNS is required. Ambiguous tags that
|
|
105
|
+
* exist in both HTML and SVG (`a`, `script`, `style`, `title`) are deliberately
|
|
106
|
+
* left out and default to HTML — consumers using the SVG variants are rare and
|
|
107
|
+
* can build them imperatively.
|
|
108
|
+
*/
|
|
109
|
+
const SvgElements = new Set([
|
|
110
|
+
"svg",
|
|
111
|
+
"g",
|
|
112
|
+
"path",
|
|
113
|
+
"circle",
|
|
114
|
+
"rect",
|
|
115
|
+
"line",
|
|
116
|
+
"polyline",
|
|
117
|
+
"polygon",
|
|
118
|
+
"ellipse",
|
|
119
|
+
"defs",
|
|
120
|
+
"use",
|
|
121
|
+
"symbol",
|
|
122
|
+
"text",
|
|
123
|
+
"tspan",
|
|
124
|
+
"textPath",
|
|
125
|
+
"mask",
|
|
126
|
+
"clipPath",
|
|
127
|
+
"linearGradient",
|
|
128
|
+
"radialGradient",
|
|
129
|
+
"stop",
|
|
130
|
+
"pattern",
|
|
131
|
+
"marker",
|
|
132
|
+
"image",
|
|
133
|
+
"foreignObject",
|
|
134
|
+
"switch",
|
|
135
|
+
"desc",
|
|
136
|
+
"metadata",
|
|
137
|
+
"view",
|
|
138
|
+
"filter",
|
|
139
|
+
"feBlend",
|
|
140
|
+
"feColorMatrix",
|
|
141
|
+
"feComponentTransfer",
|
|
142
|
+
"feComposite",
|
|
143
|
+
"feConvolveMatrix",
|
|
144
|
+
"feDiffuseLighting",
|
|
145
|
+
"feDisplacementMap",
|
|
146
|
+
"feDistantLight",
|
|
147
|
+
"feDropShadow",
|
|
148
|
+
"feFlood",
|
|
149
|
+
"feFuncA",
|
|
150
|
+
"feFuncB",
|
|
151
|
+
"feFuncG",
|
|
152
|
+
"feFuncR",
|
|
153
|
+
"feGaussianBlur",
|
|
154
|
+
"feImage",
|
|
155
|
+
"feMerge",
|
|
156
|
+
"feMergeNode",
|
|
157
|
+
"feMorphology",
|
|
158
|
+
"feOffset",
|
|
159
|
+
"fePointLight",
|
|
160
|
+
"feSpecularLighting",
|
|
161
|
+
"feSpotLight",
|
|
162
|
+
"feTile",
|
|
163
|
+
"feTurbulence",
|
|
164
|
+
"animate",
|
|
165
|
+
"animateMotion",
|
|
166
|
+
"animateTransform",
|
|
167
|
+
"set",
|
|
168
|
+
"mpath"
|
|
169
|
+
]);
|
|
170
|
+
/**
|
|
171
|
+
* Tag names that must be created in the MathML namespace. Same problem as
|
|
172
|
+
* `SvgElements` — `document.createElement("math")` is an HTMLUnknownElement,
|
|
173
|
+
* formulae render only when created via `createElementNS(MATHML_NAMESPACE, …)`.
|
|
174
|
+
*/
|
|
175
|
+
const MathMLElements = new Set([
|
|
176
|
+
"math",
|
|
177
|
+
"annotation",
|
|
178
|
+
"annotation-xml",
|
|
179
|
+
"maction",
|
|
180
|
+
"menclose",
|
|
181
|
+
"merror",
|
|
182
|
+
"mfenced",
|
|
183
|
+
"mfrac",
|
|
184
|
+
"mi",
|
|
185
|
+
"mmultiscripts",
|
|
186
|
+
"mn",
|
|
187
|
+
"mo",
|
|
188
|
+
"mover",
|
|
189
|
+
"mpadded",
|
|
190
|
+
"mphantom",
|
|
191
|
+
"mprescripts",
|
|
192
|
+
"mroot",
|
|
193
|
+
"mrow",
|
|
194
|
+
"ms",
|
|
195
|
+
"mspace",
|
|
196
|
+
"msqrt",
|
|
197
|
+
"mstyle",
|
|
198
|
+
"msub",
|
|
199
|
+
"msubsup",
|
|
200
|
+
"msup",
|
|
201
|
+
"mtable",
|
|
202
|
+
"mtd",
|
|
203
|
+
"mtext",
|
|
204
|
+
"mtr",
|
|
205
|
+
"munder",
|
|
206
|
+
"munderover",
|
|
207
|
+
"semantics"
|
|
208
|
+
]);
|
|
99
209
|
const ReservedNameSpaces = new Set([
|
|
100
210
|
"class",
|
|
101
211
|
"on",
|
|
@@ -412,7 +522,11 @@ function createNodeElement(type, props, ref) {
|
|
|
412
522
|
return result;
|
|
413
523
|
}
|
|
414
524
|
function resolveNode(type) {
|
|
415
|
-
if (typeof type === "string")
|
|
525
|
+
if (typeof type === "string") {
|
|
526
|
+
if (SvgElements.has(type)) return document.createElementNS(SVG_NAMESPACE, type);
|
|
527
|
+
if (MathMLElements.has(type)) return document.createElementNS(MATHML_NAMESPACE, type);
|
|
528
|
+
return document.createElement(type);
|
|
529
|
+
}
|
|
416
530
|
if (type instanceof Element || type instanceof DocumentFragment) return type;
|
|
417
531
|
return new type();
|
|
418
532
|
}
|
package/dist/for.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as effectScope, g as untracked, h as trigger, m as signal, p as onCleanup, s as effect } from "./lib-
|
|
1
|
+
import { c as effectScope, g as untracked, h as trigger, m as signal, p as onCleanup, s as effect } from "./lib-Dkc7cV5F.mjs";
|
|
2
2
|
import "./signals/index.mjs";
|
|
3
|
-
import { n as disposeElement } from "./element-
|
|
3
|
+
import { n as disposeElement } from "./element-D6xVuWdX.mjs";
|
|
4
4
|
//#region src/for.ts
|
|
5
5
|
/**
|
|
6
6
|
* Keyed list renderer. See {@link ForProps} for prop details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as signal, s as effect } from "../lib-
|
|
1
|
+
import { m as signal, s as effect } from "../lib-Dkc7cV5F.mjs";
|
|
2
2
|
import "../signals/index.mjs";
|
|
3
|
-
import { t as scope } from "../scope-
|
|
3
|
+
import { t as scope } from "../scope-CnEvL9Nd.mjs";
|
|
4
4
|
import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
5
5
|
//#region src/integrations/react.ts
|
|
6
6
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { U as createElement, _ as SlotProps, a as RawProps, b as MaybeReactive, c as ResolveProps, d as ComponentClass, f as ComponentFn, g as JSX, h as Attrs, i as Props, l as Child, m as PropsTarget, n as ElementProps, o as ReactiveProps, p as ComponentInstance, r as MaybeReactiveProps, s as Require, t as ComponentProps, u as Component, v as Fragment } from "../infer-DGtBn6Nm.mjs";
|
|
2
|
-
export { Attrs, Child, Component, ComponentClass, ComponentFn, ComponentInstance, ComponentProps, ElementProps, Fragment, JSX, MaybeReactive, MaybeReactiveProps, Props, PropsTarget, RawProps, ReactiveProps, Require, ResolveProps, SlotProps, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
|
|
2
|
+
export { Attrs, type Child, type Component, type ComponentClass, type ComponentFn, type ComponentInstance, type ComponentProps, type ElementProps, Fragment, JSX, type MaybeReactive, type MaybeReactiveProps, type Props, type PropsTarget, type RawProps, type ReactiveProps, type Require, type ResolveProps, SlotProps, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
|
|
@@ -295,12 +295,27 @@ const COMPUTED = Symbol("computed");
|
|
|
295
295
|
const EFFECT = Symbol("effect");
|
|
296
296
|
const EFFECT_SCOPE = Symbol("effectScope");
|
|
297
297
|
const { link, unlink, propagate, checkDirty, shallowPropagate } = createReactiveSystem({
|
|
298
|
+
/**
|
|
299
|
+
* Called by the graph engine when a Mutable+Dirty node needs to recompute.
|
|
300
|
+
* Dispatches by tagged property:
|
|
301
|
+
*
|
|
302
|
+
* - `'getter' in node` → computed: delegate to `updateComputed`.
|
|
303
|
+
* - `'currentValue' in node` → signal: delegate to `updateSignal`.
|
|
304
|
+
* - else → effectScope: mark `Mutable` and report
|
|
305
|
+
* "changed", so any parent effect re-evaluates as if the scope itself
|
|
306
|
+
* propagated.
|
|
307
|
+
*/
|
|
298
308
|
update(node) {
|
|
299
309
|
if ("getter" in node) return updateComputed(node);
|
|
300
310
|
if ("currentValue" in node) return updateSignal(node);
|
|
301
311
|
node.flags = 1;
|
|
302
312
|
return true;
|
|
303
313
|
},
|
|
314
|
+
/**
|
|
315
|
+
* Called when an effect node is notified that one of its deps is dirty.
|
|
316
|
+
* Inserts the effect into the flush queue in dependency order (parents
|
|
317
|
+
* before children) so that effects always run in topological order.
|
|
318
|
+
*/
|
|
304
319
|
notify(effect) {
|
|
305
320
|
let insertIndex = queuedLength;
|
|
306
321
|
let firstInsertedIndex = insertIndex;
|
|
@@ -317,6 +332,22 @@ const { link, unlink, propagate, checkDirty, shallowPropagate } = createReactive
|
|
|
317
332
|
queued[insertIndex] = left;
|
|
318
333
|
}
|
|
319
334
|
},
|
|
335
|
+
/**
|
|
336
|
+
* Called when a dep node loses its last subscriber.
|
|
337
|
+
*
|
|
338
|
+
* Dispatch by tagged property:
|
|
339
|
+
*
|
|
340
|
+
* - **computed** (`'getter' in node`): if it had deps, reset to Dirty so
|
|
341
|
+
* it recomputes lazily if a new subscriber appears later. Cleanups
|
|
342
|
+
* registered via {@link onCleanup} during the previous run are flushed
|
|
343
|
+
* (outside any tracking context). Child effects/scopes created in the
|
|
344
|
+
* getter are released in LIFO order via {@link disposeAllDepsInReverse}.
|
|
345
|
+
* - **signal** (`'currentValue' in node`): no-op. Signals stay live so a
|
|
346
|
+
* future subscriber can read the latest value.
|
|
347
|
+
* - **effect** (`'fn' in node`): cascade-dispose via `effectOper`
|
|
348
|
+
* (children first, then own cleanup).
|
|
349
|
+
* - **effectScope** (else): cascade-dispose via `effectScopeOper`.
|
|
350
|
+
*/
|
|
320
351
|
unwatched(node) {
|
|
321
352
|
if ("getter" in node) {
|
|
322
353
|
const c = node;
|
package/dist/render.mjs
CHANGED
package/dist/signals/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as batch, c as effectScope, d as isEffectScope, f as isSignal, g as untracked, h as trigger, i as SIGNAL, l as isComputed, m as signal, n as EFFECT, o as computed, p as onCleanup, r as EFFECT_SCOPE, s as effect, t as COMPUTED, u as isEffect } from "../lib-
|
|
1
|
+
import { a as batch, c as effectScope, d as isEffectScope, f as isSignal, g as untracked, h as trigger, i as SIGNAL, l as isComputed, m as signal, n as EFFECT, o as computed, p as onCleanup, r as EFFECT_SCOPE, s as effect, t as COMPUTED, u as isEffect } from "../lib-Dkc7cV5F.mjs";
|
|
2
2
|
import "../polyfill-CdZVCxdo.mjs";
|
|
3
3
|
//#region src/signals/index.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as plugins, C as getCallLastIndex, D as ordinal, E as noop, O as stringify, S as createSimpleStackTrace, T as isObject, _ as getSafeTimers, a as waitForImportsToResolve, b as printDiffOrStringify, d as getNames, g as delay, h as parseSingleStack, i as resetModules, j as y, k as format, m as parseErrorStacktrace, n as getWorkerState, r as isChildProcess, u as getCurrentTest, v as processError, w as getType, x as assertTypes, y as diff } from "./benchmark.CX_oY03V-
|
|
1
|
+
import { A as plugins, C as getCallLastIndex, D as ordinal, E as noop, O as stringify, S as createSimpleStackTrace, T as isObject, _ as getSafeTimers, a as waitForImportsToResolve, b as printDiffOrStringify, d as getNames, g as delay, h as parseSingleStack, i as resetModules, j as y, k as format, m as parseErrorStacktrace, n as getWorkerState, r as isChildProcess, u as getCurrentTest, v as processError, w as getType, x as assertTypes, y as diff } from "./benchmark.CX_oY03V-CSLAXL5f.mjs";
|
|
2
2
|
//#region node_modules/.pnpm/@vitest+spy@4.1.3/node_modules/@vitest/spy/dist/index.js
|
|
3
3
|
function isMockFunction(fn) {
|
|
4
4
|
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
|
|
@@ -997,16 +997,115 @@ function inspect(value, opts = {}) {
|
|
|
997
997
|
}
|
|
998
998
|
__name(inspect, "inspect");
|
|
999
999
|
var config = {
|
|
1000
|
+
/**
|
|
1001
|
+
* ### config.includeStack
|
|
1002
|
+
*
|
|
1003
|
+
* User configurable property, influences whether stack trace
|
|
1004
|
+
* is included in Assertion error message. Default of false
|
|
1005
|
+
* suppresses stack trace in the error message.
|
|
1006
|
+
*
|
|
1007
|
+
* chai.config.includeStack = true; // enable stack on error
|
|
1008
|
+
*
|
|
1009
|
+
* @param {boolean}
|
|
1010
|
+
* @public
|
|
1011
|
+
*/
|
|
1000
1012
|
includeStack: false,
|
|
1013
|
+
/**
|
|
1014
|
+
* ### config.showDiff
|
|
1015
|
+
*
|
|
1016
|
+
* User configurable property, influences whether or not
|
|
1017
|
+
* the `showDiff` flag should be included in the thrown
|
|
1018
|
+
* AssertionErrors. `false` will always be `false`; `true`
|
|
1019
|
+
* will be true when the assertion has requested a diff
|
|
1020
|
+
* be shown.
|
|
1021
|
+
*
|
|
1022
|
+
* @param {boolean}
|
|
1023
|
+
* @public
|
|
1024
|
+
*/
|
|
1001
1025
|
showDiff: true,
|
|
1026
|
+
/**
|
|
1027
|
+
* ### config.truncateThreshold
|
|
1028
|
+
*
|
|
1029
|
+
* User configurable property, sets length threshold for actual and
|
|
1030
|
+
* expected values in assertion errors. If this threshold is exceeded, for
|
|
1031
|
+
* example for large data structures, the value is replaced with something
|
|
1032
|
+
* like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
|
|
1033
|
+
*
|
|
1034
|
+
* Set it to zero if you want to disable truncating altogether.
|
|
1035
|
+
*
|
|
1036
|
+
* This is especially userful when doing assertions on arrays: having this
|
|
1037
|
+
* set to a reasonable large value makes the failure messages readily
|
|
1038
|
+
* inspectable.
|
|
1039
|
+
*
|
|
1040
|
+
* chai.config.truncateThreshold = 0; // disable truncating
|
|
1041
|
+
*
|
|
1042
|
+
* @param {number}
|
|
1043
|
+
* @public
|
|
1044
|
+
*/
|
|
1002
1045
|
truncateThreshold: 40,
|
|
1046
|
+
/**
|
|
1047
|
+
* ### config.useProxy
|
|
1048
|
+
*
|
|
1049
|
+
* User configurable property, defines if chai will use a Proxy to throw
|
|
1050
|
+
* an error when a non-existent property is read, which protects users
|
|
1051
|
+
* from typos when using property-based assertions.
|
|
1052
|
+
*
|
|
1053
|
+
* Set it to false if you want to disable this feature.
|
|
1054
|
+
*
|
|
1055
|
+
* chai.config.useProxy = false; // disable use of Proxy
|
|
1056
|
+
*
|
|
1057
|
+
* This feature is automatically disabled regardless of this config value
|
|
1058
|
+
* in environments that don't support proxies.
|
|
1059
|
+
*
|
|
1060
|
+
* @param {boolean}
|
|
1061
|
+
* @public
|
|
1062
|
+
*/
|
|
1003
1063
|
useProxy: true,
|
|
1064
|
+
/**
|
|
1065
|
+
* ### config.proxyExcludedKeys
|
|
1066
|
+
*
|
|
1067
|
+
* User configurable property, defines which properties should be ignored
|
|
1068
|
+
* instead of throwing an error if they do not exist on the assertion.
|
|
1069
|
+
* This is only applied if the environment Chai is running in supports proxies and
|
|
1070
|
+
* if the `useProxy` configuration setting is enabled.
|
|
1071
|
+
* By default, `then` and `inspect` will not throw an error if they do not exist on the
|
|
1072
|
+
* assertion object because the `.inspect` property is read by `util.inspect` (for example, when
|
|
1073
|
+
* using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
|
|
1074
|
+
*
|
|
1075
|
+
* // By default these keys will not throw an error if they do not exist on the assertion object
|
|
1076
|
+
* chai.config.proxyExcludedKeys = ['then', 'inspect'];
|
|
1077
|
+
*
|
|
1078
|
+
* @param {Array}
|
|
1079
|
+
* @public
|
|
1080
|
+
*/
|
|
1004
1081
|
proxyExcludedKeys: [
|
|
1005
1082
|
"then",
|
|
1006
1083
|
"catch",
|
|
1007
1084
|
"inspect",
|
|
1008
1085
|
"toJSON"
|
|
1009
1086
|
],
|
|
1087
|
+
/**
|
|
1088
|
+
* ### config.deepEqual
|
|
1089
|
+
*
|
|
1090
|
+
* User configurable property, defines which a custom function to use for deepEqual
|
|
1091
|
+
* comparisons.
|
|
1092
|
+
* By default, the function used is the one from the `deep-eql` package without custom comparator.
|
|
1093
|
+
*
|
|
1094
|
+
* // use a custom comparator
|
|
1095
|
+
* chai.config.deepEqual = (expected, actual) => {
|
|
1096
|
+
* return chai.util.eql(expected, actual, {
|
|
1097
|
+
* comparator: (expected, actual) => {
|
|
1098
|
+
* // for non number comparison, use the default behavior
|
|
1099
|
+
* if(typeof expected !== 'number') return null;
|
|
1100
|
+
* // allow a difference of 10 between compared numbers
|
|
1101
|
+
* return typeof actual === 'number' && Math.abs(actual - expected) < 10
|
|
1102
|
+
* }
|
|
1103
|
+
* })
|
|
1104
|
+
* };
|
|
1105
|
+
*
|
|
1106
|
+
* @param {Function}
|
|
1107
|
+
* @public
|
|
1108
|
+
*/
|
|
1010
1109
|
deepEqual: null
|
|
1011
1110
|
};
|
|
1012
1111
|
function inspect2(obj, showHidden, depth, colors) {
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
.x-accordion::details-content {
|
|
2
|
+
content-visibility: hidden;
|
|
3
|
+
padding-inline: var(--accordion-summary-padding-inline);
|
|
4
|
+
transition: content-visibility var(--accordion-duration) ease allow-discrete,
|
|
5
|
+
grid-template-rows var(--accordion-duration) ease,
|
|
6
|
+
padding-block-start var(--accordion-duration) ease,
|
|
7
|
+
padding-block-end var(--accordion-duration) ease;
|
|
8
|
+
grid-template-rows: 0fr;
|
|
9
|
+
padding-block: 0;
|
|
10
|
+
display: grid;
|
|
11
|
+
overflow: clip;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.x-accordion[open]::details-content {
|
|
15
|
+
content-visibility: visible;
|
|
16
|
+
grid-template-rows: 1fr;
|
|
17
|
+
padding-block-start: var(--accordion-summary-padding-block);
|
|
18
|
+
padding-block-end: var(--accordion-summary-padding-block);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.x-accordion > :not(summary) {
|
|
22
|
+
min-block-size: 0;
|
|
23
|
+
overflow: clip;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (prefers-reduced-motion: reduce) {
|
|
27
|
+
.x-accordion::details-content {
|
|
28
|
+
transition: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.x-accordion > summary {
|
|
33
|
+
cursor: var(--cursor-button);
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: var(--space-2);
|
|
36
|
+
padding: var(--accordion-summary-padding-block)
|
|
37
|
+
var(--accordion-summary-padding-inline);
|
|
38
|
+
font-size: var(--accordion-font-size);
|
|
39
|
+
color: var(--color-11);
|
|
40
|
+
-webkit-user-select: none;
|
|
41
|
+
user-select: none;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
line-height: 1.4;
|
|
44
|
+
list-style: none;
|
|
45
|
+
transition: background-color .12s ease-out;
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.x-accordion > summary::-webkit-details-marker {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.x-accordion > summary:where(:focus-visible) {
|
|
54
|
+
outline: 2px solid var(--focus-8);
|
|
55
|
+
outline-offset: -2px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.x-accordion:where([data-size="1"]) {
|
|
59
|
+
--accordion-summary-padding-block: var(--space-2);
|
|
60
|
+
--accordion-summary-padding-inline: var(--space-3);
|
|
61
|
+
--accordion-font-size: var(--font-size-2);
|
|
62
|
+
--accordion-duration: .18s;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.x-accordion:where([data-size="2"]) {
|
|
66
|
+
--accordion-summary-padding-block: var(--space-3);
|
|
67
|
+
--accordion-summary-padding-inline: var(--space-4);
|
|
68
|
+
--accordion-font-size: var(--font-size-3);
|
|
69
|
+
--accordion-duration: .2s;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.x-accordion:where([data-size="3"]) {
|
|
73
|
+
--accordion-summary-padding-block: var(--space-4);
|
|
74
|
+
--accordion-summary-padding-inline: var(--space-5);
|
|
75
|
+
--accordion-font-size: var(--font-size-4);
|
|
76
|
+
--accordion-duration: .22s;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.x-accordion:where(:not([data-size])) {
|
|
80
|
+
--accordion-summary-padding-block: var(--space-3);
|
|
81
|
+
--accordion-summary-padding-inline: var(--space-4);
|
|
82
|
+
--accordion-font-size: var(--font-size-3);
|
|
83
|
+
--accordion-duration: .2s;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"], [data-variant="soft"]) {
|
|
87
|
+
border-radius: var(--radius-4);
|
|
88
|
+
--accordion-summary-bg: transparent;
|
|
89
|
+
--accordion-summary-hover-bg: var(--base-color-a2);
|
|
90
|
+
--accordion-body-bg: var(--base-color-a2);
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:where(.dark, .dark-theme) .x-accordion:where(:not([data-variant]), [data-variant="surface"], [data-variant="soft"]) {
|
|
95
|
+
--accordion-summary-bg: var(--base-color-a2);
|
|
96
|
+
--accordion-summary-hover-bg: var(--base-color-a3);
|
|
97
|
+
--accordion-body-bg: transparent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"], [data-variant="soft"]) > summary {
|
|
101
|
+
background-color: var(--accordion-summary-bg);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"], [data-variant="soft"])::details-content {
|
|
105
|
+
background-color: var(--accordion-body-bg);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (hover: hover) {
|
|
109
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"], [data-variant="soft"]) > summary:where(:hover) {
|
|
110
|
+
background-color: var(--accordion-summary-hover-bg);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"]) {
|
|
115
|
+
background-color: var(--color-material, var(--color-surface));
|
|
116
|
+
border: 1px solid var(--base-color-a5);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.x-accordion:where([data-variant="soft"]) {
|
|
120
|
+
background-color: var(--color-a2);
|
|
121
|
+
--accordion-summary-bg: var(--color-a2);
|
|
122
|
+
--accordion-summary-hover-bg: var(--color-a3);
|
|
123
|
+
--accordion-body-bg: transparent;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:where(.dark, .dark-theme) .x-accordion:where([data-variant="soft"]) {
|
|
127
|
+
background-color: var(--color-a2);
|
|
128
|
+
--accordion-summary-bg: var(--color-a2);
|
|
129
|
+
--accordion-summary-hover-bg: var(--color-a3);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"]) + .x-accordion:where(:not([data-variant]), [data-variant="surface"]) {
|
|
133
|
+
border-start-start-radius: 0;
|
|
134
|
+
border-start-end-radius: 0;
|
|
135
|
+
margin-block-start: -1px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.x-accordion:where(:not([data-variant]), [data-variant="surface"]):has( + .x-accordion:where(:not([data-variant]), [data-variant="surface"])) {
|
|
139
|
+
border-end-end-radius: 0;
|
|
140
|
+
border-end-start-radius: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.x-accordion:where([data-variant="soft"]) + .x-accordion:where([data-variant="soft"]) {
|
|
144
|
+
border-start-start-radius: 0;
|
|
145
|
+
border-start-end-radius: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.x-accordion:where([data-variant="soft"]):has( + .x-accordion:where([data-variant="soft"])) {
|
|
149
|
+
border-end-end-radius: 0;
|
|
150
|
+
border-end-start-radius: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.x-accordion:where([data-variant="borderless"]) > summary {
|
|
154
|
+
color: var(--color-a11);
|
|
155
|
+
padding-inline: 0;
|
|
156
|
+
transition: background-color .12s ease-out, color .12s ease-out;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (hover: hover) {
|
|
160
|
+
.x-accordion:where([data-variant="borderless"]) > summary:where(:hover) {
|
|
161
|
+
color: var(--color-12);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.x-accordion:where([data-variant="borderless"][open]) > summary {
|
|
166
|
+
color: var(--color-12);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.x-accordion:where([data-variant="borderless"])::details-content {
|
|
170
|
+
padding-inline: 0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.x-accordion:where([aria-disabled="true"]) {
|
|
174
|
+
opacity: .6;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.x-accordion:where([aria-disabled="true"]) > summary {
|
|
178
|
+
pointer-events: none;
|
|
179
|
+
cursor: var(--cursor-disabled);
|
|
180
|
+
}
|