Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback requested: Refactor library for Vue v3 support #2

Merged
merged 28 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d464eb2
Refactor library for Vue v3 support
brlodi Nov 16, 2020
0fd5a8e
Oops: actually run Prettier on output files
brlodi Nov 16, 2020
a465c4d
example: show pointer cursor on interactable icons
rektdeckard Nov 18, 2020
79d8583
bin: add <slot> to icons to allow extension of SVGs
rektdeckard Nov 18, 2020
e50ccc3
example: demo <slot> feature by animating and adding elements to icon
rektdeckard Nov 18, 2020
a873c90
Refactor components to Composition API
brlodi Nov 19, 2020
e89a590
Explicitly type icon components (finally!)
brlodi Nov 19, 2020
c82ff93
example: more <slot> demos
rektdeckard Nov 19, 2020
4242f47
meta: bump to v1.0.1
rektdeckard Nov 19, 2020
6550b5b
README: document <slot> behavior and add example
rektdeckard Nov 19, 2020
024aa7d
README: fix example typo
rektdeckard Nov 19, 2020
a0ba386
README: fix example type (again)
rektdeckard Nov 19, 2020
ffa69c1
Make build not error out
brlodi Nov 20, 2020
a30f3a2
example: better demo <slot> mechanism
rektdeckard Nov 22, 2020
c4b808f
lib: bump to v1.0.2
rektdeckard Nov 22, 2020
1ef1c0f
README: switch to kebab-case for examples
rektdeckard Nov 24, 2020
739b691
example: update to use kebab-case
rektdeckard Nov 24, 2020
23ca61c
icons+meta: update assets and components to v1.1.0
rektdeckard Nov 24, 2020
88242aa
icons+meta: fix CloudMoon missing weights and bump to v1.1.1
rektdeckard Nov 25, 2020
f63f18c
icons+meta: update assets and components to v1.1.2
rektdeckard Nov 26, 2020
462242b
Pin Vue at 3.0.2 to avoid bug in 3.0.3
brlodi Nov 30, 2020
4bcfc45
Add prettier to dev dependencies
brlodi Nov 30, 2020
bdc6a18
Restore type check to example app
brlodi Nov 30, 2020
c056172
Prettier run
brlodi Nov 30, 2020
d624b83
Auto-generate library .d.ts file with assemble.js
brlodi Nov 30, 2020
003743c
Prettier and VSCode have a fight over quote style
brlodi Dec 1, 2020
53c10fd
Enable tree-shaking (really it was this easy?!)
brlodi Dec 1, 2020
6c808b6
Merge branch 'master' into vue3
brlodi Dec 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ npm install --save phosphor-vue
```html
<template>
<div>
<PhHorse />
<PhHeart :size="32" color="hotpink" weight="fill" />
<PhCube />
<ph-horse />
<ph-heart :size="32" color="hotpink" weight="fill" />
<ph-cube />
</div>
</template>

Expand Down Expand Up @@ -63,9 +63,9 @@ Phosphor takes advantage of Vue's `provide`/`inject` options to make applying a
```html
<template>
<div>
<PhHorse /> {/* I'm lime-green, 32px, and bold! */}
<PhHeart /> {/* Me too! */}
<PhCube /> {/* Me three :) */}
<ph-horse /> {/* I'm lime-green, 32px, and bold! */}
<ph-heart /> {/* Me too! */}
<ph-cube /> {/* Me three :) */}
</div>
</template>

Expand Down Expand Up @@ -94,6 +94,38 @@ You may create multiple providers for styling icons differently in separate regi

> The `provide` and `inject` bindings are NOT reactive. This is intentional. However, if you pass down an observed object, properties on that object do remain reactive.

### Slots

<img src="/meta/cube-rotate.svg" width="128" align="right" />

Components have a `<slot>` for arbitrary SVG elements, so long as they are valid children of the `<svg>` element. This can be used to modify an icon with background layers or shapes, filters, animations and more. The slotted children will be placed *below* the normal icon contents.

The following will cause the Cube icon to rotate and pulse:

```html
<template>
<ph-cube color="darkorchid" weight="duotone">
<animate
attributeName="opacity"
values="0;1;0"
dur="4s"
repeatCount="indefinite"
/>
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="5s"
from="0 0 0"
to="360 0 0"
repeatCount="indefinite"
/>
</ph-cube>
</template>
```

**Note:** The coordinate space of slotted elements is relative to the contents of the icon `viewBox`, which is a 256x256 square. Only [valid SVG elements](https://developer.mozilla.org/en-US/docs/Web/SVG/Element#SVG_elements_by_category) will be rendered.

## Related Projects

- [phosphor-react](https://github.com/phosphor-icons/phosphor-react) ▲ Phosphor icon component library for React
Expand Down
5 changes: 5 additions & 0 deletions assets/airplane-in-flight/airplane-in-flight-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/airplane-in-flight/airplane-in-flight-duotone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/airplane-in-flight/airplane-in-flight-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-in-flight/airplane-in-flight-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-in-flight/airplane-in-flight-thin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-in-flight/airplane-in-flight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-landing/airplane-landing-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/airplane-landing/airplane-landing-duotone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/airplane-landing/airplane-landing-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-landing/airplane-landing-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-landing/airplane-landing-thin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-landing/airplane-landing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-takeoff/airplane-takeoff-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/airplane-takeoff/airplane-takeoff-duotone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/airplane-takeoff/airplane-takeoff-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-takeoff/airplane-takeoff-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-takeoff/airplane-takeoff-thin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/airplane-takeoff/airplane-takeoff.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/airplay/airplay-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions assets/alarm/alarm-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/align-bottom/align-bottom-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/align-bottom/align-bottom-duotone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/align-bottom/align-bottom-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/align-bottom/align-bottom-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/align-bottom/align-bottom-thin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/align-bottom/align-bottom.svg
Loading