GithubHelp home page GithubHelp logo

c0bra / svelma Goto Github PK

View Code? Open in Web Editor NEW
535.0 11.0 44.0 1.99 MB

Bulma components for Svelte

Home Page: https://c0bra.github.io/svelma

License: MIT License

JavaScript 9.32% CSS 1.30% HTML 88.71% Shell 0.66%
svelte sveltejs svelte-components bulma svelte3

svelma's Introduction

Svelma

Svelma is a set of UI components for Svelte based on the Bulma CSS framework.

Change Log

Documentation

See docs + demos site here

Quick Start

1. Import svelma and dependencies via npm to your project

$ npm install --save bulma svelma
$ npm install node-sass svelte-preprocess rollup-plugin-postcss --save-dev

2. Add the postcss plugin to your rollup config

// rollup.config.js
import postcss from 'rollup-plugin-postcss'
import preprocess from 'svelte-preprocess'

// ...

export default {
  // ...
  plugins: [
    svelte({
      // ...
      preprocess: preprocess()
    }),

    postcss(),
  ]
}

3. Import Bulma's CSS and Svelma components

<!-- App.svelte -->
<script>
  import 'bulma/css/bulma.css'
  import { Button } from 'svelma'
</script>

<Button type="is-primary">I'm a Button!</Button>

4. Include Font Awesome icons

From CDN in your HTML page:

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" />

Or as an npm package imported into your root component:

$ npm install --save @fortawesome/fontawesome-free

<!-- App.svelte -->
<script>
  import 'bulma/css/bulma.css'
  import '@fortawesome/fontawesome-free/css/all.css'
</script>

SSR

If you are doing server-side rendering with Sapper (or SvelteKit), you'll need to import the .svelte files directly so that your app can compile them, rather than importing from the compiled module.

i.e.:

import Button from 'svelma/src/components/Button.svelte'

instead of

import { Button } from 'svelma'

Inspiration

Much thanks to the Buefy and Svelma2 projects! It provided the inspiration and lots of code examples for this version of Svelma.

svelma's People

Contributors

abbychau avatar alexander-mart avatar benwoodward avatar bmaupin avatar bradyjoslin avatar c0bra avatar chrish-21 avatar dependabot[bot] avatar dritter avatar featherbear avatar gcollard avatar jsfenfen avatar kroshilin avatar riverinyo avatar saravanabalagi avatar shivchawla avatar tiberiuc avatar wigguno 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  avatar  avatar  avatar  avatar  avatar  avatar

svelma's Issues

How to style components?

@c0bra In the docs, there is currently no mention of how to go about applying custom styling and theming to svelma components

We need this

If you give up again I swear to god I will hunt you down

Progress value is not updated: Progress always stays indeterminate

<Progress type="is-primary" value="65" max="100"></Progress>

translates to

<progress class="progress is-primary" max="100">60%</progress>

This is equivalent to setting no value attribute but with a child text node containing some text, as shown in bulma indeterminate section. Hence it displays an indeterminate progress bar with no value set even when I pass in a value attribute to the Progress svelma component.

