Giter VIP home page Giter VIP logo

vue's Introduction

ATTENTION: As part of a major update, we will be replacing the existing phosphor-icons package with @phosphor-icons/web. We recommend using the new version, as it has improved performance and significantly smaller bundle size, in addition to having the option to only load the weights you need. Some class names and APIs have changed, so please read the documentation before upgrading. The legacy package will continue to recieve maintenance, but will not be updated with new icons upstream. Take me to the legacy version ➜

@phosphor-icons/web

Phosphor is a flexible icon family for interfaces, diagrams, presentations — whatever, really. Explore all our icons at phosphoricons.com.

NPM Travis

GitHub stars GitHub forks GitHub watchers Follow on GitHub

Usage

Getting Started

We use a similar approach as many other icon sets out there, providing icons as several webfonts that uses Unicode's Private Use Area character codes to map normally non-rendering characters to icons. Simply add one or more weights by including its stylesheet to the document <head>, and drop in icons with an <i> tag and the appropriate classes for the weight and the icon:

<!DOCTYPE html>
<html>
  <head>
    <link
      rel="stylesheet"
      type="text/css"
      href="https://unpkg.com/@phosphor-icons/[email protected]/src/bold/style.css"
    />
  </head>
  <body>
    <i class="ph-bold ph-smiley"></i>
    <i class="ph-bold ph-heart" style="color: hotpink"></i>
    <i class="ph-bold ph-cube"></i>
  </body>
</html>

Note: You can import as many or as few weights as needed. Only imported weights will match and render as icons.

Weights

Phosphor Icons come in 6 weights: regular, thin, light, bold, fill, and duotone. In order to use a weight, you must include a link to its stylesheet, and use the appropriate weight class on the icon (the regular weight uses .ph instead of .ph-regular):

<link
  rel="stylesheet"
  type="text/css"
  href="https://unpkg.com/@phosphor-icons/[email protected]/src/duotone/style.css"
/>
...
<i class="ph-duotone ph-baseball"></i>

The URL format is https://unpkg.com/@phosphor-icons/web@<VERSION>/src/<WEIGHT>/style.css. Other common CDNs may also be used.

Using All Weights

If you intend to use all 6 weights, they can be made available by including the library as a script tag, using the base URL:

<script src="https://unpkg.com/@phosphor-icons/[email protected]"></script>
...
<i class="ph-light ph-address-book"></i>
<i class="ph ph-sunglasses"></i>

NOTE: Though assets will be cached for subsequent loads, this will bring in around 3MB of fonts and CSS, and may have impact on page load speed.

Modules

If your environment supports loading CSS files as modules, icon weights can be imported for effect from the package.

$ yarn add @phosphor-icons/web
import "@phosphor-icons/web/light";
import "@phosphor-icons/web/bold";

Styling

Since the icons are just text under the hood, they can be colored and styled with CSS like any other font, including font-size, color, etc.

<style>
  .ph-bold {
    font-size: 48px;
  }

  .green {
    color: limegreen;
  }
</style>
...
<!-- 96px -->
<i class="ph-bold ph-airplane"></i>
<!-- 96px and green -->
<i class="ph-bold ph-skull green"></i>

Note: Overriding the font-family, font-style, font-weight, font-variant, or text-transform may break the icons and render unprintable characters. Don't do it. Additionally, all weights use the :before pseudoelement to inject the font glyph, so overriding this property in icon classes can break them. The duotone weight also uses the :after pseudoelement, so it is best not to modify either when styling icons.

Our Related Projects

Community Projects

If you've made a port of Phosphor and you want to see it here, just open a PR here!

License

MIT © Phosphor Icons

vue's People

Contributors

dnlsndr avatar hypernova7 avatar maful avatar rektdeckard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vue's Issues

Module not found: Error: Default condition should be last one

📚 What are you trying to do?

import { PhCircle,PhTextAa,PhEyeSlash } from "@phosphor-icons/vue";

this line makes me below error. Does not understand what is issue. I have other appas well and all working fine.

Module not found: Error: Default condition should be last one

