How to change data from layout in page in Svelte 5?
Im trying to make a login in Svelte 5. I have the request then i redirect to another page, /dashboard.The problem is: I wanted to show my user data from the login on my navbar above, which is in...
View ArticleHow to Create my own Svelte Embed Component
Certain platforms like GitBook allow you to insert an embed URL, like https://www.youtube.com/embed/eGUEAvNpz48, and it displays as a component on that website, as seen here:I want to create my own...
View ArticleEncapsulating context interactions
The docs for the context API have this example:import { getContext, setContext } from 'svelte';let userKey = Symbol('user');export function setUserContext(user: User) { setContext(userKey,...
View ArticleHow do I wait for a store that will eventually appear on the context using...
I have an Authentication store based on Xstate that I am trying to set the actors based on the config I get from another machine...export function createAuthMachine(fakeLogin) { const chosenActors =...
View ArticleHow to Sync Scrolling between 2 containers while displaying panel on hover
In my svelte component, I'm displaying line numbers for each line in text area. I've disabled the scrolling of line number. And manually sync line number container when I scroll on text area....
View ArticleHow to assign default prop values with Svelte 5 and TypeScript?
Suppose I have the following Svelte 5 component:<script lang="ts"> const props: { name: string; age?: number; } = $props();</script><div>Name: {props.name}</div><div>Age:...
View Articlesv@0.6.21 not generating a tailwind.config.js file - problem with UI libraries
I created my Svelte project using sv@0.6.21npx sv@0.6.21 create appAdded the TailwindCSS packagenpx sv@0.6.21 add tailwindcssAnd then tried to install shadcn-sveltenpx shadcn-svelte@next initHowever...
View ArticleUnable to get CSP working right with SvelteKit, Google API and iFrames to...
I had it working but was getting the following warnings when dynamically generating iFrame elements.Refused to frame 'https://drive.google.com/' because an ancestor violates the following Content...
View ArticleTailwind and Vite warnings: "didn't resolve at build time, it will remain...
I'm using the following combination of technologies:SvelteKit (1.5.0, using TypeScript), with Vite (4.0.0) as the build tool that comes with SvelteKit)Svelte's adapter-static (2.0.1) for publishing to...
View ArticleSvelte $effect behaving differently in runes mode
Component in svelte 4:<script> let x = 1 let y = "less than 10" function check(){ if(x > 10){ y = "more than 10" } } $: { check() }</script><div>not runes<button onclick={()...
View ArticleSveltekit form actions with super forms clearing input before post
I have a register form that takes an email and password. It is validated using zod and SuperForms. When I submit the form the data from the form is cleared before requesting the form action defined in...
View ArticleSvelte, infering type from children
I am working on library for forms in svelte 5.My main goal is to have super simple form creation.Right now, the form is defined like this:<Form bind:form onapprove={handleApprove}><Input...
View ArticleBest Project Structure for Hosting Multiple Phaser.js Games in SvelteKit...
Suppose I am to develop a gaming website using SvelteKit and Phaser.js, where users can play multiple 2D games. Each game should have its own assets (images, sounds, etc.) and be accessible via routes...
View ArticleEasepicker's LockPlugin not working in Svelte
I have a svelte (3.59.2) project where I am implementing easepicker on a conditionally rendered div. Everything is working well, except the LockPlugin functionality.Imports:import {easepick} from...
View ArticleIn SvelteKit, is there a way to cancel a popstate event if user state isn't...
I have a component that allows a user to edit their state. This triggers a notSaved variable. I have a beforeunload event handler to handle reload and exiting the page to remind the user to save their...
View Articlecan't import from svelte module from typescript
I have a fairly large project, in which we are running typescript and svelte.In the project we are running tsc and tsc-sctrict(which uses tsc under the hood I think) as a form of validation step, to...
View Articleeslint:languages:js TSError: Unexpected keyword or identifier
I’m encountering an issue with ESLint and TypeScript in my project.When running the following ESLint command:pnpm eslint src/lib/components/SEO.svelte --debugI get the following error: ......
View ArticleError Hosting Svelte SPA from ASP.NET Core App in IIS: Uncaught (in promise)...
I am getting an error when trying to run a Svelte 5 (with SvelteKit) application as a SPA hosted by an ASP.NET Core application in IIS.I am building the app using astatic adapter with a fallback file...
View ArticleTrying to load a custom .glb file but constantly getting an HTML/404 response...
Cannot work out where to put the model.glb file.Error:Error in asyncWritable: Unexpected token '<', "<!doctype "... is not valid JSON.Created the project with - 'npm create...
View ArticleGet path to read file from /static (SvelteKit)
I have a file "artists.csv" which i need to read during execution of my server side code (when an API request is made, to be specific).new Promise((resolve, reject) => {...
View Article