This can be confirmed when you remove the child text node manually (using browser's debugging tools), the progress bar still displays the value.

image
image

But the same is not valid when you remove the value attribute and keep the child text node

image
image

Input outer div class is hardcoded 'control'

<Input class="is-expanded" type="text" bind:value={path}/>

setting Input class to is-expanded is passed to input, but as outer div is just 'control' it will not be expanded

<div class="control svelte-1v5s752">
   <input type="text" class="input is-expanded svelte-1v5s752" >  
</div>

<div class="control" class:has-icons-right={hasIconRight} class:is-loading={loading}>

maybe someting like this ..

<div class="control {$$props.class || ''}" class:has-icons-right={hasIconRight} class:is-loading={loading}>

Following the installation guide for Rollup bundler, after installing the required npm packages, when postcss() is added to rollup.config.js the following error occurs.

[!] (plugin svelte) ParseError: Identifier is expected
node_modules\svelma\src\components\Field.svelte
95: <style lang="scss">
96: .field {
97: &.is-grouped {
^
98: .field {
99: flex-shrink: 0;
ParseError: Identifier is expected
at error (C:\dev\svelte1\node_modules\svelte\src\compiler\utils\error.ts:25:16)
at Parser$1.error (C:\dev\svelte1\node_modules\svelte\src\compiler\parse\index.ts:100:3)
at Object.read_style [as read] (C:\dev\svelte1\node_modules\svelte\src\compiler\parse\read\style.ts:21:11)
at tag (C:\dev\svelte1\node_modules\svelte\src\compiler\parse\state\tag.ts:203:27)
at new Parser$1 (C:\dev\svelte1\node_modules\svelte\src\compiler\parse\index.ts:52:12)
at parse (C:\dev\svelte1\node_modules\svelte\src\compiler\parse\index.ts:216:17)
at compile (C:\dev\svelte1\node_modules\svelte\src\compiler\compile\index.ts:79:14)
at Object.transform (C:\dev\svelte1\node_modules\rollup-plugin-svelte\index.js:105:21)
at C:\dev\svelte1\node_modules\rollup\dist\shared\rollup.js:18765:25

Support req

From the Dialogs doc:
if I want to use Dialogs I need to import { Button, Dialog } from 'svelma'
But I need to use SSR,
from the npm page:

If you are doing server-side rendering with Sapper, you'll need to import the .svelte files directly so that your app can compile them, rather than importing from the compiled module.

So how should my import line read in order to be able to use Dialog the SSR way?

Wrong guide

I tried to build basic project by guides on github, and still #20

Modal toggle not working properly

Link: https://c0bra.github.io/svelma/components/modal

Steps to reproduce:

  1. Click Toggle
  2. Close Modal by any way (x button, click to black bg, etc)
  3. Click to Toggle again
  4. See DevTools.

You will see log similar or exactly like this

Modal.svelte:18 Uncaught (in promise) TypeError: Cannot read property 'removeChild' of null
    at Object.e.$$.update (Modal.svelte:18)
    at gt (index.mjs:617)
    at mt (index.mjs:593)

Nested components transition bug

Found some strange behaviour, most probably this is a bug. Not sure how to explain it correctly, so will better provide an example. Here is link to repository - https://github.com/kroshilin/svelma-transition-bug

npm i 
npm run dev

Press "Toggle" button on web page and try to close modal window. Modal is not closed, and there is an error in console.

Uncaught (in promise) TypeError: Cannot read property 'c' of undefined
    at transition_out (index.mjs:676)
    at Object.outro [as o] (module.js:2)
    at ve (module.js:1)
    at Object.o (module.js:1)
    at ve (module.js:1)
    at Object.p (module.js:1)
    at re (module.js:1)
    at le (module.js:1)

It seems that bug takes place when I try to place one components inside other and then remove parent component from DOM.
Deeper investigation led me to svelma/dist/index.js:420

function transition_out(block, local, detach, callback) {
       if (block && block.o) {
           if (outroing.has(block))
               return;
           outroing.add(block);
           outros.c.push(() => {
               outroing.delete(block);
               if (callback) {
                   if (detach)
                       block.d(1);
                   callback();
               }
           });
           block.o(local);
       }
   }

This code seems to be generated by svelte. If i add if (outros) - it fixes the issue.

Button issue - le is undefined when links followed

Hello,

Summary

I am using svelma and svelte-spa-router for a project and I am having an issue where having a svelma button on a page will cause the page to error when links are followed.

POC

Here is an example project that reproduces the issue: https://github.com/rohfle/svelma-button-issue-poc

Details

When I import using import { Button } from 'svelma', I get the following error when I click a link to take me to another page:

TypeError: le is undefined [module.js:1:4169]

console.log(Button) gives me:
image

When I import using import Button from 'svelma/src/components/Button.svelte', I get no error and console.log(Button) gives me:
image

Add ability to dynamically control tabs

It would be nice if we could separate the tabs and the main content. for example, I want to put the tabs in a fixed-position header:

<script>
  let activeTab = 0;
  function handleTabSwitch(event) {
    activeTab = event.detail.index;
  }
</script>
<header class="site-fixed-header">
  <Tabs on:switch={handleTabSwitch}>
    <Tab label="first tab" /> <!-- activeTab = 0 -->
    <Tab label="second tab" /> <!-- activeTab = 1 -->
  </Tabs>
</header>
<main>
  {#if activeTab === 0}
    first tab
  {:else}
    second tab
  {/if}
</main>

Field - Cannot read property 'children' of undefined

I think this will happen even with other components, but it is Field (line 70) that I tried to use now. Error occurs by just having the component on the page.
The error stopped the svelte-router from working properly!

Uncaught (in promise) TypeError: Cannot read property 'children' of undefined

  $: {
    if (grouped) fieldType = 'is-grouped'
    else if (mounted) {
      const childNodes = Array.prototype.filter.call(**el.children**, c => !([labelEl, messageEl].includes(c)))
      if (childNodes.length > 1 && addons) {
        fieldType = 'has-addons'
      }
    }
  }

Example project: https://github.com/Blm0423/svelma-router-problem.git

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Can't set button type - repurpose Button's property 'type'

Currently I can't set the type of a button to submit or button or reset, because that property is being used for the color/style of the button. Bulma itself also calls this Colors and not Type. Or do the same you've done for outlined/inverted?

Current

<!-- Svelte -->
<Button type="is-primary">Login</Button>

<!-- Rendered HTML -->
<button type="is-primary" class="button is-primary">Login</button>

Expected / Wished

<!-- Svelte -->
<Button type="submit" color="primary">Login</Button>
<!-- or the same as outlined/inverted -->
<Button type="submit" primary>Login</Button>

<!-- Rendered HTML -->
<button type="submit" class="button is-primary">Login</button>

Doc width issue

That's my current screen:

So some components have a width issue as Toast, Snackbar...

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Create components

  • Message
  • Button
  • Toggle
  • Dialog
  • Modal
  • Input
  • Toast
  • Progress
  • Tabs
  • Notification
  • Tooltip
  • Field
  • Switch
  • Select
  • Taginput
  • Tag
  • Snackbar

bulma has a new release

I think the relevant devDependencies entry needs an update in package.json
bulma 0.8.0 is out ...

Custom Element Support

Hi, I really like this as I've used bulma a lot before with Buefy and Vue.js. I'd really like to use it with Svelte, but I can't use it when compiling to web-components. Is there some way to make it work when using the customElement: true option?

on:change and on:input issues with Input.svelte

Trying to use Input.svelte in a component, like so:
In the script area:
import Field from 'svelma/src/components/Field.svelte'
import Input from 'svelma/src/components/Input.svelte'
In the html area:
<Input type="text" bind:value={value} on:change={() => myfunc()}/> .
Doesn't work.
I get in the console
Uncaught ReferenceError: $props is not defined at HTMLInputElement.onInput (Input.svelte:119)
Even if I use instead
<Input type="text" bind:value={value} on:input={() => myfunc()}/> no luck. Same error.

Maybe something inspired from this approach could do the trick?
https://github.com/hperrin/svelte-material-ui/blob/master/packages/textfield/Input.svelte

Referencing current_component from svelte/internal has broken the Input component when used with Nollup

This change was introduced in a recent commit. See: 206322d
As a result, the current_component import has a value of undefined when passed into the getEventsAction function.

To reproduce, use the Nollup template and add an Input tag to the App.
The below stack trace occurs.

TypeError: Cannot read property '$$' of undefined
    at eval (node_modules/svelma/src/utils/index.js:44:42)
    at Object.mount [as m] (eval at <anonymous> (https://localhost/build/bundle.js:40958:17), <anonymous>:161:58)
    at mount (eval at <anonymous> (https://localhost/build/bundle.js:40958:17), <anonymous>:410:14)
    at Object.targetCmp.$$.fragment.m (node_modules/svelte-hmr/runtime/svelte-hooks.js:189:24)
    at mount_component (node_modules/svelte/internal/index.mjs:1376:26)
    at Object.mount [as m] (eval at <anonymous> (https://localhost/build/bundle.js:460:17), <anonymous>:64:4)
    at mount_component (node_modules/svelte/internal/index.mjs:1376:26)
    at init (node_modules/svelte/internal/index.mjs:1465:9)
    at new App (eval at <anonymous> (https://localhost/build/bundle.js:460:17), <anonymous>:114:3)
    at createProxiedComponent (node_modules/svelte-hmr/runtime/svelte-hooks.js:237:9)

Swapping the import from: import { current_component } from 'svelte/internal'
to: import { get_current_component } from 'svelte/internal'

And the reference on line 131 becomes: const events = getEventsAction(get_current_component());

This has fixed it for my scenario.

Svelma: 0.4.0
Svelte: 3.24.1
Nollup: 0.13.2
Rollup: 2.23.1

Question/Feature Suggestion DataTable

Hi.

I'm looking for two DataTable features:

  • selectable row, onselect event handler
  • svelte component nesting inside DataTable cell

These aren't implemented, right ?

  <!-- DataTable.svelte: -->
  <!-- ... -->
  <tbody>
    {#each sorted as item, index}
      <slot name="item">
        <Row
          bind:editing
          {index}
          {item}
          {columns}
          {editable}
          {editableClasses}
          on:update
        />
      </slot>
    {/each}
  </tbody>
  <!-- ... -->

Is there another way to achieve selectable row and component nesting with svelma ?

import 'bulma/css/bulma.css' breaks stuff

Maybe I'm doing something wrong here, but I added the postcss plugin in my rollup.config.js, then did:

<script>
import 'bulma/css/bulma.css';
// other stuff
</script>

...but apparently the browser wants to load bulma.css as a JS module, because I get a SyntaxError.

I'm not using SSR, but it appears the example in docs does not do what's recommended in the README.md.

As a workaround, I'll just use a <link> tag, but would like to understand how to do it this way.

thanks!

Error compile with SSR svelte app

Hello, great job!

When adding components to an SSR svelte application, it constantly returns a compilation error; an error also occurs when using a Sapper.

Error: is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules
at validate_component (D:\site\public\App.js:80:15)
at D:\site\public\App.js:874:12
at Object.$$render (D:\site\public\App.js:98:22)
at Object.default (D:\site\public\App.js:900:54)
at D:\site\public\App.js:828:279
at Object.$$render (D:\site\public\App.js:98:22)
at Object.default (D:\site\public\App.js:899:43)
at D:\site\public\App.js:782:45
at Object.$$render (D:\site\public\App.js:98:22)
at D:\site\public\App.js:893:41

It's a rep with the SSR app - https://github.com/Bipboy/svelte-test-ssr

Input Bind doesn't update on input value has changed

    import { writable } from 'svelte/store'
    import { Input } from 'svelma'
    const bindedValue = writable('')
    let value = ''
    if(typeof data['initValue'] != 'undefined')
        value = data.initValue

    $: {
        console.log(`bindedValue: ${$bindedValue}`)
    }
    <Input type="text" placeholder="숫자만" bind:value={$bindedValue} size="is-small" />

store not binded, and same as normal values

suggestion: Component scoped Styling

Hello, I would like to ask/suggest why not make the styling scoped just for the component rather than importing the whole Bulma css file.
making the styling scoped will be more useful for implementing one component of Svelma. Currently using Svelma would imply using all of Bulma built-in css styles (mainly css which targets HTML elements: body, h1, html will give developers a headache)

codesandbox example isnt working

neither firefox nor chrome can complete the loading, for different reasons, but still;
had to set cookies to extra-permissive to even get this far tbh

svelma-firefox

svelma-chrome

Tooltip Animations not working

I am not able to get the fade animation as described in the docs:

<Tooltip position="is-bottom" label="Open in Google Street View" type="is-info" size="is-small" animated>
    <FontAwesomeIcon icon="street-view" />
</Tooltip>

20210321_021148

Navbar component missing

Navbar is a usefull component, which i awlays use it on web sites and even apps : matchid.io, previsecours.fr, ...

Unfortunately, I can't use this promising lib for now because of the Navbar component.
Navbar is quite rich and the only real need of a component is in the "Burger" behavior, needed for responsiveness.

This lib seems very promising. Using a lib with bulma and *.js (vue, react) is always a question for me. And it has a relative big impact on the velocity of coding. This one seem very promising.

Placeholder looks like a real value!

On All chrome based browsers like (Brave, Chrome, Chromium, ..)
The placeholder in Bulma's inputs looks like a real value! Not with gray color!

image

But in FireFox works fine.

The problem is that didn't happens when i worked with normal Bulma css

Svelma Slider proposal

Hi, this is what I came up with as a Slider.svelte proposal.
It's kinda simple and still needs some honing, but, hey, it works ...
Please let me know if you're OK with it so that I can come up with a proper PR.
Cheers!

<script>
/**** Svelma Slider */
//inspired by W3Schhols Custom Slider https://www.w3schools.com/howto/howto_js_rangeslider.asp
//and Svelte Material UI Slider https://github.com/hperrin/svelte-material-ui/tree/master/packages/slider

  /** Binding value*/
  export let value = 50;
  /** Limits */
  export let min = 0;
  export let max = 100;
  /* Step - if discrete values are needed. */
  //Use export let step = '' if you don't need discrete values 
  export let step = 0.1; 
  
  /**Sizes and shapes */
  //default thickness of the rail
  export let rail_thickness = 4; // nr of pixels

  // Overall height of the slider
  // can be "", or "is-small", "is-medium", "is-large"
  export let size = ""; 
  
  /** Colors */ 
  
  //can be one of the following: 
  /* "white","black","light","dark","primary","info","link","success",
  "warning","danger","black-bis","black-ter","grey-darker","grey-dark"
  "grey","grey-light","grey-lighter","white-ter","white-bis" */
  //rail= the complete path the handle moves on
  export let rail_color = "grey-lighter";
  //trail = the part of the path from origin to handle
  export let trail_color = "grey-dark";
  //the handle color
  export let handle_color = "white"; 
  
  //The color of the ring of the handle - visible when slider has focus
  //can be only one of these: "", or "is-danger", "is-warning", "is-success", "is-info", "is-primary"
  export let ring_color = "";
  
  /*End of Colors Section **/

const prefix = "has-background-";
let input_amended = "input " + ring_color + " " + size;
let railclass = prefix + rail_color;
let trailclass = prefix + trail_color;
let handleclass = prefix + handle_color;
$: traillength = (value-min)/(max-min);
let rail_thick = rail_thickness + 'px'
let rail_radius = (rail_thickness / 2) + 'px';

function onStyling() {
this.previousElementSibling.previousElementSibling.previousElementSibling.previousElementSibling.style.boxShadow = window.getComputedStyle(this).getPropertyValue('box-shadow'); //the ring glows
this.previousElementSibling.style.border = window.getComputedStyle(this).getPropertyValue('border'); // the border of the handle gets darker
};

let input_settings = {
 min : min,
 max : max,
 step : step,
}
</script>
<div class="control">
<div class = "{input_amended} make_way">
	<div style="position:relative; width : 100%;">
		<div style="left:{traillength*100}%; transform:translate({-traillength*12}px, -50%);" class="{input_amended} handle {handleclass}"></div>
		<div style= "top: -{rail_radius}; border-radius: {rail_radius}; height: {rail_thick};" class="rail {railclass}"></div>
		<div style= "top: -{rail_radius}; border-radius: {rail_radius}; height: {rail_thick}; transform:scaleX({traillength});" class="trail {trailclass}"></div>
		<div style="left:{traillength*100}%; transform:translate({-traillength*12}px, -50%);" class="{input_amended} handle {handleclass}"></div>
		<input class="{input_amended}" style= "border-radius: {rail_radius}; height: {rail_thick};transform: translateY(-{rail_radius});" type= range on:focus= {onStyling} on:blur= {onStyling} on:active= {onStyling} on:mouseover= {onStyling} on:mouseout= {onStyling} {...input_settings} bind:value>
	</div>
</div>
</div>
<style lang="scss">

input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  display: block;
  padding: 0;
  position: absolute; 
  opacity:0;
  cursor: pointer;
}

input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; /* Set a specific slider handle width */
  height: 40px; /*Slider handle height */
  border-radius: 5px;
  cursor: pointer;
}

input::-moz-range-thumb {
  -moz-appearance: none;
  width: 12px; /* Set a specific slider handle width */
  height: 40px; /* Slider handle height */
  border-radius: 5px;
  cursor: pointer; /* Cursor on hover */
}

.make_way {
  padding-top:0;
  padding-bottom:0;
  border: none;
  box-shadow: none;
}
  
.rail, .trail {
  width: 100%;
  display: block;
  padding: 0;
  border: none;
  position: absolute; 
  left:0px;
  cursor: pointer;
}

.trail {
  transform-origin: left bottom;
  will-change: transform;
}

.handle {
  display: block;
  padding: 0;
  position: absolute;
  width: 12px; /* Set a specific slider handle width */
  border-radius: 5px;
  cursor: pointer; /* Cursor on hover */
}

</style>

Error: PostCSS plugin postcss-noop-plugin requires PostCSS 8

Following the installation guide for Rollup bundler, after installing the required npm packages, when postcss() is added to rollup.config.js the following error occurs.

 > [email protected] dev /app
 > rollup -c -w
 
 rollup v2.35.1
 bundles src/main.js → public/build/bundle.js...
 [!] (plugin postcss) Error: PostCSS plugin postcss-noop-plugin requires PostCSS 8.
 Migration guide for end-users:
 https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
 src/App.css
 Error: PostCSS plugin postcss-noop-plugin requires PostCSS 8.
 Migration guide for end-users:
 https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
     at Processor.normalize (/app/node_modules/postcss/lib/processor.es6:139:15)
     at new Processor (/app/node_modules/postcss/lib/processor.es6:38:25)
     at Object.postcss (/app/node_modules/postcss/lib/postcss.es6:34:10)
     at /app/node_modules/rollup-plugin-postcss/dist/index.js:322:55
     at Generator.next (<anonymous>)
     at asyncGeneratorStep (/app/node_modules/rollup-plugin-postcss/dist/index.js:29:24)
     at _next (/app/node_modules/rollup-plugin-postcss/dist/index.js:51:9)

Links to the installation guides I used:

Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)

I created a new svelte project and ensured that it worked.
I followed your instructions to install bulma and svelma.

Im running this on my Windows 10

npm install --save bulma svelma

I then ran the

npm run dev

And the result is that it breaks the rollup

Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)

Full example:

C:\Code\test\my-svelte-project>npm run dev

> [email protected] dev C:\Code\test\my-svelte-project
> run-p start:dev autobuild


> [email protected] start:dev C:\Code\test\my-svelte-project
> sirv public --single --dev


> [email protected] autobuild C:\Code\test\my-svelte-project
> rollup -c -w

  Your application is ready~! �

  - Local:      http://localhost:5000

────────────────── LOGS ──────────────────

rollup v1.15.6
bundles src/main.js → public\bundle.js...
[!] Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
node_modules\bulma\css\bulma.css (2:0)
1: /*! bulma.io v0.7.5 | MIT License | github.com/jgthms/bulma */
2: @-webkit-keyframes spinAround {
   ^
3:   from {
4:     -webkit-transform: rotate(0deg);
Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
    at error (C:\Code\test\my-svelte-project\node_modules\rollup\dist\rollup.js:9365:30)
    at Module.error (C:\Code\test\my-svelte-project\node_modules\rollup\dist\rollup.js:13272:9)
    at tryParse (C:\Code\test\my-svelte-project\node_modules\rollup\dist\rollup.js:13187:16)
    at Module.setSource (C:\Code\test\my-svelte-project\node_modules\rollup\dist\rollup.js:13503:33)
    at Promise.resolve.catch.then.then.then (C:\Code\test\my-svelte-project\node_modules\rollup\dist\rollup.js:16273:20)

1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] autobuild: `rollup -c -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] autobuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\UMAKERS\AppData\Roaming\npm-cache\_logs\2019-06-21T11_08_05_039Z-debug.log
ERROR: "autobuild" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `run-p start:dev autobuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Warning from svelte on svelma component Notice

Hi,

When i run my application, I have a warning from the svelte compiler for an error in a svelma file of unused property.

Notice has unused export property 'type'. If it is for external reference only, please consider using `export const 'type'`
21: 
22:   export let active = true
23:   export let type = 'is-dark'
                 ^
24:   export let position = 'is-top'
25:   export let duration = 2000

cannot import "bulma/css/bulma.css";

Import Bulma's CSS in my main app's component
get the error:

bundles src/main.js → public/bundle.js...
[!] Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
node_modules/bulma/css/bulma.css (2:0)
1: /*! bulma.io v0.7.5 | MIT License | github.com/jgthms/bulma */
2: @-webkit-keyframes spinAround {
^
3: from {
4: -webkit-transform: rotate(0deg);
Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)

is-danger isn't being propagated from Field to Input class

I'm trying to use svelma with Svelte forms lib (https://github.com/tjinauyeung/svelte-forms-lib).

I have following field:

<Field label="Password" type={!!$errors.password?"is-danger":""} message="{$errors.password}">
	<Input
					bind:value={$form.password}
					passwordReveal="true"
					type="password"
					name="password"
					on:change={handleChange}/>
</Field>

When entered password is invalid rendered html looks like this:

<div message="this must be at least 6 characters" class="field is-danger svelte-utp4kb">
	<label for="" class="label">Password</label>
	<div class="control svelte-1v5s752 has-icons-right">
		<input name="password" type="password" class="input svelte-1v5s752">
		<span class="icon has-text-primary is-right is-clickable"><i class="fas fa-eye  "></i></span>
	</div>
	<p class="help is-danger svelte-utp4kb">this must be at least 6 characters</p>
</div>

As you can see is-danger class isn't being propagated to input, which leads to rendering red border.

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.