Coder Social home page Coder Social logo

zyxd / svelte-store-router Goto Github PK

View Code? Open in Web Editor NEW
91.0 91.0 5.0 109 KB

Store-based router for Svelte

Home Page: https://svelte-store-router-demo.vercel.app

License: MIT License

JavaScript 86.93% Svelte 13.07%
browser frontend javascript node router ssr state store svelte svelte-pathfinder

svelte-store-router's Introduction

          *     ,MMM8&&&.            *      
                MMMM88&&&&&    .            
               MMMM88&&&&&&&                
   *           MMM88&&&&&&&&                
               MMM88&&&&&&&&                
               ‘MMM88&&&&&&’                
                 ‘MMM8&&&’      *           
        |\___/|     /\___/\                 
        )     (     )    ~( .              ‘
       =\     /=   =\~    /=                
         )===(       ) ~ (                  
        /     \     /     \                 
        |     |     ) ~   (                 
       /       \   /     ~ \                
       \       /   \~     ~/                
_/\_/\_/\__  _/_/\_/\__~__/_/\_/\_/\_/\_/\_ 
|  |  |  |( (  |  |  | ))  |  |  |  |  |  | 
|  |  |  | ) ) |  |  |//|  |  |  |  |  |  | 
|  |  |  |(_(  |  |  (( |  |  |  |  |  |  | 
|  |  |  |  |  |  |  |\)|  |  |  |  |  |  | 
|  |  |  |  |  |  |  |  |  |  |  |  |  |  | 

svelte-store-router's People

Contributors

dkaoster avatar zyxd 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

Watchers

 avatar  avatar  avatar

svelte-store-router's Issues

Recommended Approach(es) For SSR Isn't Documented

Hi, I see this library doesn't inherit a url parameter as others do. I would like to take your advice on the SSR case, if possible. Should I just set $route.path before rendering? Or something else I could do.

Make Svelte a peerDependency

You ought to make Svelte a peerDependency of this package and a devDependency, but not a direct dependency. This package, otherwise, is locked to a single version of svelte, even though it's not in-fact locked and woudl work fine for any svelte >2

Error in Webpack: Module not found

When compiling with Webpack, I get these errors:

WARNING in ./resources/js/stores/stores.js 3:21-37
export 'createRouteStore' (imported as 'createRouteStore') was not found in 'svelte-store-router' (possible exports: )
 @ ./resources/js/pages/App.svelte 22:0-41 261:16-21 262:29-34 275:2-7
 @ ./resources/js/fbk.js 1:0-37 3:16-19

ERROR in ./node_modules/svelte-store-router/src/node_modules/components/Match.svelte 20:0-36
Module not found: Error: Can't resolve 'functions/match' in 'node_modules/svelte-store-router/src/node_modules/components'
 @ ./node_modules/svelte-store-router/src/index.mjs 3:0-58 3:0-58
 @ ./resources/js/pages/App.svelte 21:0-53 112:14-19 122:14-19 198:15-22 273:2-7 274:2-9
 @ ./resources/js/fbk.js 1:0-37 3:16-19

ERROR in ./node_modules/svelte-store-router/src/index.mjs 1:0-72
Module not found: Error: Can't resolve 'functions/createRouteStore' in 'node_modules/svelte-store-router/src'
 @ ./resources/js/pages/App.svelte 21:0-53 112:14-19 122:14-19 198:15-22 273:2-7 274:2-9
 @ ./resources/js/fbk.js 1:0-37 3:16-19

ERROR in ./node_modules/svelte-store-router/src/index.mjs 2:0-50
Module not found: Error: Can't resolve 'functions/match' in 'node_modules/svelte-store-router/src'
 @ ./resources/js/pages/App.svelte 21:0-53 112:14-19 122:14-19 198:15-22 273:2-7 274:2-9
 @ ./resources/js/fbk.js 1:0-37 3:16-19

I am not a JS or Webpack expert but I am using several other packages without issue. I see inside the src directory there is a node_modules directory which I don't see in other packages, and wherein reside the files webpack is trying to find but can't. I don't know if that is an issue or not, maybe I am just doing something dumb?

What about nested routes?

What about nested pages?

E.g.:

  1. Users Index (the list and the detail can change)

    1. Users Sidebar

    2. User Detail

      1. User Edit
      2. User Show

I hope I explained myself.

Query and fragment as a string

At the moment only $route has the toString() function, which allows to display the full route as /path?a=1&b=2#c=3.

Does it make sense to add $route.query.toString() to get ?a=1&b=2 and $route.fragment.toString() to get #c=3?

The problem is that $route.query and $route.fragment are objects and a name conflict may occur if you need to use the name toString as the property of query / fragment.

Update URL on new assignment to $route.path

When using <a href="/users">users</a> the URL is changed accordingly, but not when using <button on:click={() => ($route.path = '/users')}>user list</button>. I'm not sure if this is an oversight, or by design, but it makes this tool very confusing to get up and running with. Consider changing your documentation to something like <button on:click={() => (window.location.assign('/users'))}>user list</button> instead or update the code to change url on assingments to $route.path in the same manner as you do for $route.query... and fragment.

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.