svelte-ag 1.2.2 → 1.2.3
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/components/search/combinations/searchPopover.comp.test.d.ts +2 -0
- package/dist/components/search/combinations/searchPopover.comp.test.d.ts.map +1 -0
- package/dist/components/search/combinations/searchPopover.comp.test.js +25 -0
- package/dist/components/search/combinations/searchPopover.svelte +2 -2
- package/dist/vite/vite-plugin-component-source-collector.d.ts.map +1 -1
- package/dist/vite/vite-plugin-component-source-collector.js +2 -0
- package/package.json +3 -1
- package/src/lib/components/search/combinations/searchPopover.comp.test.ts +31 -0
- package/src/lib/components/search/combinations/searchPopover.svelte +2 -2
- package/src/lib/vite/vite-plugin-component-source-collector.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchPopover.comp.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/search/combinations/searchPopover.comp.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { createRawSnippet } from 'svelte';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import SearchPopover from './searchPopover.svelte';
|
|
5
|
+
const selectedItem = {
|
|
6
|
+
label: 'Alpha',
|
|
7
|
+
value: 'alpha'
|
|
8
|
+
};
|
|
9
|
+
const itemSnippet = createRawSnippet((getItem) => ({
|
|
10
|
+
render: () => `<span>${getItem().label}</span>`
|
|
11
|
+
}));
|
|
12
|
+
describe('SearchPopover', () => {
|
|
13
|
+
it('applies the consumer class to the real popover trigger button', () => {
|
|
14
|
+
render(SearchPopover, {
|
|
15
|
+
props: {
|
|
16
|
+
class: 'consumer-class',
|
|
17
|
+
item: itemSnippet,
|
|
18
|
+
items: [selectedItem],
|
|
19
|
+
value: selectedItem
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const trigger = screen.getByRole('combobox');
|
|
23
|
+
expect(trigger.className).toContain('consumer-class');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
<Popover.Trigger {...restProps}>
|
|
48
48
|
{#snippet child({ props })}
|
|
49
49
|
<Button
|
|
50
|
+
{...props}
|
|
50
51
|
bind:ref={trigger}
|
|
51
52
|
variant="outline"
|
|
52
|
-
class={cn('focus-ring h-fit w-full justify-between overflow-hidden', className)}
|
|
53
|
-
{...props}
|
|
53
|
+
class={cn(props.class as string, 'focus-ring h-fit w-full justify-between overflow-hidden', className)}
|
|
54
54
|
role="combobox"
|
|
55
55
|
>
|
|
56
56
|
{#if value}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-component-source-collector.d.ts","sourceRoot":"","sources":["../../src/lib/vite/vite-plugin-component-source-collector.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAWnD,UAAU,OAAO;IACf;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAkID,wBAA8B,wBAAwB,CAAC,IAAI,GAAE,OAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"vite-plugin-component-source-collector.d.ts","sourceRoot":"","sources":["../../src/lib/vite/vite-plugin-component-source-collector.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAWnD,UAAU,OAAO;IACf;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAkID,wBAA8B,wBAAwB,CAAC,IAAI,GAAE,OAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyY5G"}
|
|
@@ -128,6 +128,8 @@ export default async function componentSourceCollector(opts = { safePackages: []
|
|
|
128
128
|
// style modules that Tailwind should never parse directly.
|
|
129
129
|
if (id.includes('?svelte&type=style'))
|
|
130
130
|
return false;
|
|
131
|
+
// TODO what about functions named eg transitionIconClass(t: number)...
|
|
132
|
+
// they dont get picked up cause no : or = after class
|
|
131
133
|
return classAttributeRegex.test(code);
|
|
132
134
|
}
|
|
133
135
|
async function normalizeCollectedSourceFilePath(file) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-ag",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Useful svelte components",
|
|
5
5
|
"bugs": "https://github.com/ageorgeh/svelte-ag/issues",
|
|
6
6
|
"author": "Alexander Hornung",
|
|
@@ -82,12 +82,14 @@
|
|
|
82
82
|
"@sveltejs/vite-plugin-svelte": "^7.1.1",
|
|
83
83
|
"@tailwindcss/typography": "^0.5.19",
|
|
84
84
|
"@tailwindcss/vite": "^4.2.4",
|
|
85
|
+
"@testing-library/svelte": "^5.3.1",
|
|
85
86
|
"@types/node": "^24.12.2",
|
|
86
87
|
"@typescript/native-preview": "7.0.0-dev.20260506.1",
|
|
87
88
|
"eslint": "^10.3.0",
|
|
88
89
|
"eslint-plugin-better-tailwindcss": "^4.5.0",
|
|
89
90
|
"eslint-plugin-svelte": "^3.17.1",
|
|
90
91
|
"globals": "^17.6.0",
|
|
92
|
+
"happy-dom": "^20.9.0",
|
|
91
93
|
"husky": "^9.1.7",
|
|
92
94
|
"lint-staged": "^17.0.2",
|
|
93
95
|
"oxfmt": "^0.51.0",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { createRawSnippet } from 'svelte';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import SearchPopover from './searchPopover.svelte';
|
|
6
|
+
|
|
7
|
+
const selectedItem = {
|
|
8
|
+
label: 'Alpha',
|
|
9
|
+
value: 'alpha'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const itemSnippet = createRawSnippet<[typeof selectedItem]>((getItem) => ({
|
|
13
|
+
render: () => `<span>${getItem().label}</span>`
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
describe('SearchPopover', () => {
|
|
17
|
+
it('applies the consumer class to the real popover trigger button', () => {
|
|
18
|
+
render(SearchPopover, {
|
|
19
|
+
props: {
|
|
20
|
+
class: 'consumer-class',
|
|
21
|
+
item: itemSnippet,
|
|
22
|
+
items: [selectedItem],
|
|
23
|
+
value: selectedItem
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const trigger = screen.getByRole('combobox');
|
|
28
|
+
|
|
29
|
+
expect(trigger.className).toContain('consumer-class');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
<Popover.Trigger {...restProps}>
|
|
48
48
|
{#snippet child({ props })}
|
|
49
49
|
<Button
|
|
50
|
+
{...props}
|
|
50
51
|
bind:ref={trigger}
|
|
51
52
|
variant="outline"
|
|
52
|
-
class={cn('focus-ring h-fit w-full justify-between overflow-hidden', className)}
|
|
53
|
-
{...props}
|
|
53
|
+
class={cn(props.class as string, 'focus-ring h-fit w-full justify-between overflow-hidden', className)}
|
|
54
54
|
role="combobox"
|
|
55
55
|
>
|
|
56
56
|
{#if value}
|
|
@@ -180,6 +180,9 @@ export default async function componentSourceCollector(opts: Options = { safePac
|
|
|
180
180
|
// a Tailwind source signal. Including those files can pull in component-local
|
|
181
181
|
// style modules that Tailwind should never parse directly.
|
|
182
182
|
if (id.includes('?svelte&type=style')) return false;
|
|
183
|
+
|
|
184
|
+
// TODO what about functions named eg transitionIconClass(t: number)...
|
|
185
|
+
// they dont get picked up cause no : or = after class
|
|
183
186
|
return classAttributeRegex.test(code);
|
|
184
187
|
}
|
|
185
188
|
|