i want to ask something, i have a custom store like i will explaying the scenario, im creating a script for a fivem server and im using svelte, i create a store that get a Vehicle with some properties like Name, Last Name, Plate and bla bla, i create the setData(Vehicle) and pass a set(Vehicle) then in another method i
Tag: svelte
Unable to update nodes position using d3 force and Svelte
I’m trying to create a simple network using D3 force and Svelte. The network position should depend on the container dimensions computed using bind:clientWidth and bind:clientHeight. I mean that if the network container has width=200, height=300, then the network center should be x=100, y=150. The code that creates the graph is this: It’s very simple: width and height are props.
How to Compile a Svelte file to JavaScript from the Command line?
I’m new to Svelte. Quick question: Is there a CLI for the Svelte compiler, and how do I access it? I understand Svelte has a preconfigured setup that uses rollup and what not for building an app. That’s all good, but I only need the CLI for transforming a svelte file to pure js file. Something like: svelte compile input.svelte
Using Svelte, Fable and Tauri
I’m creating a Tauri app that uses Fable to compile F# to JS. And I want to use Svelte with it, too. So far, I have compiled my F# file to a .js file. I’ve created a .svelte file with the following contents (named App.svelte) My index.html: And my main.mjs: I run the program with npm run build. This compiles
Toggle localstorage item in Svelte
new to Svelte so excuse the little knowledge. I am attempting to save a localStorage item on:click and toggle it when clicked again. Currently, the item is added to localStorage but on a second click, it is not removed. If you refresh the page and click the item is removed but I would like this not to be necessary. Onclick
Update array elements
I am trying to do something similar to a shopping cart, where initially there is a series of products that I load with an array of objects. I show the list of products with svelte like this: And through the function addProduct() I update the array inventory with the product id and the number of units of that product Where
Retrieve value from IndexedDB using Dexie and Svelte
I don’t understand how I can get a value from IndexedDB using Dexie. Database is all good in ‘application’ tab in inspect tool. Total newbie, so please be understanding. My db.js App.svelte Whatever I try, object with daysMax={total} outputs undefined, [object Object] or something like [Dexie object Object]. I just want to get 20 from db, as seen in db.js:
How to style AG grid in svelte?
I am trying to add styling to my AG grid but so far I have not been successful. The only way that has worked is setting some css variables given by the library but that is quite limited. I tried extending the existing classes but I always get Unused css selector warning and I haven’t been able to find a
Svelte SPA Router – Invalid component object error
I’m using SvelteKit and svelte-spa-router. My file structure looks like the following: __layout.svelte: (As per the example in the link above.) Error: Console: If I remove <Router {routes} /> and use <slot></slot>, everything works fine. The only thing I managed to find about this error was this GitHub source code of Router.svelte (line #301), but it didn’t help much. I
How can I get the access of a const inside my function?
How can I grant access to my const to be used inside a function? In this case I want to access my const catName inside my function fetchListings. I’m getting this error: Question Updated: Answer The problem you are running into is coming from how the <script context=”module”> works. The module level script tag serves as a one-time-per-app setup script.