@cypress-design/vue-icon 3.3.1 → 3.4.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.
@@ -4,7 +4,7 @@ transforming...
4
4
  ✓ 17 modules transformed.
5
5
  rendering chunks...
6
6
  computing gzip size...
7
- dist/index.es.mjs 471.78 kB │ gzip: 94.79 kB │ map: 793.97 kB
7
+ dist/index.es.mjs 478.80 kB │ gzip: 95.07 kB │ map: 803.38 kB
8
8
  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.
9
- dist/index.umd.js 433.56 kB │ gzip: 93.66 kB │ map: 776.58 kB
10
- ✓ built in 15.66s
9
+ dist/index.umd.js 434.59 kB │ gzip: 93.68 kB │ map: 783.93 kB
10
+ ✓ built in 11.61s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @cypress-design/vue-icon
2
2
 
3
+ ## 3.4.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @cypress-design/icon-registry@3.4.0
9
+
10
+ ## 3.3.2
11
+
12
+ ### Patch Changes
13
+
14
+ - [#731](https://github.com/cypress-io/cypress-design/pull/731) [`677c0c0`](https://github.com/cypress-io/cypress-design/commit/677c0c00f3ea3e37e89b38710b919bc03cabec0c) Thanks [@jennifer-shehane](https://github.com/jennifer-shehane)! - Fix tree shaking in `@cypress-design/vue-icon`: importing a single named icon (for example `IconActionPlaySmall`) now bundles about 13 KB instead of every icon plus the full icon registry (about 960 KB). Both icon packages are now marked `"sideEffects": false`. The default `Icon` component still includes every icon because it looks icons up by name at runtime, so prefer named imports.
15
+
16
+ - Updated dependencies []:
17
+ - @cypress-design/icon-registry@3.3.2
18
+
3
19
  ## 3.3.1
4
20
 
5
21
  ### Patch Changes
package/Icon.ts CHANGED
@@ -15,19 +15,22 @@ interface Props extends Pick<IconProps, 'name'>, Omit<OpenIconProps, 'name'> {
15
15
  class?: any
16
16
  }
17
17
 
18
- export default defineComponent<Props>({
18
+ // PURE so bundlers can drop this component (and the full icon set that
19
+ // compileIcon pulls in) when only the named per-icon components are used
20
+ export default /* @__PURE__ */ defineComponent<Props>({
19
21
  // the props here need to exist because of runtime treatment
20
22
  // if we don't have them explicit, vuejs will think it's attributes
21
23
  // and not pass it down as props to the components
22
24
  // but for typescript to pick up the correct prop types, we need to cast it to unknown
23
- props: [
24
- ...ICON_COLOR_PROP_NAMES,
25
+ // concat() instead of an array spread: esbuild treats a spread as a possible
26
+ // side effect and would keep this component even when it is never imported
27
+ props: /* @__PURE__ */ (ICON_COLOR_PROP_NAMES as readonly string[]).concat([
25
28
  'interactiveColorsOnGroup',
26
29
  'size',
27
30
  'name',
28
31
  'alt',
29
32
  'class',
30
- ] as unknown as undefined,
33
+ ]) as unknown as undefined,
31
34
  setup(
32
35
  // the OpenIconProps helps volar extract the documentation from the props
33
36
  // since the IconProps are more restrictive, it will not change the use behavior
package/IconVue.cy.tsx CHANGED
@@ -49,17 +49,17 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
49
49
  it('renders multiple times an icon with defs with the generic Icon component', () => {
50
50
  mount(() => (
51
51
  <div class="p-2">
52
- <Icon name="browser-webkit" class="w-16 h-16 hidden" />
53
- <Icon name="browser-webkit" class="w-16 h-16" />
52
+ <Icon name="browser-webkit" class="hidden h-16 w-16" />
53
+ <Icon name="browser-webkit" class="h-16 w-16" />
54
54
  </div>
55
55
  ))
56
56
  })
57
57
 
58
58
  it('renders multiple times an icon with defs', () => {
59
59
  mount(() => (
60
- <div class="p-2 flex">
61
- <IconBrowserWebkit class="w-16 h-16 hidden" />
62
- <IconBrowserWebkit class="w-16 h-16" />
60
+ <div class="flex p-2">
61
+ <IconBrowserWebkit class="hidden h-16 w-16" />
62
+ <IconBrowserWebkit class="h-16 w-16" />
63
63
  </div>
64
64
  ))
65
65
  })
@@ -68,9 +68,9 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
68
68
  cy.viewport(200, 100)
69
69
  const iconVisible = ref(true)
70
70
  mount(() => (
71
- <div class="p-2 flex">
72
- {iconVisible.value ? <IconBrowserWebkit class="w-16 h-16" /> : null}
73
- <IconBrowserWebkit class="w-16 h-16" />
71
+ <div class="flex p-2">
72
+ {iconVisible.value ? <IconBrowserWebkit class="h-16 w-16" /> : null}
73
+ <IconBrowserWebkit class="h-16 w-16" />
74
74
  <button onClick={() => (iconVisible.value = !iconVisible.value)}>
75
75
  toggle
76
76
  </button>
@@ -86,11 +86,11 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
86
86
  cy.viewport(200, 100)
87
87
  const iconVisible = ref(true)
88
88
  mount(() => (
89
- <div class="p-2 flex">
89
+ <div class="flex p-2">
90
90
  <IconBrowserWebkit
91
- class={`w-16 h-16 ${iconVisible.value ? '' : 'hidden'}`}
91
+ class={`h-16 w-16 ${iconVisible.value ? '' : 'hidden'}`}
92
92
  />
93
- <IconBrowserWebkit class="w-16 h-16" />
93
+ <IconBrowserWebkit class="h-16 w-16" />
94
94
  <button onClick={() => (iconVisible.value = !iconVisible.value)}>
95
95
  toggle
96
96
  </button>
@@ -104,9 +104,9 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
104
104
  cy.viewport(200, 200)
105
105
  const iconName = ref<'browser-edge' | 'browser-safari'>('browser-safari')
106
106
  mount(() => (
107
- <div class="p-2 flex flex-col h-screen items-center justify-center">
108
- <Icon name={iconName.value} class="w-16 h-16 hidden" />
109
- <Icon name={iconName.value} class="w-16 h-16" />
107
+ <div class="flex h-screen flex-col items-center justify-center p-2">
108
+ <Icon name={iconName.value} class="hidden h-16 w-16" />
109
+ <Icon name={iconName.value} class="h-16 w-16" />
110
110
  <button
111
111
  onClick={() =>
112
112
  (iconName.value =
@@ -124,14 +124,14 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
124
124
  })
125
125
 
126
126
  it('renders a title element when passed an alt prop', () => {
127
- mount(() => <IconBrowserWebkit class="w-16 h-16" alt="This is a title" />)
127
+ mount(() => <IconBrowserWebkit class="h-16 w-16" alt="This is a title" />)
128
128
 
129
129
  cy.get('svg title').should('have.text', 'This is a title')
130
130
  })
131
131
 
132
132
  it('renders class passed only once', () => {
133
- mount(() => <IconBrowserWebkit class="w-16 h-16" />)
133
+ mount(() => <IconBrowserWebkit class="h-16 w-16" />)
134
134
 
135
- cy.get('svg[width="16"]').should('have.attr', 'class', 'w-16 h-16')
135
+ cy.get('svg[width="16"]').should('have.attr', 'class', 'h-16 w-16')
136
136
  })
137
137
  })
package/ReadMe.md CHANGED
@@ -94,7 +94,7 @@ import { IconObjectBook } from '@cypress-design/vue-icon'
94
94
  </script>
95
95
 
96
96
  <template>
97
- <button class="group hover:text-jade-800 flex items-center gap-[8px]">
97
+ <button class="group flex items-center gap-[8px] hover:text-jade-800">
98
98
  <IconObjectBook
99
99
  size="16"
100
100
  strokeColor="blue-600"