Giter VIP home page Giter VIP logo

soda's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

soda's Issues

Bug: Can't display component which is child of any HTMLElement

Steps to Reproduce


  1. Create a page with a component which is child of any HTMLElement(in the example below, it's child of a div)

Example Code


import { Lucid } from "./lucid.js";

const Counter = Lucid.createComponent("Counter", {
  state: { count: 0 },
  methods: {
    increment: (state, setState) => {
      setState({ count: state.count + 1 });
    }
  },
  render() {
    return '<h1 onclick="{{methods.increment}}">Count: {{state.count}}</h1>';
  }
});

const HomePage = Lucid.createPage({
  path: "/",
  name: "home",
  payload: {},
  contents() {
    return `<div><div lucid-component="Counter" lucid-key="0"></div></div>`;
  }
});

const app = Lucid.createApp({
  currPage: HomePage,
  components: { Counter }
});
app.run("app");

Bug: Component's render function doesn't work properly if child of any HTMLElement

Steps to Reproduce


  1. Create a component which has a render function that at least has 1 parent and 1 child HTMLElement

Example Code


import { Lucid } from "./lucid.js";

const Counter = Lucid.createComponent("Counter", {
  state: { count: 0 },
  methods: {
    increment: (state, setState) => {
      setState({ count: state.count + 1 });
    }
  },
  render() {
    return '<div><h1 onclick="{{methods.increment}}">Count: {{state.count}}</h1></div>';
  }
});

const HomePage = Lucid.createPage({
  path: "/",
  name: "home",
  contents() {
    return `
      <div>
        <div>
          <div>Counter component below</div>
          <div lucid-component="Counter" lucid-key="0"></div>
          <div>Counter component above</div>
          <span style="color: red;">Lucid is great!</span>
        </div>
      </div>
    `;
  }
});

const app = Lucid.createApp({
  page: HomePage,
  components: { Counter }
});
app.run("app");

Bug: Can't display the page properly if any text node is found

Steps to Reproduce


  1. Create a page with at least 2 components
  2. Between the components there should be a space, tab or a newline character(or anything that counts as a text)

Example Code


import { Lucid } from "./lucid.js";

const Counter = Lucid.createComponent("Counter", {
    state: { count: 0 },
    methods: {
        increment: (state, setState) => {
            setState({ count: state.count + 1 });
        }
    },
    render() {
        return '<h1 onclick="{{methods.increment}}">Count: {{state.count}}</h1>';
    }
});

const HomePage = Lucid.createPage({
    path: "/",
    name: "home",
    payload: {},
    contents() {
        return `<div lucid-component="Counter" lucid-key="0"></div>
        you will not see the component below
        <div lucid-component="Counter" lucid-key="1"></div>`;
    }
});

const app = Lucid.createApp({
    currPage: HomePage,
    components: { Counter }
});
app.run("app");

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.