ERROR in ./src/Student/components/CustomElements/PIcons.vue?vue&type=script&setup=true&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/Student/components/CustomElements/PIcons.vue?vue&type=script&setup=true&lang=js) 3:0-2137
Module not found: Error: Default condition should be last one
 @ ./src/Student/components/CustomElements/PIcons.vue?vue&type=script&setup=true&lang=js 1:0-221 1:0-221 1:222-432 1:222-432
 @ ./src/Student/components/CustomElements/PIcons.vue 2:0-68 3:0-63 3:0-63 6:49-55
 @ ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/Student/StudentData.vue?vue&type=script&setup=true&lang=js 8:0-60 106:14-20
 @ ./src/Student/StudentData.vue?vue&type=script&setup=true&lang=js 1:0-214 1:0-214 1:215-418 1:215-418
 @ ./src/Student/StudentData.vue 2:0-73 3:0-68 3:0-68 6:49-55
 @ ./src/router/routes.js 265:15-51
 @ ./src/main.js 12:0-40 113:8-14

🔍 What have you tried?

Tryed reeinstall phosphor with npm , other versions start again and so on. I came from vue 2 to vue 3 and this problem comes.

ℹ️ Additional context

No response

Webpack error stating no appropriate loaders

Hey there!
I currently use Phosphor Icons for my Nuxt.js website, however I've been receiving this error when trying to load my site:

 ERROR  in ./node_modules/phosphor-vue/dist/phosphor-vue.esm.js                                                                       friendly-errors 12:24:55

Module parse failed: Unexpected token (40:21)                                                                                         friendly-errors 12:24:55
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|         contextWeight
|       } = this;
>       return weight ?? contextWeight;
|     },
| 

It's failing to compile. I've tried uninstalling and re-installing using npm install --save phosphor-vue. I've also tried looking for a solution online, and can't seem to find anything that could point me in the right direction.
Curious if anyone else has experienced this, and knows how to solve it? It's quite cumbersome.

'/@modules/vue.js' does not provide an export named 'default' when using vitejs

I am trying to use phosphor-vue in a project that is set up with vitejs.

I tried to

//vite.config.js
optimizeDeps: {
    exclude: ['dayjs', 'phosphor-vue']
  }

But I am still getting this.

Uncaught SyntaxError: The requested module '/@modules/vue.js' does not provide an export named 'default'

procedure I followed.

npm init vite-app myapp

npm install phosphor-vue

In my template

//app.vue
<template>
  <div>
    <PhHorse />
    <PhHeart :size="32" color="hotpink" weight="fill" />
    <PhCube />
  </div>
</template>

<script>
  import { PhHorse, PhHeart, PhCube } from "phosphor-vue";
  export default {
    name: "App",
    components: {
      PhHorse,
      PhHeart,
      PhCube
    }
  };
</script>

Imported components used with `<component :is="">` ignored in production

I'm using a custom component to render all my icons:

<template>
  <component :is="name" :weight="weight" />
</template>

<script lang="ts">
import { defineComponent } from 'vue'

import {
  PhCaretUp as Up,
} from 'phosphor-vue'

export default defineComponent({
  name: 'Icon',
  props: {
    name: { type: String, required: true },
    weight: { default: 'regular' },
  },
  components: {
    Up,
  },
})
</script>

It's all fine in development, but the production bundle ignores all icons. I've just switched from another icon pack that does not cause this (but the bundle size is huge) and right now this problem is pretty annoying.

I've also tried registering the global component in main.ts, to no avail.

Any suggestions are welcome.

@vue/cli-service: Cannot find module '@/lib/types'

When I try to use phosphor-vue with @vue/cli-service I get the error Cannot find module @/lib/types. To avoid that error, I had to copy the file phosphor-vue/src/lib/types.ts locally. Because in @vue/cli-service the alias @ only points to the local directory src

`@phosphor-icons/vue/compact` significantly increases the build time

🐛 The bug

Compact bundle significantly increases the build time. That being said, the import cost for the bundle is 3.8M:

Import cost

As mentioned in v2.1.4 changelog compact scope bundles all files in a single file aiming to fix the EMFILE error.

Is there any other way of avoiding Error: EMFILE: too many open files... error as in #35 besides using compact scope?

🛠️ To reproduce

Build screenshot

🌈 Expected behaviour

A proposed solution would be exporting per-file icons as in:

import PhHouse from "@phosphor-icons/vue/icons/PhHouse.vue"

ℹ️ Additional context

No response

TypeScript errors: "no exported member..."

Hello,

we've got some type errors while importing single icons in vue/nuxt with typescript.
The import looks like this:

<script lang="ts">
import { PhXCircle, PhCalendarBlank, PhClock } from 'phosphor-vue'

And the error in VS Code is:

Module '"phosphor-vue"' has no exported member 'PhXCircle'. Did you mean to use 'import PhXCircle from "phosphor-vue"' instead?ts(2614)

But the result works, with this error?

