@cypress-design/vue-icon 0.23.1 → 0.24.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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +20 -0
- package/Icon.ts +66 -15
- package/IconVue.cy.tsx +83 -1
- package/_TreeShakableIcons.ts +4964 -5144
- package/compileProperties.ts +124 -40
- package/dist/Icon.d.ts +3 -4
- package/dist/Icon.d.ts.map +1 -1
- package/dist/_TreeShakableIcons.d.ts +663 -661
- package/dist/_TreeShakableIcons.d.ts.map +1 -1
- package/dist/compileProperties.d.ts +403 -385
- package/dist/compileProperties.d.ts.map +1 -1
- package/dist/index.es.mjs +3718 -3856
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/generate-icons.js +87 -22
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,14 +2,14 @@ $ yarn build:codegen && yarn build:module && yarn build:types
|
|
|
2
2
|
$ node ./generate-icons.js
|
|
3
3
|
$ yarn vite build
|
|
4
4
|
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
|
|
5
|
-
[36mvite v4.
|
|
5
|
+
[36mvite v4.4.4 [32mbuilding for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
7
|
[32m✓[39m 4 modules transformed.
|
|
8
8
|
rendering chunks...
|
|
9
9
|
computing gzip size...
|
|
10
|
-
[2mdist/[22m[36mindex.es.mjs [39m[1m[
|
|
10
|
+
[2mdist/[22m[36mindex.es.mjs [39m[1m[2m263.56 kB[22m[1m[22m[2m │ gzip: 51.64 kB[22m[2m │ map: 444.62 kB[22m
|
|
11
11
|
Entry module "index.ts" is using named and default exports together. Consumers of your bundle will have to use `Icon.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
|
|
12
|
-
[2mdist/[22m[36mindex.umd.js [39m[1m[
|
|
13
|
-
[32m✓ built in
|
|
12
|
+
[2mdist/[22m[36mindex.umd.js [39m[1m[2m228.88 kB[22m[1m[22m[2m │ gzip: 51.08 kB[22m[2m │ map: 432.39 kB[22m
|
|
13
|
+
[32m✓ built in 6.64s[39m
|
|
14
14
|
$ yarn tsc --project ./tsconfig.build.json
|
|
15
15
|
$ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @cypress-design/vue-icon
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#280](https://github.com/cypress-io/cypress-design/pull/280) [`e390827`](https://github.com/cypress-io/cypress-design/commit/e3908270ece513886c64cebcb78cebe0cd0d8c3d) Thanks [@dkasper-was-taken](https://github.com/dkasper-was-taken)! - adding icon for test replay initiative
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`e390827`](https://github.com/cypress-io/cypress-design/commit/e3908270ece513886c64cebcb78cebe0cd0d8c3d)]:
|
|
12
|
+
- @cypress-design/icon-registry@0.25.0
|
|
13
|
+
|
|
14
|
+
## 0.23.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#234](https://github.com/cypress-io/cypress-design/pull/234) [`ff95963`](https://github.com/cypress-io/cypress-design/commit/ff95963feb7ae5d9eb01e6122e5e411517f105b9) Thanks [@elevatebart](https://github.com/elevatebart)! - allow to use a gradient icon more than once
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`ff95963`](https://github.com/cypress-io/cypress-design/commit/ff95963feb7ae5d9eb01e6122e5e411517f105b9)]:
|
|
21
|
+
- @cypress-design/icon-registry@0.24.1
|
|
22
|
+
|
|
3
23
|
## 0.23.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/Icon.ts
CHANGED
|
@@ -1,18 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ICON_COLOR_PROP_NAMES,
|
|
3
|
+
compileIcon,
|
|
4
|
+
} from '@cypress-design/icon-registry'
|
|
2
5
|
import type { OpenIconProps, IconProps } from '@cypress-design/icon-registry'
|
|
3
|
-
import { h } from 'vue'
|
|
6
|
+
import { h, computed, defineComponent } from 'vue'
|
|
4
7
|
import type { SVGAttributes } from 'vue'
|
|
5
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
compileVueIconProperties,
|
|
10
|
+
useShouldRenderDefs,
|
|
11
|
+
} from './compileProperties'
|
|
6
12
|
|
|
7
|
-
export default (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
export default defineComponent(
|
|
14
|
+
(
|
|
15
|
+
// the OpenIconProps helps volar extract the documentation from the props
|
|
16
|
+
// since the IconProps are more restrictive, it will not change the use behavior
|
|
17
|
+
props: OpenIconProps & Pick<IconProps, 'name'> & { class?: string },
|
|
18
|
+
{ attrs }: { attrs: Omit<SVGAttributes, 'name' | 'class'> }
|
|
19
|
+
) => {
|
|
20
|
+
const ret = computed(() => {
|
|
21
|
+
const { class: className, ...otherProps } = props
|
|
22
|
+
const iconProps = compileIcon(otherProps)
|
|
23
|
+
return { className, iconProps }
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const { componentProps, defs } = compileVueIconProperties(
|
|
27
|
+
computed(() => ret.value.iconProps)
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const { shouldRenderDefs } = useShouldRenderDefs(props.name, defs)
|
|
31
|
+
|
|
32
|
+
return () => {
|
|
33
|
+
return shouldRenderDefs.value
|
|
34
|
+
? [
|
|
35
|
+
h('svg', {
|
|
36
|
+
innerHTML: defs.value,
|
|
37
|
+
'data-cy-icon-unified-defs': props.name,
|
|
38
|
+
class: [
|
|
39
|
+
'w-0',
|
|
40
|
+
'h-0',
|
|
41
|
+
'absolute',
|
|
42
|
+
'pointer-events-none',
|
|
43
|
+
'opacity-0',
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
h('svg', {
|
|
47
|
+
...attrs,
|
|
48
|
+
...componentProps.value,
|
|
49
|
+
class: [ret.value.className, componentProps.value.class],
|
|
50
|
+
}),
|
|
51
|
+
]
|
|
52
|
+
: h('svg', {
|
|
53
|
+
...attrs,
|
|
54
|
+
...componentProps.value,
|
|
55
|
+
class: [ret.value.className, componentProps.value.class],
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
// @ts-expect-error - vue types need an update
|
|
61
|
+
props: [
|
|
62
|
+
...ICON_COLOR_PROP_NAMES,
|
|
63
|
+
'interactiveColorsOnGroup',
|
|
64
|
+
'size',
|
|
65
|
+
'name',
|
|
66
|
+
'class',
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
)
|
package/IconVue.cy.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
1
2
|
import assertions from '../assertions'
|
|
2
|
-
import Icon, {
|
|
3
|
+
import Icon, {
|
|
4
|
+
IconDocumentBlank,
|
|
5
|
+
IconObjectBookCode,
|
|
6
|
+
IconBrowserWebkit,
|
|
7
|
+
} from './index'
|
|
3
8
|
import { mount } from 'cypress/vue'
|
|
4
9
|
|
|
5
10
|
describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
|
|
@@ -20,4 +25,81 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
|
|
|
20
25
|
}
|
|
21
26
|
mount(() => <IconDocumentBlank {...props} />)
|
|
22
27
|
})
|
|
28
|
+
|
|
29
|
+
it('renders multiple times an icon with defs with the Icon comp', () => {
|
|
30
|
+
mount(() => (
|
|
31
|
+
<div class="p-2">
|
|
32
|
+
<Icon name="browser-webkit" class="w-16 h-16 hidden" />
|
|
33
|
+
<Icon name="browser-webkit" class="w-16 h-16" />
|
|
34
|
+
</div>
|
|
35
|
+
))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('renders multiple times an icon with defs', () => {
|
|
39
|
+
mount(() => (
|
|
40
|
+
<div class="p-2 flex">
|
|
41
|
+
<IconBrowserWebkit class="w-16 h-16 hidden" />
|
|
42
|
+
<IconBrowserWebkit class="w-16 h-16" />
|
|
43
|
+
</div>
|
|
44
|
+
))
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('when an icon is unmounted later', () => {
|
|
48
|
+
cy.viewport(200, 100)
|
|
49
|
+
const iconVisible = ref(true)
|
|
50
|
+
mount(() => (
|
|
51
|
+
<div class="p-2 flex">
|
|
52
|
+
{iconVisible.value ? <IconBrowserWebkit class="w-16 h-16" /> : null}
|
|
53
|
+
<IconBrowserWebkit class="w-16 h-16" />
|
|
54
|
+
<button onClick={() => (iconVisible.value = !iconVisible.value)}>
|
|
55
|
+
toggle
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
))
|
|
59
|
+
|
|
60
|
+
cy.get('button').click()
|
|
61
|
+
// the svg defs should have been transferred to the end of the body
|
|
62
|
+
cy.get('svg').should('have.length', 2)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('when an icon is hidden later', () => {
|
|
66
|
+
cy.viewport(200, 100)
|
|
67
|
+
const iconVisible = ref(true)
|
|
68
|
+
mount(() => (
|
|
69
|
+
<div class="p-2 flex">
|
|
70
|
+
<IconBrowserWebkit
|
|
71
|
+
class={`w-16 h-16 ${iconVisible.value ? '' : 'hidden'}`}
|
|
72
|
+
/>
|
|
73
|
+
<IconBrowserWebkit class="w-16 h-16" />
|
|
74
|
+
<button onClick={() => (iconVisible.value = !iconVisible.value)}>
|
|
75
|
+
toggle
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
78
|
+
))
|
|
79
|
+
|
|
80
|
+
cy.get('button').click()
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('renders multiple times an icon with defs with the Icon comp', () => {
|
|
84
|
+
cy.viewport(200, 200)
|
|
85
|
+
const iconName = ref<'browser-webkit' | 'browser-safari'>('browser-safari')
|
|
86
|
+
mount(() => (
|
|
87
|
+
<div class="p-2 flex flex-col h-screen items-center justify-center">
|
|
88
|
+
<Icon name={iconName.value} class="w-16 h-16 hidden" />
|
|
89
|
+
<Icon name={iconName.value} class="w-16 h-16" />
|
|
90
|
+
<button
|
|
91
|
+
onClick={() =>
|
|
92
|
+
(iconName.value =
|
|
93
|
+
iconName.value === 'browser-webkit'
|
|
94
|
+
? 'browser-safari'
|
|
95
|
+
: 'browser-webkit')
|
|
96
|
+
}
|
|
97
|
+
>
|
|
98
|
+
toggle
|
|
99
|
+
</button>
|
|
100
|
+
</div>
|
|
101
|
+
))
|
|
102
|
+
|
|
103
|
+
cy.get('button').click()
|
|
104
|
+
})
|
|
23
105
|
})
|