Giter Club home page Giter Club logo

Comments (9)

vaheqelyan avatar vaheqelyan commented on May 18, 2024 1

I'll think about it

from svelte-grid.

vaheqelyan avatar vaheqelyan commented on May 18, 2024 1

@frantic0 Maybe it's something similar to what you're looking for, https://layout-master.now.sh/ ?

This is the only thing I wrote on svelte and svelte-grid

https://github.com/vaheqelyan/layout-master

index.js
store.js

from svelte-grid.

vaheqelyan avatar vaheqelyan commented on May 18, 2024 1

I did this little demo repl
Check it out, too

from svelte-grid.

happybeing avatar happybeing commented on May 18, 2024

Tagging this because I may want to do something similar: persistence of layouts and some degree of hierarchy.

from svelte-grid.

frantic0 avatar frantic0 commented on May 18, 2024

thanks @vaheqelyan! I'll have a look

from svelte-grid.

frantic0 avatar frantic0 commented on May 18, 2024

Hi @vaheqelyan,

thanks, your demo repl made me understand better how to use 'svelte:component' for the subcomponent hierarchies.

However, I still think it doesn't show to use of subcomponent hierarchies with hierarchical state stores. Especially with dynamic components such as the grid-items of svelte-grid...

I forked your repl and tried to evolved it to try to show the problem better... Have a look at this fork:

I tweaked a new component from the svelte:self example that builds a component tree from a JSON with a hierarchical a filesystem-like tree and editable elements.

One thing to notice is if you collapse a folder and increment a counter, the tree is re-rendered.

Some questions:
How would you implement the update method for the items store in such a way that would support the renaming of each "folder" in the tree?
How would you structure the store differently to prevent the re-rendering of the whole svelte-grid?
How would you structure the store differently, if you didn't care about the total re-rendering?

Thanks!

from svelte-grid.

frantic0 avatar frantic0 commented on May 18, 2024

Just noticed something else, @vaheqelyan ...

In the repl, the Random component is getting updated but not triggering a total re-rendering... How come?

from svelte-grid.

vaheqelyan avatar vaheqelyan commented on May 18, 2024

repl. Simple recursion is used. every time you rename a folder name, you update all the items. The update occurs when the input is blurred. I know the interface isn't the best. (It is for quick work.)

I assign the _type property and creating another store.

export let xxx = writable({
  'tree': {} || [] // data
})

all your reading and writing takes place here

import { xxx } from './stores.js'
$xxx['tree'].property

file tree -> $xxx['tree']
counter -> $xxx['counter']
something unique -> $xxx[_type] || $xxx[id]

from svelte-grid.

frantic0 avatar frantic0 commented on May 18, 2024

Hi @vaheqelyan,

thanks for this, and apologies for letting all this time go by without following up...

I understand your solution, you extracted a new store to recursively update the tree state of the Folder component. It works well for reading and writing with one fixed Folder component.

However, how would you go at implementing a store the Folder components dynamically?

from svelte-grid.

Related Issues (20)

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.