I found this import statement which i never saw like this before.
https://github.com/phosphor-icons/phosphor-vue/blob/4f28cd2e29ca8350b7a0283e241dac5546a8c631/phosphor-vue.d.ts#L3
I guess what i should do, is to pass the exported components from index.ts through the phoshor.d.ts, but this seems not to be valid in TypeScript.

Global import broken

🐛 The bug

With the previous version phosphor-vue, global import was possible using

import { createApp } from 'vue'
import PhosphorVue from 'phosphor-vue'

const app = createApp(App)
app
  .use(PhosphorVue)

app.mount('#app')

With the new version, this is not possible anymore.

🛠️ To reproduce

https://stackblitz.com/edit/vue-dniokx?file=src/main.js

🌈 Expected behaviour

that switching to the new package works straightforward (just like written in the README.md)

ℹ️ Additional context

No response

Ability to use icons via Name parameter

We want to save the icon names as strings in our db, then use them via a name option, this is not currently possible via importing each icon seperatly.

E.g.

Is this something that could be implemented?

npm ERR! Could not resolve dependency in Quasar vue

DESCRIPTION

Hi, I just wanted to use phosphor vue for my quasar vue application.
But when I run npm install --save phosphor-vue@next, it gets an error like below.
Does anyone know why? Is it because it doesn't support quasar vue or what? Thankyou.

ERROR LOG

$ npm install phosphor-vue@next
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR! peer vue@"^3.2.29" from @quasar/[email protected]
npm ERR! node_modules/@quasar/app
npm ERR! dev @quasar/app@"^3.0.0" from the root project
npm ERR! peer vue@"3.2.37" from @vue/[email protected]
npm ERR! node_modules/@vue/server-renderer
npm ERR! @vue/server-renderer@"3.2.37" from [email protected]
npm ERR! 9 more (emoji-mart-vue-fast, v-money3, vue-gtag, vue-i18n, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! phosphor-vue@"4.4.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR! peer vue@"^3.0.0 <3.0.3" from [email protected]
npm ERR! node_modules/phosphor-vue
npm ERR! phosphor-vue@"4.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\ASUS\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Local\npm-cache_logs\2022-07-15T02_44_38_791Z-debug-0.log

Icons not tree-shakable by other bundlers

Don't know where the other issue went, so I'll create a new one to keep track of this.

It seems that with the current configuration of Rollup, it's not possible to tree shake unused icons when using this library with other bundlers such as Webpack.

"Error: EMFILE: too many open files... " when deploying Nuxt 3 app with Phosphor Icons to Netlify

🐛 The bug

When I deploy my Nuxt 3 app which uses the @phosphor-icons/vue package to Netlify, the deployment is successful but when I visit the site, initially, I get an error:

image

After some time, when I revisit the site, I get this error:

image

It works okay in development and I've also tried building the app locally, Nuxt uses the "node-server" option and that works fine.

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-tfqdxc?file=app.vue

🌈 Expected behaviour

The Icons should be displayed in production when deployed to Netlify and not crash the entire app.

ℹ️ Additional context

No response

Export PhosphorIcon type

Hi, I'd like to ensure a PhosphorIcon is being passed as a prop, but unfortunately this type isn't exported by phosphor-vue.

What I'd like to do is this:

const props = defineProps<{
  label: string;
  icon: PhosphorIcon;
}>();

And then render with something like this:

    <component
      :is="icon"
      :size="20"
      :width="20"
      :weight="isActive ? 'fill' : 'regular'"
    />

Would exporting the PhosphorIcon type make sense?

Production build imports all icons !

i am only loading the following

import {
  PhLockKeyOpen,
  PhUser,
  PhSun,
  PhMoon,
  PhPlayCircle,
  PhImage,
} from 'phosphor-vue'

import Vue from 'vue'

Vue.component('PhLockKeyOpen', PhLockKeyOpen)
Vue.component('PhUser', PhUser)
Vue.component('PhSun', PhSun)
Vue.component('PhMoon', PhMoon)
Vue.component('PhPlay', PhPlayCircle)
Vue.component('PhImage', PhImage)

the build result creates big javascript file

Code_q7Olh5tvui
msedge_MRLBAUkRV0

Update peer dependency version

Hello! Thank you for the nice icons.

I have switched to npm 7 and it installs peer dependencies by default. So when I updated Vue to 3.0.11 I got a conflict with phosphor-vue's peer dependencies:

  "peerDependencies": {
    "vue": "^3.0.0 <3.0.3"
  },

Could you, please, change it to ^3.0.0 and make a new patch release?
Right now I can run npm install only with --legacy-peer-deps (when there is no package-lock.json).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.