@vielzeug/refine 1.7.0 → 1.8.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/async.cjs +11 -11
- package/dist/async.cjs.map +1 -1
- package/dist/async.js +1 -2
- package/dist/async.js.map +1 -1
- package/dist/calendar.cjs +26 -26
- package/dist/calendar.cjs.map +1 -1
- package/dist/calendar.js +4 -5
- package/dist/calendar.js.map +1 -1
- package/dist/checkbox-group.cjs +9 -9
- package/dist/checkbox-group.cjs.map +1 -1
- package/dist/checkbox-group.js +1 -2
- package/dist/checkbox-group.js.map +1 -1
- package/dist/code-window.cjs +4 -4
- package/dist/code-window.cjs.map +1 -1
- package/dist/code-window.js +1 -2
- package/dist/code-window.js.map +1 -1
- package/dist/command-palette.cjs +6 -6
- package/dist/command-palette.cjs.map +1 -1
- package/dist/command-palette.js +46 -47
- package/dist/command-palette.js.map +1 -1
- package/dist/content/code-window/code-window.d.ts.map +1 -1
- package/dist/content/icon/icon.d.ts.map +1 -1
- package/dist/custom-elements.json +3716 -3716
- package/dist/datagrid.cjs +2 -2
- package/dist/datagrid.js +206 -206
- package/dist/datagrid.js.map +1 -1
- package/dist/disclosure/tab-panel/tab-panel.d.ts.map +1 -1
- package/dist/feedback/async/async.d.ts.map +1 -1
- package/dist/feedback/progress/progress.d.ts.map +1 -1
- package/dist/file-input.cjs +49 -49
- package/dist/file-input.cjs.map +1 -1
- package/dist/file-input.js +1 -2
- package/dist/file-input.js.map +1 -1
- package/dist/icon.cjs +1 -1
- package/dist/icon.cjs.map +1 -1
- package/dist/icon.js +1 -2
- package/dist/icon.js.map +1 -1
- package/dist/input.cjs +2 -2
- package/dist/input.js +6 -6
- package/dist/inputs/calendar/calendar.d.ts.map +1 -1
- package/dist/message-composer.cjs +2 -2
- package/dist/message-composer.js +6 -6
- package/dist/progress.cjs +13 -13
- package/dist/progress.cjs.map +1 -1
- package/dist/progress.js +3 -4
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.cjs +11 -11
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.js +1 -2
- package/dist/radio-group.js.map +1 -1
- package/dist/refine.cjs +197 -197
- package/dist/refine.cjs.map +1 -1
- package/dist/refine.iife.js +258 -258
- package/dist/refine.iife.js.map +1 -1
- package/dist/refine.js +225 -225
- package/dist/refine.js.map +1 -1
- package/dist/tab-panel.cjs +7 -7
- package/dist/tab-panel.cjs.map +1 -1
- package/dist/tab-panel.js +3 -4
- package/dist/tab-panel.js.map +1 -1
- package/dist/testing/index.d.ts +15 -60
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +7 -24
- package/dist/testing.js.map +1 -1
- package/dist/textarea.cjs +2 -2
- package/dist/textarea.js +6 -6
- package/package.json +6 -5
- package/dist/keymap/dist/_dev.cjs +0 -2
- package/dist/keymap/dist/_dev.cjs.map +0 -1
- package/dist/keymap/dist/_dev.js +0 -4
- package/dist/keymap/dist/_dev.js.map +0 -1
- package/dist/keymap/dist/format.cjs +0 -1
- package/dist/keymap/dist/format.js +0 -1
- package/dist/keymap/dist/index.cjs +0 -1
- package/dist/keymap/dist/index.js +0 -4
- package/dist/keymap/dist/keymap.cjs +0 -2
- package/dist/keymap/dist/keymap.cjs.map +0 -1
- package/dist/keymap/dist/keymap.js +0 -221
- package/dist/keymap/dist/keymap.js.map +0 -1
- package/dist/keymap/dist/layer.cjs +0 -1
- package/dist/keymap/dist/layer.js +0 -1
package/dist/tab-panel.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./headless/aria-reflection.cjs"),n=require("./tabs.cjs"),r=require("./disclosure/tab-panel/tab-panel.css.cjs");let i=require("@vielzeug/ore"),a=require("@vielzeug/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./headless/aria-reflection.cjs"),n=require("./tabs.cjs"),r=require("./disclosure/tab-panel/tab-panel.css.cjs");let i=require("@vielzeug/ore"),a=require("@vielzeug/ripple");var o={"2xl":`var(--size-12)`,lg:`var(--size-6)`,md:`var(--size-4)`,none:`0`,sm:`var(--size-2)`,xl:`var(--size-8)`,xs:`var(--size-1)`},s=`ore-tab-panel`;(0,i.define)(s,{props:{active:i.prop.bool(!1),lazy:i.prop.bool(!1),padding:i.prop.oneOf([`none`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`],`md`),value:i.prop.string(``)},setup(e){let r=(0,i.getHost)(),s=i.watchEffect,c=(0,i.inject)(n.TABS_CTX),l=(0,a.computed)(()=>c?!!c.value.value&&c.value.value===e.value.value:e.active.value);(0,i.bind)({attr:{active:()=>l.value?!0:void 0}});let u=(0,a.computed)(()=>o[e.padding.value??`md`]??o.md),d=(0,a.signal)(!1);s(()=>{l.value&&(d.value=!0)});let f=(0,a.computed)(()=>!e.lazy.value||d.value),p=(0,i.styleMap)({"--tab-panel-padding":u}),m=()=>`tabpanel-${e.value.value}`,h=(0,i.ref)();return(0,i.onMounted)(()=>{s(()=>{let n=h.value,i=e.value.value;if(!n)return;let a=((i?r.closest(`ore-tabs`):null)?.querySelector(`:scope > ore-tab-item[value="${i}"]`))?.shadowRoot?.querySelector(`[role="tab"]`)??null;t.setAriaReflection(n,`ariaLabelledByElements`,a?[a]:[])})}),i.html`
|
|
2
2
|
<div
|
|
3
3
|
class="panel"
|
|
4
4
|
part="panel"
|
|
5
5
|
role="tabpanel"
|
|
6
|
-
ref="${
|
|
7
|
-
:id="${
|
|
8
|
-
aria-hidden="${()=>String(!
|
|
9
|
-
:style="${
|
|
6
|
+
ref="${h}"
|
|
7
|
+
:id="${m}"
|
|
8
|
+
aria-hidden="${()=>String(!l.value)}"
|
|
9
|
+
:style="${p}"
|
|
10
10
|
tabindex="0">
|
|
11
|
-
${(0,
|
|
11
|
+
${(0,i.when)(f,()=>i.html`<slot></slot>`)}
|
|
12
12
|
</div>
|
|
13
|
-
`},styles:[e.reducedMotionMixin,r.default]}),exports.TAB_PANEL_TAG=
|
|
13
|
+
`},styles:[e.reducedMotionMixin,r.default]}),exports.TAB_PANEL_TAG=s;
|
|
14
14
|
//# sourceMappingURL=tab-panel.cjs.map
|
package/dist/tab-panel.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.cjs","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, ref, bind, getHost, onMounted, watchEffect
|
|
1
|
+
{"version":3,"file":"tab-panel.cjs","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, ref, bind, getHost, onMounted, watchEffect, styleMap, when } from '@vielzeug/ore';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { setAriaReflection } from '../../headless';\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const panelRef = ref<HTMLElement>();\n\n // `aria-labelledby` as a plain IDREF attribute cannot resolve across shadow-tree boundaries\n // (the matching `id` lives inside <ore-tab-item>'s own shadow root) — see\n // `setAriaReflection()`'s doc comment. Deferred to `onMounted()`: sibling custom elements\n // (including the peer `<ore-tab-item>`) connect in tree order within the same synchronous\n // insertion, so a sibling's shadow content may not exist yet during this element's own\n // `setup()` — `onMounted()`'s microtask runs after the whole subtree has connected.\n onMounted(() => {\n watch(() => {\n const panel = panelRef.value;\n const value = props.value.value;\n\n if (!panel) return;\n\n const tabsEl = value ? el.closest('ore-tabs') : null;\n const tabEl = tabsEl?.querySelector<HTMLElement>(`:scope > ore-tab-item[value=\"${value}\"]`);\n const button = tabEl?.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? null;\n\n setAriaReflection(panel, 'ariaLabelledByElements', button ? [button] : []);\n });\n });\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n ref=\"${panelRef}\"\n :id=\"${panelId}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n :style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(shouldRender, () => html`<slot></slot>`)}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":"mTAQA,IAAM,EAAmD,CACvD,MAAO,iBACP,GAAI,gBACJ,GAAI,gBACJ,KAAM,IACN,GAAI,gBACJ,GAAI,gBACJ,GAAI,eACN,EAkCa,EAAgB,6BACJ,EAAe,CACtC,MAAO,CACL,OAAQ,EAAA,KAAK,KAAK,EAAK,EACvB,KAAM,EAAA,KAAK,KAAK,EAAK,EACrB,QAAS,EAAA,KAAK,MAAM,CAAC,OAAQ,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,EAAY,IAAI,EAChF,MAAO,EAAA,KAAK,OAAO,EAAE,CACvB,EACA,MAAM,EAAO,CACX,IAAM,GAAA,EAAA,EAAA,QAAA,CAAa,EACb,EAAQ,EAAA,YAER,GAAA,EAAA,EAAA,OAAA,CAAiB,EAAA,QAAQ,EACzB,GAAA,EAAA,EAAA,SAAA,KACJ,EAAU,CAAC,CAAC,EAAQ,MAAM,OAAS,EAAQ,MAAM,QAAU,EAAM,MAAM,MAAQ,EAAM,OAAO,KAC9F,GAEA,EAAA,EAAA,KAAA,CAAK,CACH,KAAM,CACJ,WAAe,EAAS,MAAQ,GAAO,IAAA,EACzC,CACF,CAAC,EAGD,IAAM,GAAA,EAAA,EAAA,SAAA,KAGG,EAFK,EAAM,QAAQ,OAAS,OAEK,EAAyB,EAClE,EAEK,GAAA,EAAA,EAAA,OAAA,CAAuB,EAAK,EAElC,MAAY,CACN,EAAS,QAAO,EAAc,MAAQ,GAC5C,CAAC,EAGD,IAAM,GAAA,EAAA,EAAA,SAAA,KAA8B,CAAC,EAAM,KAAK,OAAS,EAAc,KAAK,EACtE,GAAA,EAAA,EAAA,SAAA,CAAsB,CAAE,sBAAuB,CAAa,CAAC,EAC7D,MAAgB,YAAY,EAAM,MAAM,QACxC,GAAA,EAAA,EAAA,IAAA,CAA4B,EAuBlC,OAfA,EAAA,EAAA,UAAA,KAAgB,CACd,MAAY,CACV,IAAM,EAAQ,EAAS,MACjB,EAAQ,EAAM,MAAM,MAE1B,GAAI,CAAC,EAAO,OAIZ,IAAM,IAFS,EAAQ,EAAG,QAAQ,UAAU,EAAI,KAAA,EAC1B,cAA2B,gCAAgC,EAAM,GAAG,EAAA,EACpE,YAAY,cAA2B,cAAc,GAAK,KAEhF,EAAA,kBAAkB,EAAO,yBAA0B,EAAS,CAAC,CAAM,EAAI,CAAC,CAAC,CAC3E,CAAC,CACH,CAAC,EAEM,EAAA,IAAI;;;;;eAKA,EAAS;eACT,EAAQ;2BACM,OAAO,CAAC,EAAS,KAAK,EAAE;kBACnC,EAAW;;qBAEd,MAAoB,EAAA,IAAI,eAAe,EAAE;;KAGtD,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAM,CACrC,CAAC"}
|
package/dist/tab-panel.js
CHANGED
|
@@ -2,8 +2,7 @@ import { reducedMotionMixin as e } from "./styles/mixins/accessibility.css.js";
|
|
|
2
2
|
import { setAriaReflection as t } from "./headless/aria-reflection.js";
|
|
3
3
|
import { TABS_CTX as n } from "./tabs.js";
|
|
4
4
|
import r from "./disclosure/tab-panel/tab-panel.css.js";
|
|
5
|
-
import { bind as i, define as a, getHost as o, html as s, inject as c, onMounted as l, prop as u, ref as d,
|
|
6
|
-
import { styleMap as p, when as m } from "@vielzeug/ore/directives";
|
|
5
|
+
import { bind as i, define as a, getHost as o, html as s, inject as c, onMounted as l, prop as u, ref as d, styleMap as f, watchEffect as p, when as m } from "@vielzeug/ore";
|
|
7
6
|
import { computed as h, signal as g } from "@vielzeug/ripple";
|
|
8
7
|
//#region src/disclosure/tab-panel/tab-panel.ts
|
|
9
8
|
var _ = {
|
|
@@ -31,13 +30,13 @@ a(v, {
|
|
|
31
30
|
value: u.string("")
|
|
32
31
|
},
|
|
33
32
|
setup(e) {
|
|
34
|
-
let r = o(), a =
|
|
33
|
+
let r = o(), a = p, u = c(n), v = h(() => u ? !!u.value.value && u.value.value === e.value.value : e.active.value);
|
|
35
34
|
i({ attr: { active: () => v.value ? !0 : void 0 } });
|
|
36
35
|
let y = h(() => _[e.padding.value ?? "md"] ?? _.md), b = g(!1);
|
|
37
36
|
a(() => {
|
|
38
37
|
v.value && (b.value = !0);
|
|
39
38
|
});
|
|
40
|
-
let x = h(() => !e.lazy.value || b.value), S =
|
|
39
|
+
let x = h(() => !e.lazy.value || b.value), S = f({ "--tab-panel-padding": y }), C = () => `tabpanel-${e.value.value}`, w = d();
|
|
41
40
|
return l(() => {
|
|
42
41
|
a(() => {
|
|
43
42
|
let n = w.value, i = e.value.value;
|
package/dist/tab-panel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.js","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, ref, bind, getHost, onMounted, watchEffect
|
|
1
|
+
{"version":3,"file":"tab-panel.js","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, ref, bind, getHost, onMounted, watchEffect, styleMap, when } from '@vielzeug/ore';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { setAriaReflection } from '../../headless';\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const el = getHost();\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const panelRef = ref<HTMLElement>();\n\n // `aria-labelledby` as a plain IDREF attribute cannot resolve across shadow-tree boundaries\n // (the matching `id` lives inside <ore-tab-item>'s own shadow root) — see\n // `setAriaReflection()`'s doc comment. Deferred to `onMounted()`: sibling custom elements\n // (including the peer `<ore-tab-item>`) connect in tree order within the same synchronous\n // insertion, so a sibling's shadow content may not exist yet during this element's own\n // `setup()` — `onMounted()`'s microtask runs after the whole subtree has connected.\n onMounted(() => {\n watch(() => {\n const panel = panelRef.value;\n const value = props.value.value;\n\n if (!panel) return;\n\n const tabsEl = value ? el.closest('ore-tabs') : null;\n const tabEl = tabsEl?.querySelector<HTMLElement>(`:scope > ore-tab-item[value=\"${value}\"]`);\n const button = tabEl?.shadowRoot?.querySelector<HTMLElement>('[role=\"tab\"]') ?? null;\n\n setAriaReflection(panel, 'ariaLabelledByElements', button ? [button] : []);\n });\n });\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n ref=\"${panelRef}\"\n :id=\"${panelId}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n :style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(shouldRender, () => html`<slot></slot>`)}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":";;;;;;;AAQA,IAAM,IAAmD;CACvD,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAkCa,IAAgB;AAC7B,EAAyB,GAAe;CACtC,OAAO;EACL,QAAQ,EAAK,KAAK,EAAK;EACvB,MAAM,EAAK,KAAK,EAAK;EACrB,SAAS,EAAK,MAAM;GAAC;GAAQ;GAAM;GAAM;GAAM;GAAM;GAAM;EAAK,GAAY,IAAI;EAChF,OAAO,EAAK,OAAO,EAAE;CACvB;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAQ,GAER,IAAU,EAAO,CAAQ,GACzB,IAAW,QACf,IAAU,CAAC,CAAC,EAAQ,MAAM,SAAS,EAAQ,MAAM,UAAU,EAAM,MAAM,QAAQ,EAAM,OAAO,KAC9F;EAEA,EAAK,EACH,MAAM,EACJ,cAAe,EAAS,QAAQ,KAAO,KAAA,EACzC,EACF,CAAC;EAGD,IAAM,IAAe,QAGZ,EAFK,EAAM,QAAQ,SAAS,SAEK,EAAyB,EAClE,GAEK,IAAgB,EAAO,EAAK;EAElC,QAAY;GACV,AAAI,EAAS,UAAO,EAAc,QAAQ;EAC5C,CAAC;EAGD,IAAM,IAAe,QAAe,CAAC,EAAM,KAAK,SAAS,EAAc,KAAK,GACtE,IAAa,EAAS,EAAE,uBAAuB,EAAa,CAAC,GAC7D,UAAgB,YAAY,EAAM,MAAM,SACxC,IAAW,EAAiB;EAuBlC,OAfA,QAAgB;GACd,QAAY;IACV,IAAM,IAAQ,EAAS,OACjB,IAAQ,EAAM,MAAM;IAE1B,IAAI,CAAC,GAAO;IAIZ,IAAM,MAFS,IAAQ,EAAG,QAAQ,UAAU,IAAI,KAAA,EAC1B,cAA2B,gCAAgC,EAAM,GAAG,EAAA,EACpE,YAAY,cAA2B,gBAAc,KAAK;IAEhF,EAAkB,GAAO,0BAA0B,IAAS,CAAC,CAAM,IAAI,CAAC,CAAC;GAC3E,CAAC;EACH,CAAC,GAEM,CAAI;;;;;eAKA,EAAS;eACT,EAAQ;6BACM,OAAO,CAAC,EAAS,KAAK,EAAE;kBACnC,EAAW;;UAEnB,EAAK,SAAoB,CAAI,eAAe,EAAE;;;CAGtD;CACA,QAAQ,CAAC,GAAoB,CAAM;AACrC,CAAC"}
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -41,49 +41,13 @@ export declare const getAriaControls: (el: Element) => null | string;
|
|
|
41
41
|
/** Returns the `role` attribute value, or null. */
|
|
42
42
|
export declare const getRole: (el: Element) => null | string;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.
|
|
45
|
+
* `dispatchPointer(el, type, init)` from earlier versions of this module is now
|
|
46
|
+
* `fire.pointer<Type>(el, init)` (e.g. `fire.pointerEnter`/`fire.pointerLeave`), imported from
|
|
47
|
+
* `@vielzeug/ore/testing` alongside `mount()` — pass `{ composed: true }` explicitly if you need
|
|
48
|
+
* the event to cross shadow boundaries.
|
|
46
49
|
*/
|
|
47
|
-
export
|
|
48
|
-
/**
|
|
49
|
-
* Queries all matching elements inside the shadow root of a custom element.
|
|
50
|
-
* Returns an empty array if the element has no shadow root.
|
|
51
|
-
*/
|
|
52
|
-
export declare const queryAllInShadow: <T extends Element = Element>(host: Element, selector: string) => T[];
|
|
53
|
-
/**
|
|
54
|
-
* Queries a shadow DOM element by its CSS `part` attribute.
|
|
55
|
-
* Shorthand for `queryInShadow(host, '[part="name"]')`.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* const btn = queryPart(carousel, 'prev-btn');
|
|
60
|
-
* expect(btn).not.toBeNull();
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare const queryPart: <T extends Element = Element>(host: Element, part: string) => null | T;
|
|
64
|
-
/**
|
|
65
|
-
* Returns an array of light-DOM children assigned to a named slot,
|
|
66
|
-
* or all slotted children if no name is given.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* const slides = getSlotted(carousel);
|
|
71
|
-
* expect(slides).toHaveLength(3);
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare const getSlotted: (host: Element, slotName?: string) => Element[];
|
|
75
|
-
/**
|
|
76
|
-
* Dispatches a `PointerEvent` on the given element.
|
|
77
|
-
* Useful for testing hover, drag, and pointer interactions without
|
|
78
|
-
* relying on the fire helper from @vielzeug/ore/testing.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* dispatchPointer(el, 'enter');
|
|
83
|
-
* dispatchPointer(el, 'leave');
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare const dispatchPointer: (el: Element, type: "cancel" | "down" | "enter" | "leave" | "move" | "up", init?: PointerEventInit) => void;
|
|
50
|
+
export { queryInShadow, queryAllInShadow, queryPart, getSlotted } from '@vielzeug/assay';
|
|
87
51
|
/**
|
|
88
52
|
* Returns the current form value of a form-associated custom element.
|
|
89
53
|
* Uses the ElementInternals-exposed `value` if available, then falls back
|
|
@@ -100,32 +64,23 @@ export declare const isFormValid: (el: HTMLElement & {
|
|
|
100
64
|
validity?: ValidityState;
|
|
101
65
|
}) => boolean;
|
|
102
66
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Returns a Promise that resolves after a microtask tick (one `queueMicrotask`).
|
|
109
|
-
* Use when you need to wait for reactivity (signal effects) to settle without
|
|
110
|
-
* moving into the macrotask queue.
|
|
111
|
-
*/
|
|
112
|
-
export declare const nextTick: () => Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Returns a Promise that resolves after `ms` milliseconds.
|
|
115
|
-
* Use sparingly — prefer `nextTick()` for reactive updates.
|
|
67
|
+
* Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.
|
|
68
|
+
* `keyEvent(key, init)` from earlier versions of this module (construct-only, no dispatch, and
|
|
69
|
+
* unused anywhere in this package's own tests) has been removed — use `fire.keyDown`/
|
|
70
|
+
* `fire.keyboard` from `@vielzeug/ore/testing`, which construct and dispatch in one call.
|
|
116
71
|
*/
|
|
117
|
-
export
|
|
72
|
+
export { nextTick, wait } from '@vielzeug/assay';
|
|
118
73
|
/**
|
|
119
|
-
* Resets the headless ID counter to 0. Use in test `beforeEach` hooks when you need
|
|
74
|
+
* Resets the headless stable-ID counter to 0. Use in test `beforeEach` hooks when you need
|
|
120
75
|
* deterministic IDs across test runs.
|
|
121
76
|
*
|
|
122
77
|
* @example
|
|
123
78
|
* ```ts
|
|
124
|
-
* import {
|
|
125
|
-
* beforeEach(() =>
|
|
79
|
+
* import { resetStableIdCounter } from '@vielzeug/refine/testing';
|
|
80
|
+
* beforeEach(() => resetStableIdCounter());
|
|
126
81
|
* ```
|
|
127
82
|
*/
|
|
128
|
-
export {
|
|
83
|
+
export { resetStableIdCounter } from '@vielzeug/ore';
|
|
129
84
|
/**
|
|
130
85
|
* Returns a snapshot of the most commonly tested ARIA attributes on an element.
|
|
131
86
|
* Useful for concise inline snapshot assertions in component tests.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,mEAAmE;AACnE,eAAO,MAAM,aAAa,GAAI,IAAI,OAAO,KAAG,OAAqD,CAAC;AAElG,oEAAoE;AACpE,eAAO,MAAM,cAAc,GAAI,IAAI,OAAO,KAAG,OAAsD,CAAC;AAEpG,mEAAmE;A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,MAAM,mBAAmB,GAAI,QAAQ,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACH,CAAC;AAE7G,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACH,CAAC;AAEvG,8CAA8C;AAC9C,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACL,CAAC;AAEjG,8CAA8C;AAC9C,eAAO,MAAM,cAAc,GAAI,QAAQ,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,YAAY,KAAG,OAAO,CAAC,OAAO,CACL,CAAC"}
|
package/dist/testing.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ore"),t=require("@vielzeug/ore/testing");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ore"),t=require("@vielzeug/assay"),n=require("@vielzeug/ore/testing");var r=e=>e.getAttribute(`aria-invalid`)===`true`,i=e=>e.getAttribute(`aria-disabled`)===`true`,a=e=>e.getAttribute(`aria-checked`)===`true`,o=e=>e.getAttribute(`aria-checked`)===`mixed`,s=e=>e.getAttribute(`aria-expanded`)===`true`,c=e=>e.getAttribute(`aria-pressed`)===`true`,l=e=>e.getAttribute(`aria-required`)===`true`,u=e=>e.getAttribute(`aria-hidden`)===`true`,d=e=>e.getAttribute(`aria-label`),f=e=>e.getAttribute(`aria-labelledby`),p=e=>e.getAttribute(`aria-describedby`),m=e=>e.getAttribute(`aria-controls`),h=e=>e.getAttribute(`role`),g=e=>e.value??null,_=e=>e.validity?.valid??!0,v=e=>({ariaLabel:e.getAttribute(`aria-label`),checked:e.getAttribute(`aria-checked`),disabled:e.getAttribute(`aria-disabled`),expanded:e.getAttribute(`aria-expanded`),invalid:e.getAttribute(`aria-invalid`),labelledby:e.getAttribute(`aria-labelledby`),required:e.getAttribute(`aria-required`),role:e.getAttribute(`role`)}),y=e=>Object.entries(e).map(([e,t])=>t===``?e:`${e}="${t.replace(/"/g,`"`)}"`).join(` `),b=(e={})=>{let t={};for(let[n,r]of Object.entries(e))if(!(r===!1||r==null))if(r===!0)t[n]=``;else if(Array.isArray(r)){if(r.length>0&&typeof r[0]==`object`)continue;t[n]=r.join(`,`)}else t[n]=String(r);return t},x=(e,t)=>(0,n.mount)(`<ore-input ${y(b(e))}>${t?.innerHTML??``}</ore-input>`),S=(e,t)=>(0,n.mount)(`<ore-textarea ${y(b(e))}>${t?.innerHTML??``}</ore-textarea>`),C=(e,t)=>(0,n.mount)(`<ore-select ${y(b(e))}>${t?.innerHTML??``}</ore-select>`),w=(e,t)=>(0,n.mount)(`<ore-combobox ${y(b(e))}>${t?.innerHTML??``}</ore-combobox>`),T=(e,t)=>(0,n.mount)(`<ore-checkbox ${y(b(e))}>${t?.innerHTML??``}</ore-checkbox>`),E=(e,t)=>(0,n.mount)(`<ore-checkbox-group ${y(b(e))}>${t?.innerHTML??``}</ore-checkbox-group>`),D=(e,t)=>(0,n.mount)(`<ore-radio ${y(b(e))}>${t?.innerHTML??``}</ore-radio>`),O=(e,t)=>(0,n.mount)(`<ore-radio-group ${y(b(e))}>${t?.innerHTML??``}</ore-radio-group>`),k=(e,t)=>(0,n.mount)(`<ore-switch ${y(b(e))}>${t?.innerHTML??``}</ore-switch>`),A=(e,t)=>(0,n.mount)(`<ore-button ${y(b(e))}>${t?.innerHTML??``}</ore-button>`),j=(e,t)=>(0,n.mount)(`<ore-button-group ${y(b(e))}>${t?.innerHTML??``}</ore-button-group>`),M=(e,t)=>(0,n.mount)(`<ore-file-input ${y(b(e))}>${t?.innerHTML??``}</ore-file-input>`),N=(e,t)=>(0,n.mount)(`<ore-form ${y(b(e))}>${t?.innerHTML??``}</ore-form>`),P=(e,t)=>(0,n.mount)(`<ore-number-input ${y(b(e))}>${t?.innerHTML??``}</ore-number-input>`),F=(e,t)=>(0,n.mount)(`<ore-otp-input ${y(b(e))}>${t?.innerHTML??``}</ore-otp-input>`),I=(e,t)=>(0,n.mount)(`<ore-rating ${y(b(e))}>${t?.innerHTML??``}</ore-rating>`),L=(e,t)=>(0,n.mount)(`<ore-slider ${y(b(e))}>${t?.innerHTML??``}</ore-slider>`);exports.attrsToHtml=y,exports.getAriaControls=m,exports.getAriaDescribedBy=p,exports.getAriaLabel=d,exports.getAriaLabelledBy=f,exports.getAriaState=v,exports.getFormValue=g,exports.getRole=h,Object.defineProperty(exports,"getSlotted",{enumerable:!0,get:function(){return t.getSlotted}}),exports.isAriaChecked=a,exports.isAriaDisabled=i,exports.isAriaExpanded=s,exports.isAriaHidden=u,exports.isAriaIndeterminate=o,exports.isAriaInvalid=r,exports.isAriaPressed=c,exports.isAriaRequired=l,exports.isFormValid=_,exports.mountOreButton=A,exports.mountOreButtonGroup=j,exports.mountOreCheckbox=T,exports.mountOreCheckboxGroup=E,exports.mountOreCombobox=w,exports.mountOreFileInput=M,exports.mountOreForm=N,exports.mountOreInput=x,exports.mountOreNumberInput=P,exports.mountOreOtpInput=F,exports.mountOreRadio=D,exports.mountOreRadioGroup=O,exports.mountOreRating=I,exports.mountOreSelect=C,exports.mountOreSlider=L,exports.mountOreSwitch=k,exports.mountOreTextarea=S,Object.defineProperty(exports,"nextTick",{enumerable:!0,get:function(){return t.nextTick}}),exports.propsToAttrs=b,Object.defineProperty(exports,"queryAllInShadow",{enumerable:!0,get:function(){return t.queryAllInShadow}}),Object.defineProperty(exports,"queryInShadow",{enumerable:!0,get:function(){return t.queryInShadow}}),Object.defineProperty(exports,"queryPart",{enumerable:!0,get:function(){return t.queryPart}}),Object.defineProperty(exports,"resetStableIdCounter",{enumerable:!0,get:function(){return e.resetStableIdCounter}}),Object.defineProperty(exports,"wait",{enumerable:!0,get:function(){return t.wait}});
|
|
2
2
|
//# sourceMappingURL=testing.cjs.map
|
package/dist/testing.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.cjs","names":[],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * @vielzeug/refine/testing\n *\n * Testing utilities for refine components. Provides a11y helpers, ARIA query\n * utilities, and convenience wrappers for common patterns in component tests.\n *\n * @example\n * ```typescript\n * import { getAriaLabel, getAriaDescribedBy, isAriaInvalid } from '@vielzeug/refine/testing';\n * import { mount } from '@vielzeug/ore/testing';\n *\n * const fixture = mount('<ore-input label=\"Name\"></ore-input>');\n * const input = fixture.query('input')!;\n * expect(isAriaInvalid(input)).toBe(false);\n * ```\n */\n\n// ── ARIA attribute helpers ────────────────────────────────────────────────────\n\n/** Returns whether `aria-invalid=\"true\"` is set on the element. */\nexport const isAriaInvalid = (el: Element): boolean => el.getAttribute('aria-invalid') === 'true';\n\n/** Returns whether `aria-disabled=\"true\"` is set on the element. */\nexport const isAriaDisabled = (el: Element): boolean => el.getAttribute('aria-disabled') === 'true';\n\n/** Returns whether `aria-checked=\"true\"` is set on the element. */\nexport const isAriaChecked = (el: Element): boolean => el.getAttribute('aria-checked') === 'true';\n\n/** Returns whether `aria-checked=\"mixed\"` is set on the element. */\nexport const isAriaIndeterminate = (el: Element): boolean => el.getAttribute('aria-checked') === 'mixed';\n\n/** Returns whether `aria-expanded=\"true\"` is set on the element. */\nexport const isAriaExpanded = (el: Element): boolean => el.getAttribute('aria-expanded') === 'true';\n\n/** Returns whether `aria-pressed=\"true\"` is set on the element. */\nexport const isAriaPressed = (el: Element): boolean => el.getAttribute('aria-pressed') === 'true';\n\n/** Returns whether `aria-required=\"true\"` is set on the element. */\nexport const isAriaRequired = (el: Element): boolean => el.getAttribute('aria-required') === 'true';\n\n/** Returns whether `aria-hidden=\"true\"` is set on the element. */\nexport const isAriaHidden = (el: Element): boolean => el.getAttribute('aria-hidden') === 'true';\n\n/** Returns the `aria-label` string attribute, or null. */\nexport const getAriaLabel = (el: Element): null | string => el.getAttribute('aria-label');\n\n/** Returns the `aria-labelledby` attribute value (space-separated IDs), or null. */\nexport const getAriaLabelledBy = (el: Element): null | string => el.getAttribute('aria-labelledby');\n\n/** Returns the `aria-describedby` attribute value (space-separated IDs), or null. */\nexport const getAriaDescribedBy = (el: Element): null | string => el.getAttribute('aria-describedby');\n\n/** Returns the `aria-controls` attribute value, or null. */\nexport const getAriaControls = (el: Element): null | string => el.getAttribute('aria-controls');\n\n/** Returns the `role` attribute value, or null. */\nexport const getRole = (el: Element): null | string => el.getAttribute('role');\n\n// ── DOM query helpers ─────────────────────────────────────────────────────────\n\n/**\n * Queries the shadow root of a custom element for a matching CSS selector.\n * Returns null if the element has no shadow root or no match is found.\n */\nexport const queryInShadow = <T extends Element = Element>(host: Element, selector: string): null | T => {\n return host.shadowRoot?.querySelector<T>(selector) ?? null;\n};\n\n/**\n * Queries all matching elements inside the shadow root of a custom element.\n * Returns an empty array if the element has no shadow root.\n */\nexport const queryAllInShadow = <T extends Element = Element>(host: Element, selector: string): T[] => {\n return Array.from(host.shadowRoot?.querySelectorAll<T>(selector) ?? []);\n};\n\n/**\n * Queries a shadow DOM element by its CSS `part` attribute.\n * Shorthand for `queryInShadow(host, '[part=\"name\"]')`.\n *\n * @example\n * ```ts\n * const btn = queryPart(carousel, 'prev-btn');\n * expect(btn).not.toBeNull();\n * ```\n */\nexport const queryPart = <T extends Element = Element>(host: Element, part: string): null | T =>\n queryInShadow<T>(host, `[part=\"${part}\"]`);\n\n/**\n * Returns an array of light-DOM children assigned to a named slot,\n * or all slotted children if no name is given.\n *\n * @example\n * ```ts\n * const slides = getSlotted(carousel);\n * expect(slides).toHaveLength(3);\n * ```\n */\nexport const getSlotted = (host: Element, slotName?: string): Element[] => {\n const selector = slotName ? `[slot=\"${slotName}\"]` : ':not([slot])';\n\n return Array.from(host.querySelectorAll(`:scope > ${selector}`));\n};\n\n/**\n * Dispatches a `PointerEvent` on the given element.\n * Useful for testing hover, drag, and pointer interactions without\n * relying on the fire helper from @vielzeug/ore/testing.\n *\n * @example\n * ```ts\n * dispatchPointer(el, 'enter');\n * dispatchPointer(el, 'leave');\n * ```\n */\nexport const dispatchPointer = (\n el: Element,\n type: 'cancel' | 'down' | 'enter' | 'leave' | 'move' | 'up',\n init?: PointerEventInit,\n): void => {\n el.dispatchEvent(new PointerEvent(`pointer${type}`, { bubbles: true, composed: true, ...init }));\n};\n\n// ── Form-associated component helpers ─────────────────────────────────────────\n\n/**\n * Returns the current form value of a form-associated custom element.\n * Uses the ElementInternals-exposed `value` if available, then falls back\n * to the reflected DOM `value` property.\n */\nexport const getFormValue = (el: HTMLElement & { value?: string }): null | string => {\n return el.value ?? null;\n};\n\n/**\n * Returns whether a form-associated element is considered valid (no constraint\n * violations reported by the browser or via `setValidity`).\n */\nexport const isFormValid = (el: HTMLElement & { validity?: ValidityState }): boolean => {\n return el.validity?.valid ?? true;\n};\n\n// ── Event helpers ─────────────────────────────────────────────────────────────\n\n/**\n * Creates a synthetic `KeyboardEvent` with the given key.\n * Useful for testing keyboard navigation in headless controls.\n */\nexport const keyEvent = (key: string, init?: KeyboardEventInit): KeyboardEvent => {\n return new KeyboardEvent('keydown', { bubbles: true, cancelable: true, key, ...init });\n};\n\n/**\n * Returns a Promise that resolves after a microtask tick (one `queueMicrotask`).\n * Use when you need to wait for reactivity (signal effects) to settle without\n * moving into the macrotask queue.\n */\nexport const nextTick = (): Promise<void> =>\n new Promise((resolve) => {\n queueMicrotask(resolve);\n });\n\n/**\n * Returns a Promise that resolves after `ms` milliseconds.\n * Use sparingly — prefer `nextTick()` for reactive updates.\n */\nexport const wait = (ms = 0): Promise<void> =>\n new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n\n// ── ID counter ────────────────────────────────────────────────────────────────\n\n/**\n * Resets the headless ID counter to 0. Use in test `beforeEach` hooks when you need\n * deterministic IDs across test runs.\n *\n * @example\n * ```ts\n * import { resetIdCounter } from '@vielzeug/refine/testing';\n * beforeEach(() => resetIdCounter());\n * ```\n */\nexport { resetIdCounter } from '@vielzeug/ore';\n\n// ── ARIA snapshot helper ───────────────────────────────────────────────────────\n\n/**\n * Returns a snapshot of the most commonly tested ARIA attributes on an element.\n * Useful for concise inline snapshot assertions in component tests.\n *\n * `ariaLabel` and `labelledby` are kept separate because `aria-label` is a\n * direct string while `aria-labelledby` is an ID reference — conflating them\n * masks bugs where the wrong labelling mechanism is used.\n *\n * @example\n * ```ts\n * expect(getAriaState(input)).toMatchObject({ invalid: 'true', required: 'true' });\n * ```\n */\nexport const getAriaState = (\n el: Element,\n): {\n ariaLabel: null | string;\n checked: null | string;\n disabled: null | string;\n expanded: null | string;\n invalid: null | string;\n labelledby: null | string;\n required: null | string;\n role: null | string;\n} => ({\n ariaLabel: el.getAttribute('aria-label'),\n checked: el.getAttribute('aria-checked'),\n disabled: el.getAttribute('aria-disabled'),\n expanded: el.getAttribute('aria-expanded'),\n invalid: el.getAttribute('aria-invalid'),\n labelledby: el.getAttribute('aria-labelledby'),\n required: el.getAttribute('aria-required'),\n role: el.getAttribute('role'),\n});\n\n// ── Typed component mount wrappers (F3) ───────────────────────────────────────\n\nimport type { Fixture } from '@vielzeug/ore/testing';\n\nimport { mount } from '@vielzeug/ore/testing';\n\nimport type { OreButtonGroupProps } from '../inputs/button-group/button-group';\nimport type { OreButtonProps } from '../inputs/button/button';\nimport type { OreCheckboxGroupProps } from '../inputs/checkbox-group/checkbox-group';\nimport type { OreCheckboxProps } from '../inputs/checkbox/checkbox';\nimport type { OreComboboxProps } from '../inputs/combobox/combobox.types';\nimport type { OreFileInputProps } from '../inputs/file-input/file-input';\nimport type { OreFormProps } from '../inputs/form/form';\nimport type { OreInputProps } from '../inputs/input/input';\nimport type { OreNumberInputProps } from '../inputs/number-input/number-input';\nimport type { OreOtpInputProps } from '../inputs/otp-input/otp-input';\nimport type { OreRadioGroupProps } from '../inputs/radio-group/radio-group';\nimport type { OreRadioProps } from '../inputs/radio/radio';\nimport type { OreRatingProps } from '../inputs/rating/rating';\nimport type { OreSelectProps } from '../inputs/select/select';\nimport type { OreSliderProps } from '../inputs/slider/slider';\nimport type { OreSwitchProps } from '../inputs/switch/switch';\nimport type { OreTextareaProps } from '../inputs/textarea/textarea';\n\n/**\n * Serializes an attribute map to an HTML attribute string fragment.\n * Values are HTML-escaped to prevent attribute injection.\n *\n * @example\n * ```ts\n * attrsToHtml({ disabled: '', label: 'Name' }); // → 'disabled label=\"Name\"'\n * ```\n */\nexport const attrsToHtml = (attrs: Record<string, string>): string =>\n Object.entries(attrs)\n .map(([key, value]) => (value === '' ? key : `${key}=\"${value.replace(/\"/g, '"')}\"`))\n .join(' ');\n\n/**\n * Converts a props object into an HTML attribute record.\n * - `true` → empty boolean attribute (e.g., `disabled`)\n * - `false` / `null` / `undefined` → attribute omitted\n * - Array of objects → **omitted** (cannot be serialized as an HTML attribute;\n * use `opts.innerHTML` with slotted elements instead)\n * - Array of primitives → comma-joined string\n * - everything else → stringified\n *\n * @example\n * ```ts\n * propsToAttrs({ disabled: true, label: 'Name', value: undefined });\n * // → { disabled: '', label: 'Name' }\n * ```\n */\nexport const propsToAttrs = (props: Record<string, unknown> = {}): Record<string, string> => {\n const attrs: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (value === false || value == null) continue;\n\n if (value === true) {\n attrs[key] = '';\n } else if (Array.isArray(value)) {\n // Object arrays cannot be represented as HTML attributes — skip silently.\n if (value.length > 0 && typeof value[0] === 'object') continue;\n\n attrs[key] = (value as string[]).join(',');\n } else {\n attrs[key] = String(value);\n }\n }\n\n return attrs;\n};\n\ntype MountOptions = { innerHTML?: string };\n\n/** Typed mount wrapper for `<ore-input>`. Catch prop name typos at compile time. */\nexport const mountOreInput = (props?: Partial<OreInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-input>`);\n\n/** Typed mount wrapper for `<ore-textarea>`. */\nexport const mountOreTextarea = (props?: Partial<OreTextareaProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-textarea ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-textarea>`);\n\n/** Typed mount wrapper for `<ore-select>`. */\nexport const mountOreSelect = (props?: Partial<OreSelectProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-select ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-select>`);\n\n/** Typed mount wrapper for `<ore-combobox>`. */\nexport const mountOreCombobox = (props?: Partial<OreComboboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-combobox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-combobox>`);\n\n/** Typed mount wrapper for `<ore-checkbox>`. */\nexport const mountOreCheckbox = (props?: Partial<OreCheckboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox>`);\n\n/** Typed mount wrapper for `<ore-checkbox-group>`. */\nexport const mountOreCheckboxGroup = (props?: Partial<OreCheckboxGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox-group>`);\n\n/** Typed mount wrapper for `<ore-radio>`. */\nexport const mountOreRadio = (props?: Partial<OreRadioProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio>`);\n\n/** Typed mount wrapper for `<ore-radio-group>`. */\nexport const mountOreRadioGroup = (props?: Partial<OreRadioGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio-group>`);\n\n/** Typed mount wrapper for `<ore-switch>`. */\nexport const mountOreSwitch = (props?: Partial<OreSwitchProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-switch ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-switch>`);\n\n/** Typed mount wrapper for `<ore-button>`. */\nexport const mountOreButton = (props?: Partial<OreButtonProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button>`);\n\n/** Typed mount wrapper for `<ore-button-group>`. */\nexport const mountOreButtonGroup = (props?: Partial<OreButtonGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button-group>`);\n\n/** Typed mount wrapper for `<ore-file-input>`. */\nexport const mountOreFileInput = (props?: Partial<OreFileInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-file-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-file-input>`);\n\n/** Typed mount wrapper for `<ore-form>`. */\nexport const mountOreForm = (props?: Partial<OreFormProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-form ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-form>`);\n\n/** Typed mount wrapper for `<ore-number-input>`. */\nexport const mountOreNumberInput = (props?: Partial<OreNumberInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-number-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-number-input>`);\n\n/** Typed mount wrapper for `<ore-otp-input>`. */\nexport const mountOreOtpInput = (props?: Partial<OreOtpInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-otp-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-otp-input>`);\n\n/** Typed mount wrapper for `<ore-rating>`. */\nexport const mountOreRating = (props?: Partial<OreRatingProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-rating ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-rating>`);\n\n/** Typed mount wrapper for `<ore-slider>`. */\nexport const mountOreSlider = (props?: Partial<OreSliderProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-slider ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-slider>`);\n"],"mappings":"qIAoBA,IAAa,EAAiB,GAAyB,EAAG,aAAa,cAAc,IAAM,OAG9E,EAAkB,GAAyB,EAAG,aAAa,eAAe,IAAM,OAGhF,EAAiB,GAAyB,EAAG,aAAa,cAAc,IAAM,OAG9E,EAAuB,GAAyB,EAAG,aAAa,cAAc,IAAM,QAGpF,EAAkB,GAAyB,EAAG,aAAa,eAAe,IAAM,OAGhF,EAAiB,GAAyB,EAAG,aAAa,cAAc,IAAM,OAG9E,EAAkB,GAAyB,EAAG,aAAa,eAAe,IAAM,OAGhF,EAAgB,GAAyB,EAAG,aAAa,aAAa,IAAM,OAG5E,EAAgB,GAA+B,EAAG,aAAa,YAAY,EAG3E,EAAqB,GAA+B,EAAG,aAAa,iBAAiB,EAGrF,EAAsB,GAA+B,EAAG,aAAa,kBAAkB,EAGvF,EAAmB,GAA+B,EAAG,aAAa,eAAe,EAGjF,EAAW,GAA+B,EAAG,aAAa,MAAM,EAQhE,GAA8C,EAAe,IACjE,EAAK,YAAY,cAAiB,CAAQ,GAAK,KAO3C,GAAiD,EAAe,IACpE,MAAM,KAAK,EAAK,YAAY,iBAAoB,CAAQ,GAAK,CAAC,CAAC,EAa3D,GAA0C,EAAe,IACpE,EAAiB,EAAM,UAAU,EAAK,GAAG,EAY9B,GAAc,EAAe,IAAiC,CACzE,IAAM,EAAW,EAAW,UAAU,EAAS,IAAM,eAErD,OAAO,MAAM,KAAK,EAAK,iBAAiB,YAAY,GAAU,CAAC,CACjE,EAaa,GACX,EACA,EACA,IACS,CACT,EAAG,cAAc,IAAI,aAAa,UAAU,IAAQ,CAAE,QAAS,GA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M,WAAa,GAAG,oBAAoB,EAG9F,GAAqB,EAAoC,KAAA,EAAA,EAAA,MAAA,CAC9D,mBAAmB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,kBAAkB,EAG1F,GAAgB,EAA+B,KAAA,EAAA,EAAA,MAAA,CACpD,aAAa,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,YAAY,EAG9E,GAAuB,EAAsC,KAAA,EAAA,EAAA,MAAA,CAClE,qBAAqB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,oBAAoB,EAG9F,GAAoB,EAAmC,KAAA,EAAA,EAAA,MAAA,CAC5D,kBAAkB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,iBAAiB,EAGxF,GAAkB,EAAiC,KAAA,EAAA,EAAA,MAAA,CACxD,eAAe,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,cAAc,EAGlF,GAAkB,EAAiC,KAAA,EAAA,EAAA,MAAA,CACxD,eAAe,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,cAAc"}
|
|
1
|
+
{"version":3,"file":"testing.cjs","names":[],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * @vielzeug/refine/testing\n *\n * Testing utilities for refine components. Provides a11y helpers, ARIA query\n * utilities, and convenience wrappers for common patterns in component tests.\n *\n * @example\n * ```typescript\n * import { getAriaLabel, getAriaDescribedBy, isAriaInvalid } from '@vielzeug/refine/testing';\n * import { mount } from '@vielzeug/ore/testing';\n *\n * const fixture = mount('<ore-input label=\"Name\"></ore-input>');\n * const input = fixture.query('input')!;\n * expect(isAriaInvalid(input)).toBe(false);\n * ```\n */\n\n// ── ARIA attribute helpers ────────────────────────────────────────────────────\n\n/** Returns whether `aria-invalid=\"true\"` is set on the element. */\nexport const isAriaInvalid = (el: Element): boolean => el.getAttribute('aria-invalid') === 'true';\n\n/** Returns whether `aria-disabled=\"true\"` is set on the element. */\nexport const isAriaDisabled = (el: Element): boolean => el.getAttribute('aria-disabled') === 'true';\n\n/** Returns whether `aria-checked=\"true\"` is set on the element. */\nexport const isAriaChecked = (el: Element): boolean => el.getAttribute('aria-checked') === 'true';\n\n/** Returns whether `aria-checked=\"mixed\"` is set on the element. */\nexport const isAriaIndeterminate = (el: Element): boolean => el.getAttribute('aria-checked') === 'mixed';\n\n/** Returns whether `aria-expanded=\"true\"` is set on the element. */\nexport const isAriaExpanded = (el: Element): boolean => el.getAttribute('aria-expanded') === 'true';\n\n/** Returns whether `aria-pressed=\"true\"` is set on the element. */\nexport const isAriaPressed = (el: Element): boolean => el.getAttribute('aria-pressed') === 'true';\n\n/** Returns whether `aria-required=\"true\"` is set on the element. */\nexport const isAriaRequired = (el: Element): boolean => el.getAttribute('aria-required') === 'true';\n\n/** Returns whether `aria-hidden=\"true\"` is set on the element. */\nexport const isAriaHidden = (el: Element): boolean => el.getAttribute('aria-hidden') === 'true';\n\n/** Returns the `aria-label` string attribute, or null. */\nexport const getAriaLabel = (el: Element): null | string => el.getAttribute('aria-label');\n\n/** Returns the `aria-labelledby` attribute value (space-separated IDs), or null. */\nexport const getAriaLabelledBy = (el: Element): null | string => el.getAttribute('aria-labelledby');\n\n/** Returns the `aria-describedby` attribute value (space-separated IDs), or null. */\nexport const getAriaDescribedBy = (el: Element): null | string => el.getAttribute('aria-describedby');\n\n/** Returns the `aria-controls` attribute value, or null. */\nexport const getAriaControls = (el: Element): null | string => el.getAttribute('aria-controls');\n\n/** Returns the `role` attribute value, or null. */\nexport const getRole = (el: Element): null | string => el.getAttribute('role');\n\n// ── DOM query helpers ─────────────────────────────────────────────────────────\n\n/**\n * Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.\n * `dispatchPointer(el, type, init)` from earlier versions of this module is now\n * `fire.pointer<Type>(el, init)` (e.g. `fire.pointerEnter`/`fire.pointerLeave`), imported from\n * `@vielzeug/ore/testing` alongside `mount()` — pass `{ composed: true }` explicitly if you need\n * the event to cross shadow boundaries.\n */\nexport { queryInShadow, queryAllInShadow, queryPart, getSlotted } from '@vielzeug/assay';\n\n// ── Form-associated component helpers ─────────────────────────────────────────\n\n/**\n * Returns the current form value of a form-associated custom element.\n * Uses the ElementInternals-exposed `value` if available, then falls back\n * to the reflected DOM `value` property.\n */\nexport const getFormValue = (el: HTMLElement & { value?: string }): null | string => {\n return el.value ?? null;\n};\n\n/**\n * Returns whether a form-associated element is considered valid (no constraint\n * violations reported by the browser or via `setValidity`).\n */\nexport const isFormValid = (el: HTMLElement & { validity?: ValidityState }): boolean => {\n return el.validity?.valid ?? true;\n};\n\n// ── Timing helpers ────────────────────────────────────────────────────────────\n\n/**\n * Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.\n * `keyEvent(key, init)` from earlier versions of this module (construct-only, no dispatch, and\n * unused anywhere in this package's own tests) has been removed — use `fire.keyDown`/\n * `fire.keyboard` from `@vielzeug/ore/testing`, which construct and dispatch in one call.\n */\nexport { nextTick, wait } from '@vielzeug/assay';\n\n// ── ID counter ────────────────────────────────────────────────────────────────\n\n/**\n * Resets the headless stable-ID counter to 0. Use in test `beforeEach` hooks when you need\n * deterministic IDs across test runs.\n *\n * @example\n * ```ts\n * import { resetStableIdCounter } from '@vielzeug/refine/testing';\n * beforeEach(() => resetStableIdCounter());\n * ```\n */\nexport { resetStableIdCounter } from '@vielzeug/ore';\n\n// ── ARIA snapshot helper ───────────────────────────────────────────────────────\n\n/**\n * Returns a snapshot of the most commonly tested ARIA attributes on an element.\n * Useful for concise inline snapshot assertions in component tests.\n *\n * `ariaLabel` and `labelledby` are kept separate because `aria-label` is a\n * direct string while `aria-labelledby` is an ID reference — conflating them\n * masks bugs where the wrong labelling mechanism is used.\n *\n * @example\n * ```ts\n * expect(getAriaState(input)).toMatchObject({ invalid: 'true', required: 'true' });\n * ```\n */\nexport const getAriaState = (\n el: Element,\n): {\n ariaLabel: null | string;\n checked: null | string;\n disabled: null | string;\n expanded: null | string;\n invalid: null | string;\n labelledby: null | string;\n required: null | string;\n role: null | string;\n} => ({\n ariaLabel: el.getAttribute('aria-label'),\n checked: el.getAttribute('aria-checked'),\n disabled: el.getAttribute('aria-disabled'),\n expanded: el.getAttribute('aria-expanded'),\n invalid: el.getAttribute('aria-invalid'),\n labelledby: el.getAttribute('aria-labelledby'),\n required: el.getAttribute('aria-required'),\n role: el.getAttribute('role'),\n});\n\n// ── Typed component mount wrappers (F3) ───────────────────────────────────────\n\nimport type { Fixture } from '@vielzeug/ore/testing';\n\nimport { mount } from '@vielzeug/ore/testing';\n\nimport type { OreButtonGroupProps } from '../inputs/button-group/button-group';\nimport type { OreButtonProps } from '../inputs/button/button';\nimport type { OreCheckboxGroupProps } from '../inputs/checkbox-group/checkbox-group';\nimport type { OreCheckboxProps } from '../inputs/checkbox/checkbox';\nimport type { OreComboboxProps } from '../inputs/combobox/combobox.types';\nimport type { OreFileInputProps } from '../inputs/file-input/file-input';\nimport type { OreFormProps } from '../inputs/form/form';\nimport type { OreInputProps } from '../inputs/input/input';\nimport type { OreNumberInputProps } from '../inputs/number-input/number-input';\nimport type { OreOtpInputProps } from '../inputs/otp-input/otp-input';\nimport type { OreRadioGroupProps } from '../inputs/radio-group/radio-group';\nimport type { OreRadioProps } from '../inputs/radio/radio';\nimport type { OreRatingProps } from '../inputs/rating/rating';\nimport type { OreSelectProps } from '../inputs/select/select';\nimport type { OreSliderProps } from '../inputs/slider/slider';\nimport type { OreSwitchProps } from '../inputs/switch/switch';\nimport type { OreTextareaProps } from '../inputs/textarea/textarea';\n\n/**\n * Serializes an attribute map to an HTML attribute string fragment.\n * Values are HTML-escaped to prevent attribute injection.\n *\n * @example\n * ```ts\n * attrsToHtml({ disabled: '', label: 'Name' }); // → 'disabled label=\"Name\"'\n * ```\n */\nexport const attrsToHtml = (attrs: Record<string, string>): string =>\n Object.entries(attrs)\n .map(([key, value]) => (value === '' ? key : `${key}=\"${value.replace(/\"/g, '"')}\"`))\n .join(' ');\n\n/**\n * Converts a props object into an HTML attribute record.\n * - `true` → empty boolean attribute (e.g., `disabled`)\n * - `false` / `null` / `undefined` → attribute omitted\n * - Array of objects → **omitted** (cannot be serialized as an HTML attribute;\n * use `opts.innerHTML` with slotted elements instead)\n * - Array of primitives → comma-joined string\n * - everything else → stringified\n *\n * @example\n * ```ts\n * propsToAttrs({ disabled: true, label: 'Name', value: undefined });\n * // → { disabled: '', label: 'Name' }\n * ```\n */\nexport const propsToAttrs = (props: Record<string, unknown> = {}): Record<string, string> => {\n const attrs: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (value === false || value == null) continue;\n\n if (value === true) {\n attrs[key] = '';\n } else if (Array.isArray(value)) {\n // Object arrays cannot be represented as HTML attributes — skip silently.\n if (value.length > 0 && typeof value[0] === 'object') continue;\n\n attrs[key] = (value as string[]).join(',');\n } else {\n attrs[key] = String(value);\n }\n }\n\n return attrs;\n};\n\ntype MountOptions = { innerHTML?: string };\n\n/** Typed mount wrapper for `<ore-input>`. Catch prop name typos at compile time. */\nexport const mountOreInput = (props?: Partial<OreInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-input>`);\n\n/** Typed mount wrapper for `<ore-textarea>`. */\nexport const mountOreTextarea = (props?: Partial<OreTextareaProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-textarea ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-textarea>`);\n\n/** Typed mount wrapper for `<ore-select>`. */\nexport const mountOreSelect = (props?: Partial<OreSelectProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-select ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-select>`);\n\n/** Typed mount wrapper for `<ore-combobox>`. */\nexport const mountOreCombobox = (props?: Partial<OreComboboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-combobox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-combobox>`);\n\n/** Typed mount wrapper for `<ore-checkbox>`. */\nexport const mountOreCheckbox = (props?: Partial<OreCheckboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox>`);\n\n/** Typed mount wrapper for `<ore-checkbox-group>`. */\nexport const mountOreCheckboxGroup = (props?: Partial<OreCheckboxGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox-group>`);\n\n/** Typed mount wrapper for `<ore-radio>`. */\nexport const mountOreRadio = (props?: Partial<OreRadioProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio>`);\n\n/** Typed mount wrapper for `<ore-radio-group>`. */\nexport const mountOreRadioGroup = (props?: Partial<OreRadioGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio-group>`);\n\n/** Typed mount wrapper for `<ore-switch>`. */\nexport const mountOreSwitch = (props?: Partial<OreSwitchProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-switch ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-switch>`);\n\n/** Typed mount wrapper for `<ore-button>`. */\nexport const mountOreButton = (props?: Partial<OreButtonProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button>`);\n\n/** Typed mount wrapper for `<ore-button-group>`. */\nexport const mountOreButtonGroup = (props?: Partial<OreButtonGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button-group>`);\n\n/** Typed mount wrapper for `<ore-file-input>`. */\nexport const mountOreFileInput = (props?: Partial<OreFileInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-file-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-file-input>`);\n\n/** Typed mount wrapper for `<ore-form>`. */\nexport const mountOreForm = (props?: Partial<OreFormProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-form ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-form>`);\n\n/** Typed mount wrapper for `<ore-number-input>`. */\nexport const mountOreNumberInput = (props?: Partial<OreNumberInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-number-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-number-input>`);\n\n/** Typed mount wrapper for `<ore-otp-input>`. */\nexport const mountOreOtpInput = (props?: Partial<OreOtpInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-otp-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-otp-input>`);\n\n/** Typed mount wrapper for `<ore-rating>`. */\nexport const mountOreRating = (props?: Partial<OreRatingProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-rating ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-rating>`);\n\n/** Typed mount wrapper for `<ore-slider>`. */\nexport const mountOreSlider = (props?: Partial<OreSliderProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-slider ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-slider>`);\n"],"mappings":"kKAoBA,IAAa,EAAiB,GAAyB,EAAG,aAAa,cAAc,IAAM,OAG9E,EAAkB,GAAyB,EAAG,aAAa,eAAe,IAAM,OAGhF,EAAiB,GAAyB,EAAG,aAAa,cAAc,IAAM,OA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,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,cAAc,EAGlF,GAAuB,EAAsC,KAAA,EAAA,EAAA,MAAA,CAClE,qBAAqB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,oBAAoB,EAG9F,GAAqB,EAAoC,KAAA,EAAA,EAAA,MAAA,CAC9D,mBAAmB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,kBAAkB,EAG1F,GAAgB,EAA+B,KAAA,EAAA,EAAA,MAAA,CACpD,aAAa,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,YAAY,EAG9E,GAAuB,EAAsC,KAAA,EAAA,EAAA,MAAA,CAClE,qBAAqB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,oBAAoB,EAG9F,GAAoB,EAAmC,KAAA,EAAA,EAAA,MAAA,CAC5D,kBAAkB,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,iBAAiB,EAGxF,GAAkB,EAAiC,KAAA,EAAA,EAAA,MAAA,CACxD,eAAe,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,cAAc,EAGlF,GAAkB,EAAiC,KAAA,EAAA,EAAA,MAAA,CACxD,eAAe,EAAY,EAAa,CAAK,CAAC,EAAE,GAAG,GAAM,WAAa,GAAG,cAAc"}
|
package/dist/testing.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { resetStableIdCounter as e } from "@vielzeug/ore";
|
|
2
|
+
import { getSlotted as t, nextTick as n, queryAllInShadow as r, queryInShadow as i, queryPart as a, wait as o } from "@vielzeug/assay";
|
|
3
|
+
import { mount as s } from "@vielzeug/ore/testing";
|
|
3
4
|
//#region src/testing/index.ts
|
|
4
|
-
var
|
|
5
|
-
let n = t ? `[slot="${t}"]` : ":not([slot])";
|
|
6
|
-
return Array.from(e.querySelectorAll(`:scope > ${n}`));
|
|
7
|
-
}, y = (e, t, n) => {
|
|
8
|
-
e.dispatchEvent(new PointerEvent(`pointer${t}`, {
|
|
9
|
-
bubbles: !0,
|
|
10
|
-
composed: !0,
|
|
11
|
-
...n
|
|
12
|
-
}));
|
|
13
|
-
}, b = (e) => e.value ?? null, x = (e) => e.validity?.valid ?? !0, S = (e, t) => new KeyboardEvent("keydown", {
|
|
14
|
-
bubbles: !0,
|
|
15
|
-
cancelable: !0,
|
|
16
|
-
key: e,
|
|
17
|
-
...t
|
|
18
|
-
}), C = () => new Promise((e) => {
|
|
19
|
-
queueMicrotask(e);
|
|
20
|
-
}), w = (e = 0) => new Promise((t) => {
|
|
21
|
-
setTimeout(t, e);
|
|
22
|
-
}), T = (e) => ({
|
|
5
|
+
var c = (e) => e.getAttribute("aria-invalid") === "true", l = (e) => e.getAttribute("aria-disabled") === "true", u = (e) => e.getAttribute("aria-checked") === "true", d = (e) => e.getAttribute("aria-checked") === "mixed", f = (e) => e.getAttribute("aria-expanded") === "true", p = (e) => e.getAttribute("aria-pressed") === "true", m = (e) => e.getAttribute("aria-required") === "true", h = (e) => e.getAttribute("aria-hidden") === "true", g = (e) => e.getAttribute("aria-label"), _ = (e) => e.getAttribute("aria-labelledby"), v = (e) => e.getAttribute("aria-describedby"), y = (e) => e.getAttribute("aria-controls"), b = (e) => e.getAttribute("role"), x = (e) => e.value ?? null, S = (e) => e.validity?.valid ?? !0, C = (e) => ({
|
|
23
6
|
ariaLabel: e.getAttribute("aria-label"),
|
|
24
7
|
checked: e.getAttribute("aria-checked"),
|
|
25
8
|
disabled: e.getAttribute("aria-disabled"),
|
|
@@ -28,7 +11,7 @@ var n = (e) => e.getAttribute("aria-invalid") === "true", r = (e) => e.getAttrib
|
|
|
28
11
|
labelledby: e.getAttribute("aria-labelledby"),
|
|
29
12
|
required: e.getAttribute("aria-required"),
|
|
30
13
|
role: e.getAttribute("role")
|
|
31
|
-
}),
|
|
14
|
+
}), w = (e) => Object.entries(e).map(([e, t]) => t === "" ? e : `${e}="${t.replace(/"/g, """)}"`).join(" "), T = (e = {}) => {
|
|
32
15
|
let t = {};
|
|
33
16
|
for (let [n, r] of Object.entries(e)) if (!(r === !1 || r == null)) if (r === !0) t[n] = "";
|
|
34
17
|
else if (Array.isArray(r)) {
|
|
@@ -36,8 +19,8 @@ var n = (e) => e.getAttribute("aria-invalid") === "true", r = (e) => e.getAttrib
|
|
|
36
19
|
t[n] = r.join(",");
|
|
37
20
|
} else t[n] = String(r);
|
|
38
21
|
return t;
|
|
39
|
-
},
|
|
22
|
+
}, E = (e, t) => s(`<ore-input ${w(T(e))}>${t?.innerHTML ?? ""}</ore-input>`), D = (e, t) => s(`<ore-textarea ${w(T(e))}>${t?.innerHTML ?? ""}</ore-textarea>`), O = (e, t) => s(`<ore-select ${w(T(e))}>${t?.innerHTML ?? ""}</ore-select>`), k = (e, t) => s(`<ore-combobox ${w(T(e))}>${t?.innerHTML ?? ""}</ore-combobox>`), A = (e, t) => s(`<ore-checkbox ${w(T(e))}>${t?.innerHTML ?? ""}</ore-checkbox>`), j = (e, t) => s(`<ore-checkbox-group ${w(T(e))}>${t?.innerHTML ?? ""}</ore-checkbox-group>`), M = (e, t) => s(`<ore-radio ${w(T(e))}>${t?.innerHTML ?? ""}</ore-radio>`), N = (e, t) => s(`<ore-radio-group ${w(T(e))}>${t?.innerHTML ?? ""}</ore-radio-group>`), P = (e, t) => s(`<ore-switch ${w(T(e))}>${t?.innerHTML ?? ""}</ore-switch>`), F = (e, t) => s(`<ore-button ${w(T(e))}>${t?.innerHTML ?? ""}</ore-button>`), I = (e, t) => s(`<ore-button-group ${w(T(e))}>${t?.innerHTML ?? ""}</ore-button-group>`), L = (e, t) => s(`<ore-file-input ${w(T(e))}>${t?.innerHTML ?? ""}</ore-file-input>`), R = (e, t) => s(`<ore-form ${w(T(e))}>${t?.innerHTML ?? ""}</ore-form>`), z = (e, t) => s(`<ore-number-input ${w(T(e))}>${t?.innerHTML ?? ""}</ore-number-input>`), B = (e, t) => s(`<ore-otp-input ${w(T(e))}>${t?.innerHTML ?? ""}</ore-otp-input>`), V = (e, t) => s(`<ore-rating ${w(T(e))}>${t?.innerHTML ?? ""}</ore-rating>`), H = (e, t) => s(`<ore-slider ${w(T(e))}>${t?.innerHTML ?? ""}</ore-slider>`);
|
|
40
23
|
//#endregion
|
|
41
|
-
export {
|
|
24
|
+
export { w as attrsToHtml, y as getAriaControls, v as getAriaDescribedBy, g as getAriaLabel, _ as getAriaLabelledBy, C as getAriaState, x as getFormValue, b as getRole, t as getSlotted, u as isAriaChecked, l as isAriaDisabled, f as isAriaExpanded, h as isAriaHidden, d as isAriaIndeterminate, c as isAriaInvalid, p as isAriaPressed, m as isAriaRequired, S as isFormValid, F as mountOreButton, I as mountOreButtonGroup, A as mountOreCheckbox, j as mountOreCheckboxGroup, k as mountOreCombobox, L as mountOreFileInput, R as mountOreForm, E as mountOreInput, z as mountOreNumberInput, B as mountOreOtpInput, M as mountOreRadio, N as mountOreRadioGroup, V as mountOreRating, O as mountOreSelect, H as mountOreSlider, P as mountOreSwitch, D as mountOreTextarea, n as nextTick, T as propsToAttrs, r as queryAllInShadow, i as queryInShadow, a as queryPart, e as resetStableIdCounter, o as wait };
|
|
42
25
|
|
|
43
26
|
//# sourceMappingURL=testing.js.map
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","names":[],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * @vielzeug/refine/testing\n *\n * Testing utilities for refine components. Provides a11y helpers, ARIA query\n * utilities, and convenience wrappers for common patterns in component tests.\n *\n * @example\n * ```typescript\n * import { getAriaLabel, getAriaDescribedBy, isAriaInvalid } from '@vielzeug/refine/testing';\n * import { mount } from '@vielzeug/ore/testing';\n *\n * const fixture = mount('<ore-input label=\"Name\"></ore-input>');\n * const input = fixture.query('input')!;\n * expect(isAriaInvalid(input)).toBe(false);\n * ```\n */\n\n// ── ARIA attribute helpers ────────────────────────────────────────────────────\n\n/** Returns whether `aria-invalid=\"true\"` is set on the element. */\nexport const isAriaInvalid = (el: Element): boolean => el.getAttribute('aria-invalid') === 'true';\n\n/** Returns whether `aria-disabled=\"true\"` is set on the element. */\nexport const isAriaDisabled = (el: Element): boolean => el.getAttribute('aria-disabled') === 'true';\n\n/** Returns whether `aria-checked=\"true\"` is set on the element. */\nexport const isAriaChecked = (el: Element): boolean => el.getAttribute('aria-checked') === 'true';\n\n/** Returns whether `aria-checked=\"mixed\"` is set on the element. */\nexport const isAriaIndeterminate = (el: Element): boolean => el.getAttribute('aria-checked') === 'mixed';\n\n/** Returns whether `aria-expanded=\"true\"` is set on the element. */\nexport const isAriaExpanded = (el: Element): boolean => el.getAttribute('aria-expanded') === 'true';\n\n/** Returns whether `aria-pressed=\"true\"` is set on the element. */\nexport const isAriaPressed = (el: Element): boolean => el.getAttribute('aria-pressed') === 'true';\n\n/** Returns whether `aria-required=\"true\"` is set on the element. */\nexport const isAriaRequired = (el: Element): boolean => el.getAttribute('aria-required') === 'true';\n\n/** Returns whether `aria-hidden=\"true\"` is set on the element. */\nexport const isAriaHidden = (el: Element): boolean => el.getAttribute('aria-hidden') === 'true';\n\n/** Returns the `aria-label` string attribute, or null. */\nexport const getAriaLabel = (el: Element): null | string => el.getAttribute('aria-label');\n\n/** Returns the `aria-labelledby` attribute value (space-separated IDs), or null. */\nexport const getAriaLabelledBy = (el: Element): null | string => el.getAttribute('aria-labelledby');\n\n/** Returns the `aria-describedby` attribute value (space-separated IDs), or null. */\nexport const getAriaDescribedBy = (el: Element): null | string => el.getAttribute('aria-describedby');\n\n/** Returns the `aria-controls` attribute value, or null. */\nexport const getAriaControls = (el: Element): null | string => el.getAttribute('aria-controls');\n\n/** Returns the `role` attribute value, or null. */\nexport const getRole = (el: Element): null | string => el.getAttribute('role');\n\n// ── DOM query helpers ─────────────────────────────────────────────────────────\n\n/**\n * Queries the shadow root of a custom element for a matching CSS selector.\n * Returns null if the element has no shadow root or no match is found.\n */\nexport const queryInShadow = <T extends Element = Element>(host: Element, selector: string): null | T => {\n return host.shadowRoot?.querySelector<T>(selector) ?? null;\n};\n\n/**\n * Queries all matching elements inside the shadow root of a custom element.\n * Returns an empty array if the element has no shadow root.\n */\nexport const queryAllInShadow = <T extends Element = Element>(host: Element, selector: string): T[] => {\n return Array.from(host.shadowRoot?.querySelectorAll<T>(selector) ?? []);\n};\n\n/**\n * Queries a shadow DOM element by its CSS `part` attribute.\n * Shorthand for `queryInShadow(host, '[part=\"name\"]')`.\n *\n * @example\n * ```ts\n * const btn = queryPart(carousel, 'prev-btn');\n * expect(btn).not.toBeNull();\n * ```\n */\nexport const queryPart = <T extends Element = Element>(host: Element, part: string): null | T =>\n queryInShadow<T>(host, `[part=\"${part}\"]`);\n\n/**\n * Returns an array of light-DOM children assigned to a named slot,\n * or all slotted children if no name is given.\n *\n * @example\n * ```ts\n * const slides = getSlotted(carousel);\n * expect(slides).toHaveLength(3);\n * ```\n */\nexport const getSlotted = (host: Element, slotName?: string): Element[] => {\n const selector = slotName ? `[slot=\"${slotName}\"]` : ':not([slot])';\n\n return Array.from(host.querySelectorAll(`:scope > ${selector}`));\n};\n\n/**\n * Dispatches a `PointerEvent` on the given element.\n * Useful for testing hover, drag, and pointer interactions without\n * relying on the fire helper from @vielzeug/ore/testing.\n *\n * @example\n * ```ts\n * dispatchPointer(el, 'enter');\n * dispatchPointer(el, 'leave');\n * ```\n */\nexport const dispatchPointer = (\n el: Element,\n type: 'cancel' | 'down' | 'enter' | 'leave' | 'move' | 'up',\n init?: PointerEventInit,\n): void => {\n el.dispatchEvent(new PointerEvent(`pointer${type}`, { bubbles: true, composed: true, ...init }));\n};\n\n// ── Form-associated component helpers ─────────────────────────────────────────\n\n/**\n * Returns the current form value of a form-associated custom element.\n * Uses the ElementInternals-exposed `value` if available, then falls back\n * to the reflected DOM `value` property.\n */\nexport const getFormValue = (el: HTMLElement & { value?: string }): null | string => {\n return el.value ?? null;\n};\n\n/**\n * Returns whether a form-associated element is considered valid (no constraint\n * violations reported by the browser or via `setValidity`).\n */\nexport const isFormValid = (el: HTMLElement & { validity?: ValidityState }): boolean => {\n return el.validity?.valid ?? true;\n};\n\n// ── Event helpers ─────────────────────────────────────────────────────────────\n\n/**\n * Creates a synthetic `KeyboardEvent` with the given key.\n * Useful for testing keyboard navigation in headless controls.\n */\nexport const keyEvent = (key: string, init?: KeyboardEventInit): KeyboardEvent => {\n return new KeyboardEvent('keydown', { bubbles: true, cancelable: true, key, ...init });\n};\n\n/**\n * Returns a Promise that resolves after a microtask tick (one `queueMicrotask`).\n * Use when you need to wait for reactivity (signal effects) to settle without\n * moving into the macrotask queue.\n */\nexport const nextTick = (): Promise<void> =>\n new Promise((resolve) => {\n queueMicrotask(resolve);\n });\n\n/**\n * Returns a Promise that resolves after `ms` milliseconds.\n * Use sparingly — prefer `nextTick()` for reactive updates.\n */\nexport const wait = (ms = 0): Promise<void> =>\n new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n\n// ── ID counter ────────────────────────────────────────────────────────────────\n\n/**\n * Resets the headless ID counter to 0. Use in test `beforeEach` hooks when you need\n * deterministic IDs across test runs.\n *\n * @example\n * ```ts\n * import { resetIdCounter } from '@vielzeug/refine/testing';\n * beforeEach(() => resetIdCounter());\n * ```\n */\nexport { resetIdCounter } from '@vielzeug/ore';\n\n// ── ARIA snapshot helper ───────────────────────────────────────────────────────\n\n/**\n * Returns a snapshot of the most commonly tested ARIA attributes on an element.\n * Useful for concise inline snapshot assertions in component tests.\n *\n * `ariaLabel` and `labelledby` are kept separate because `aria-label` is a\n * direct string while `aria-labelledby` is an ID reference — conflating them\n * masks bugs where the wrong labelling mechanism is used.\n *\n * @example\n * ```ts\n * expect(getAriaState(input)).toMatchObject({ invalid: 'true', required: 'true' });\n * ```\n */\nexport const getAriaState = (\n el: Element,\n): {\n ariaLabel: null | string;\n checked: null | string;\n disabled: null | string;\n expanded: null | string;\n invalid: null | string;\n labelledby: null | string;\n required: null | string;\n role: null | string;\n} => ({\n ariaLabel: el.getAttribute('aria-label'),\n checked: el.getAttribute('aria-checked'),\n disabled: el.getAttribute('aria-disabled'),\n expanded: el.getAttribute('aria-expanded'),\n invalid: el.getAttribute('aria-invalid'),\n labelledby: el.getAttribute('aria-labelledby'),\n required: el.getAttribute('aria-required'),\n role: el.getAttribute('role'),\n});\n\n// ── Typed component mount wrappers (F3) ───────────────────────────────────────\n\nimport type { Fixture } from '@vielzeug/ore/testing';\n\nimport { mount } from '@vielzeug/ore/testing';\n\nimport type { OreButtonGroupProps } from '../inputs/button-group/button-group';\nimport type { OreButtonProps } from '../inputs/button/button';\nimport type { OreCheckboxGroupProps } from '../inputs/checkbox-group/checkbox-group';\nimport type { OreCheckboxProps } from '../inputs/checkbox/checkbox';\nimport type { OreComboboxProps } from '../inputs/combobox/combobox.types';\nimport type { OreFileInputProps } from '../inputs/file-input/file-input';\nimport type { OreFormProps } from '../inputs/form/form';\nimport type { OreInputProps } from '../inputs/input/input';\nimport type { OreNumberInputProps } from '../inputs/number-input/number-input';\nimport type { OreOtpInputProps } from '../inputs/otp-input/otp-input';\nimport type { OreRadioGroupProps } from '../inputs/radio-group/radio-group';\nimport type { OreRadioProps } from '../inputs/radio/radio';\nimport type { OreRatingProps } from '../inputs/rating/rating';\nimport type { OreSelectProps } from '../inputs/select/select';\nimport type { OreSliderProps } from '../inputs/slider/slider';\nimport type { OreSwitchProps } from '../inputs/switch/switch';\nimport type { OreTextareaProps } from '../inputs/textarea/textarea';\n\n/**\n * Serializes an attribute map to an HTML attribute string fragment.\n * Values are HTML-escaped to prevent attribute injection.\n *\n * @example\n * ```ts\n * attrsToHtml({ disabled: '', label: 'Name' }); // → 'disabled label=\"Name\"'\n * ```\n */\nexport const attrsToHtml = (attrs: Record<string, string>): string =>\n Object.entries(attrs)\n .map(([key, value]) => (value === '' ? key : `${key}=\"${value.replace(/\"/g, '"')}\"`))\n .join(' ');\n\n/**\n * Converts a props object into an HTML attribute record.\n * - `true` → empty boolean attribute (e.g., `disabled`)\n * - `false` / `null` / `undefined` → attribute omitted\n * - Array of objects → **omitted** (cannot be serialized as an HTML attribute;\n * use `opts.innerHTML` with slotted elements instead)\n * - Array of primitives → comma-joined string\n * - everything else → stringified\n *\n * @example\n * ```ts\n * propsToAttrs({ disabled: true, label: 'Name', value: undefined });\n * // → { disabled: '', label: 'Name' }\n * ```\n */\nexport const propsToAttrs = (props: Record<string, unknown> = {}): Record<string, string> => {\n const attrs: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (value === false || value == null) continue;\n\n if (value === true) {\n attrs[key] = '';\n } else if (Array.isArray(value)) {\n // Object arrays cannot be represented as HTML attributes — skip silently.\n if (value.length > 0 && typeof value[0] === 'object') continue;\n\n attrs[key] = (value as string[]).join(',');\n } else {\n attrs[key] = String(value);\n }\n }\n\n return attrs;\n};\n\ntype MountOptions = { innerHTML?: string };\n\n/** Typed mount wrapper for `<ore-input>`. Catch prop name typos at compile time. */\nexport const mountOreInput = (props?: Partial<OreInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-input>`);\n\n/** Typed mount wrapper for `<ore-textarea>`. */\nexport const mountOreTextarea = (props?: Partial<OreTextareaProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-textarea ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-textarea>`);\n\n/** Typed mount wrapper for `<ore-select>`. */\nexport const mountOreSelect = (props?: Partial<OreSelectProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-select ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-select>`);\n\n/** Typed mount wrapper for `<ore-combobox>`. */\nexport const mountOreCombobox = (props?: Partial<OreComboboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-combobox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-combobox>`);\n\n/** Typed mount wrapper for `<ore-checkbox>`. */\nexport const mountOreCheckbox = (props?: Partial<OreCheckboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox>`);\n\n/** Typed mount wrapper for `<ore-checkbox-group>`. */\nexport const mountOreCheckboxGroup = (props?: Partial<OreCheckboxGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox-group>`);\n\n/** Typed mount wrapper for `<ore-radio>`. */\nexport const mountOreRadio = (props?: Partial<OreRadioProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio>`);\n\n/** Typed mount wrapper for `<ore-radio-group>`. */\nexport const mountOreRadioGroup = (props?: Partial<OreRadioGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio-group>`);\n\n/** Typed mount wrapper for `<ore-switch>`. */\nexport const mountOreSwitch = (props?: Partial<OreSwitchProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-switch ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-switch>`);\n\n/** Typed mount wrapper for `<ore-button>`. */\nexport const mountOreButton = (props?: Partial<OreButtonProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button>`);\n\n/** Typed mount wrapper for `<ore-button-group>`. */\nexport const mountOreButtonGroup = (props?: Partial<OreButtonGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button-group>`);\n\n/** Typed mount wrapper for `<ore-file-input>`. */\nexport const mountOreFileInput = (props?: Partial<OreFileInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-file-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-file-input>`);\n\n/** Typed mount wrapper for `<ore-form>`. */\nexport const mountOreForm = (props?: Partial<OreFormProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-form ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-form>`);\n\n/** Typed mount wrapper for `<ore-number-input>`. */\nexport const mountOreNumberInput = (props?: Partial<OreNumberInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-number-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-number-input>`);\n\n/** Typed mount wrapper for `<ore-otp-input>`. */\nexport const mountOreOtpInput = (props?: Partial<OreOtpInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-otp-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-otp-input>`);\n\n/** Typed mount wrapper for `<ore-rating>`. */\nexport const mountOreRating = (props?: Partial<OreRatingProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-rating ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-rating>`);\n\n/** Typed mount wrapper for `<ore-slider>`. */\nexport const mountOreSlider = (props?: Partial<OreSliderProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-slider ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-slider>`);\n"],"mappings":";;;AAoBA,IAAa,KAAiB,MAAyB,EAAG,aAAa,cAAc,MAAM,QAG9E,KAAkB,MAAyB,EAAG,aAAa,eAAe,MAAM,QAGhF,KAAiB,MAAyB,EAAG,aAAa,cAAc,MAAM,QAG9E,KAAuB,MAAyB,EAAG,aAAa,cAAc,MAAM,SAG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G,cAAc"}
|
|
1
|
+
{"version":3,"file":"testing.js","names":[],"sources":["../src/testing/index.ts"],"sourcesContent":["/**\n * @vielzeug/refine/testing\n *\n * Testing utilities for refine components. Provides a11y helpers, ARIA query\n * utilities, and convenience wrappers for common patterns in component tests.\n *\n * @example\n * ```typescript\n * import { getAriaLabel, getAriaDescribedBy, isAriaInvalid } from '@vielzeug/refine/testing';\n * import { mount } from '@vielzeug/ore/testing';\n *\n * const fixture = mount('<ore-input label=\"Name\"></ore-input>');\n * const input = fixture.query('input')!;\n * expect(isAriaInvalid(input)).toBe(false);\n * ```\n */\n\n// ── ARIA attribute helpers ────────────────────────────────────────────────────\n\n/** Returns whether `aria-invalid=\"true\"` is set on the element. */\nexport const isAriaInvalid = (el: Element): boolean => el.getAttribute('aria-invalid') === 'true';\n\n/** Returns whether `aria-disabled=\"true\"` is set on the element. */\nexport const isAriaDisabled = (el: Element): boolean => el.getAttribute('aria-disabled') === 'true';\n\n/** Returns whether `aria-checked=\"true\"` is set on the element. */\nexport const isAriaChecked = (el: Element): boolean => el.getAttribute('aria-checked') === 'true';\n\n/** Returns whether `aria-checked=\"mixed\"` is set on the element. */\nexport const isAriaIndeterminate = (el: Element): boolean => el.getAttribute('aria-checked') === 'mixed';\n\n/** Returns whether `aria-expanded=\"true\"` is set on the element. */\nexport const isAriaExpanded = (el: Element): boolean => el.getAttribute('aria-expanded') === 'true';\n\n/** Returns whether `aria-pressed=\"true\"` is set on the element. */\nexport const isAriaPressed = (el: Element): boolean => el.getAttribute('aria-pressed') === 'true';\n\n/** Returns whether `aria-required=\"true\"` is set on the element. */\nexport const isAriaRequired = (el: Element): boolean => el.getAttribute('aria-required') === 'true';\n\n/** Returns whether `aria-hidden=\"true\"` is set on the element. */\nexport const isAriaHidden = (el: Element): boolean => el.getAttribute('aria-hidden') === 'true';\n\n/** Returns the `aria-label` string attribute, or null. */\nexport const getAriaLabel = (el: Element): null | string => el.getAttribute('aria-label');\n\n/** Returns the `aria-labelledby` attribute value (space-separated IDs), or null. */\nexport const getAriaLabelledBy = (el: Element): null | string => el.getAttribute('aria-labelledby');\n\n/** Returns the `aria-describedby` attribute value (space-separated IDs), or null. */\nexport const getAriaDescribedBy = (el: Element): null | string => el.getAttribute('aria-describedby');\n\n/** Returns the `aria-controls` attribute value, or null. */\nexport const getAriaControls = (el: Element): null | string => el.getAttribute('aria-controls');\n\n/** Returns the `role` attribute value, or null. */\nexport const getRole = (el: Element): null | string => el.getAttribute('role');\n\n// ── DOM query helpers ─────────────────────────────────────────────────────────\n\n/**\n * Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.\n * `dispatchPointer(el, type, init)` from earlier versions of this module is now\n * `fire.pointer<Type>(el, init)` (e.g. `fire.pointerEnter`/`fire.pointerLeave`), imported from\n * `@vielzeug/ore/testing` alongside `mount()` — pass `{ composed: true }` explicitly if you need\n * the event to cross shadow boundaries.\n */\nexport { queryInShadow, queryAllInShadow, queryPart, getSlotted } from '@vielzeug/assay';\n\n// ── Form-associated component helpers ─────────────────────────────────────────\n\n/**\n * Returns the current form value of a form-associated custom element.\n * Uses the ElementInternals-exposed `value` if available, then falls back\n * to the reflected DOM `value` property.\n */\nexport const getFormValue = (el: HTMLElement & { value?: string }): null | string => {\n return el.value ?? null;\n};\n\n/**\n * Returns whether a form-associated element is considered valid (no constraint\n * violations reported by the browser or via `setValidity`).\n */\nexport const isFormValid = (el: HTMLElement & { validity?: ValidityState }): boolean => {\n return el.validity?.valid ?? true;\n};\n\n// ── Timing helpers ────────────────────────────────────────────────────────────\n\n/**\n * Generic, framework-agnostic — re-exported from `@vielzeug/assay` rather than duplicated here.\n * `keyEvent(key, init)` from earlier versions of this module (construct-only, no dispatch, and\n * unused anywhere in this package's own tests) has been removed — use `fire.keyDown`/\n * `fire.keyboard` from `@vielzeug/ore/testing`, which construct and dispatch in one call.\n */\nexport { nextTick, wait } from '@vielzeug/assay';\n\n// ── ID counter ────────────────────────────────────────────────────────────────\n\n/**\n * Resets the headless stable-ID counter to 0. Use in test `beforeEach` hooks when you need\n * deterministic IDs across test runs.\n *\n * @example\n * ```ts\n * import { resetStableIdCounter } from '@vielzeug/refine/testing';\n * beforeEach(() => resetStableIdCounter());\n * ```\n */\nexport { resetStableIdCounter } from '@vielzeug/ore';\n\n// ── ARIA snapshot helper ───────────────────────────────────────────────────────\n\n/**\n * Returns a snapshot of the most commonly tested ARIA attributes on an element.\n * Useful for concise inline snapshot assertions in component tests.\n *\n * `ariaLabel` and `labelledby` are kept separate because `aria-label` is a\n * direct string while `aria-labelledby` is an ID reference — conflating them\n * masks bugs where the wrong labelling mechanism is used.\n *\n * @example\n * ```ts\n * expect(getAriaState(input)).toMatchObject({ invalid: 'true', required: 'true' });\n * ```\n */\nexport const getAriaState = (\n el: Element,\n): {\n ariaLabel: null | string;\n checked: null | string;\n disabled: null | string;\n expanded: null | string;\n invalid: null | string;\n labelledby: null | string;\n required: null | string;\n role: null | string;\n} => ({\n ariaLabel: el.getAttribute('aria-label'),\n checked: el.getAttribute('aria-checked'),\n disabled: el.getAttribute('aria-disabled'),\n expanded: el.getAttribute('aria-expanded'),\n invalid: el.getAttribute('aria-invalid'),\n labelledby: el.getAttribute('aria-labelledby'),\n required: el.getAttribute('aria-required'),\n role: el.getAttribute('role'),\n});\n\n// ── Typed component mount wrappers (F3) ───────────────────────────────────────\n\nimport type { Fixture } from '@vielzeug/ore/testing';\n\nimport { mount } from '@vielzeug/ore/testing';\n\nimport type { OreButtonGroupProps } from '../inputs/button-group/button-group';\nimport type { OreButtonProps } from '../inputs/button/button';\nimport type { OreCheckboxGroupProps } from '../inputs/checkbox-group/checkbox-group';\nimport type { OreCheckboxProps } from '../inputs/checkbox/checkbox';\nimport type { OreComboboxProps } from '../inputs/combobox/combobox.types';\nimport type { OreFileInputProps } from '../inputs/file-input/file-input';\nimport type { OreFormProps } from '../inputs/form/form';\nimport type { OreInputProps } from '../inputs/input/input';\nimport type { OreNumberInputProps } from '../inputs/number-input/number-input';\nimport type { OreOtpInputProps } from '../inputs/otp-input/otp-input';\nimport type { OreRadioGroupProps } from '../inputs/radio-group/radio-group';\nimport type { OreRadioProps } from '../inputs/radio/radio';\nimport type { OreRatingProps } from '../inputs/rating/rating';\nimport type { OreSelectProps } from '../inputs/select/select';\nimport type { OreSliderProps } from '../inputs/slider/slider';\nimport type { OreSwitchProps } from '../inputs/switch/switch';\nimport type { OreTextareaProps } from '../inputs/textarea/textarea';\n\n/**\n * Serializes an attribute map to an HTML attribute string fragment.\n * Values are HTML-escaped to prevent attribute injection.\n *\n * @example\n * ```ts\n * attrsToHtml({ disabled: '', label: 'Name' }); // → 'disabled label=\"Name\"'\n * ```\n */\nexport const attrsToHtml = (attrs: Record<string, string>): string =>\n Object.entries(attrs)\n .map(([key, value]) => (value === '' ? key : `${key}=\"${value.replace(/\"/g, '"')}\"`))\n .join(' ');\n\n/**\n * Converts a props object into an HTML attribute record.\n * - `true` → empty boolean attribute (e.g., `disabled`)\n * - `false` / `null` / `undefined` → attribute omitted\n * - Array of objects → **omitted** (cannot be serialized as an HTML attribute;\n * use `opts.innerHTML` with slotted elements instead)\n * - Array of primitives → comma-joined string\n * - everything else → stringified\n *\n * @example\n * ```ts\n * propsToAttrs({ disabled: true, label: 'Name', value: undefined });\n * // → { disabled: '', label: 'Name' }\n * ```\n */\nexport const propsToAttrs = (props: Record<string, unknown> = {}): Record<string, string> => {\n const attrs: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (value === false || value == null) continue;\n\n if (value === true) {\n attrs[key] = '';\n } else if (Array.isArray(value)) {\n // Object arrays cannot be represented as HTML attributes — skip silently.\n if (value.length > 0 && typeof value[0] === 'object') continue;\n\n attrs[key] = (value as string[]).join(',');\n } else {\n attrs[key] = String(value);\n }\n }\n\n return attrs;\n};\n\ntype MountOptions = { innerHTML?: string };\n\n/** Typed mount wrapper for `<ore-input>`. Catch prop name typos at compile time. */\nexport const mountOreInput = (props?: Partial<OreInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-input>`);\n\n/** Typed mount wrapper for `<ore-textarea>`. */\nexport const mountOreTextarea = (props?: Partial<OreTextareaProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-textarea ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-textarea>`);\n\n/** Typed mount wrapper for `<ore-select>`. */\nexport const mountOreSelect = (props?: Partial<OreSelectProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-select ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-select>`);\n\n/** Typed mount wrapper for `<ore-combobox>`. */\nexport const mountOreCombobox = (props?: Partial<OreComboboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-combobox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-combobox>`);\n\n/** Typed mount wrapper for `<ore-checkbox>`. */\nexport const mountOreCheckbox = (props?: Partial<OreCheckboxProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox>`);\n\n/** Typed mount wrapper for `<ore-checkbox-group>`. */\nexport const mountOreCheckboxGroup = (props?: Partial<OreCheckboxGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-checkbox-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-checkbox-group>`);\n\n/** Typed mount wrapper for `<ore-radio>`. */\nexport const mountOreRadio = (props?: Partial<OreRadioProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio>`);\n\n/** Typed mount wrapper for `<ore-radio-group>`. */\nexport const mountOreRadioGroup = (props?: Partial<OreRadioGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-radio-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-radio-group>`);\n\n/** Typed mount wrapper for `<ore-switch>`. */\nexport const mountOreSwitch = (props?: Partial<OreSwitchProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-switch ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-switch>`);\n\n/** Typed mount wrapper for `<ore-button>`. */\nexport const mountOreButton = (props?: Partial<OreButtonProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button>`);\n\n/** Typed mount wrapper for `<ore-button-group>`. */\nexport const mountOreButtonGroup = (props?: Partial<OreButtonGroupProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-button-group ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-button-group>`);\n\n/** Typed mount wrapper for `<ore-file-input>`. */\nexport const mountOreFileInput = (props?: Partial<OreFileInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-file-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-file-input>`);\n\n/** Typed mount wrapper for `<ore-form>`. */\nexport const mountOreForm = (props?: Partial<OreFormProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-form ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-form>`);\n\n/** Typed mount wrapper for `<ore-number-input>`. */\nexport const mountOreNumberInput = (props?: Partial<OreNumberInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-number-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-number-input>`);\n\n/** Typed mount wrapper for `<ore-otp-input>`. */\nexport const mountOreOtpInput = (props?: Partial<OreOtpInputProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-otp-input ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-otp-input>`);\n\n/** Typed mount wrapper for `<ore-rating>`. */\nexport const mountOreRating = (props?: Partial<OreRatingProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-rating ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-rating>`);\n\n/** Typed mount wrapper for `<ore-slider>`. */\nexport const mountOreSlider = (props?: Partial<OreSliderProps>, opts?: MountOptions): Promise<Fixture> =>\n mount(`<ore-slider ${attrsToHtml(propsToAttrs(props))}>${opts?.innerHTML ?? ''}</ore-slider>`);\n"],"mappings":";;;;AAoBA,IAAa,KAAiB,MAAyB,EAAG,aAAa,cAAc,MAAM,QAG9E,KAAkB,MAAyB,EAAG,aAAa,eAAe,MAAM,QAGhF,KAAiB,MAAyB,EAAG,aAAa,cAAc,MAAM,QAG9E,KAAuB,MAAyB,EAAG,aAAa,cAAc,MAAM,SAGpF,KAAkB,MAAyB,EAAG,aAAa,eAAe,MAAM,QAGhF,KAAiB,MAAyB,EAAG,aAAa,cAAc,MAAM,QAG9E,KAAkB,MAAyB,EAAG,aAAa,eAAe,MAAM,QAGhF,KAAgB,MAAyB,EAAG,aAAa,aAAa,MAAM,QAG5E,KAAgB,MAA+B,EAAG,aAAa,YAAY,GAG3E,KAAqB,MAA+B,EAAG,aAAa,iBAAiB,GAGrF,KAAsB,MAA+B,EAAG,aAAa,kBAAkB,GAGvF,KAAmB,MAA+B,EAAG,aAAa,eAAe,GAGjF,KAAW,MAA+B,EAAG,aAAa,MAAM,GAoBhE,KAAgB,MACpB,EAAG,SAAS,MAOR,KAAe,MACnB,EAAG,UAAU,SAAS,IA0ClB,KACX,OAUI;CACJ,WAAW,EAAG,aAAa,YAAY;CACvC,SAAS,EAAG,aAAa,cAAc;CACvC,UAAU,EAAG,aAAa,eAAe;CACzC,UAAU,EAAG,aAAa,eAAe;CACzC,SAAS,EAAG,aAAa,cAAc;CACvC,YAAY,EAAG,aAAa,iBAAiB;CAC7C,UAAU,EAAG,aAAa,eAAe;CACzC,M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