Skip to content

Releases: superlucky84/lithent

v1.14.1

03 Nov 15:01
Compare
Choose a tag to compare

Improved

  • Generalize HTML Element Update Method and Eliminate Redundant Code

v1.14.0

01 Nov 14:23
Compare
Choose a tag to compare

Improve

Improved the ftags feature to allow omitting the first argument, props, when it’s not used for standard elements or custom components.

/* ESM */
import { render, h } from 'lithent';
import { fTags, fFragment, fMount } from 'lithent/ftags';

const { section, div, p, br, strong } = fTags;

/* UMD
<script src="https://cdn.jsdelivr.net/npm/lithent@1.14.0/dist/lithent.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lithent@1.14.0/helper/dist/lithentHelper.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lithent@1.14.0/ftags/dist/lithentFTags.umd.js"></script>

const { render } = lithent;
const { fTags, fMount, fFragment } = lithentFTags;
const { section, div, p, br, strong } = fTags;
*/

const fTagComponent = fMount<{ firstProp: number }>((_r, props, children) => {
  return () =>
    fFragment(
      'first inner',
      div({ style: { border: '1px solid red' } }, 'second inner'),
      div('The props argument can be omitted.'),
      props.firstProp,
      ...children
    );
});

render(
  fTagComponent(
    { firstProp: 3 }, // The props argument can be omitted.
    div({ style: { border: '1px solid green' } }, `Fchildren1`),
    'Fchildren2',
    br()
  ),
  document.getElementById('root')
);

v1.13.1

23 Sep 17:01
Compare
Choose a tag to compare

Fixed

  • Fixed an issue that prevented dependency cleanup from working in certain cases on your store.

v1.13.0

21 Sep 17:57
Compare
Choose a tag to compare

New feature

Portal

“Portal” allow you to render some children to different parts of the DOM.

import { mount, Fragment, portal } from 'lithent';
const Parent = mount(renew => {
  return () => (
    <Fragment>
      <button onClick={change}>Update</button>
      {portal(<Children />, document.getElementById('portal-element'))}
    </Fragment>
  );
})

v1.12.0

20 Sep 17:03
Compare
Choose a tag to compare

Improvements

  • Handle when status value is an array

      const subscribe = store<number[]>([1, 2, 3]); // state.value is [1, 2, 3]
  • Added cache handling and ignore cache option for proxy returns to subscription functions on subscription

      const state = subscribe(callback, null, { cache: false }); // default true

Fixed

  • Fix bug with DEPS not working correctly on subscriptions

v1.11.2

18 Sep 19:05
Compare
Choose a tag to compare

Refactor

Store Helper code improvement

v.1.11.1

18 Sep 04:42
Compare
Choose a tag to compare

Improved

  • Modified the store's general subscription pattern so that subscriptions are not canceled even if there is no return value
const subscribe = store<number>(0);
const abortControl = new AbortController();

const proxyFirst = subscribe(store => {
  console.log(store); // {value: 0}

  // It always works fine without a signal return, but a signal return is required to unsubscribe.
  // return abortControl.signal;
});

v1.11.0

17 Sep 20:37
Compare
Choose a tag to compare

Improved store helper

Now, when using subscriptions outside of a component, you can use abortController to unsubscribe.

  • It should return 'abortController.signal' or any value. If the subscription function returns no value, the subscription is canceled immediately.
const subscribe = store<{ count1: number; count2: number; count3: number }>({
  count1: 1,
  count2: 1,
  count3: 1,
});


const abortControl = new AbortController();
// abortControl.abort();

const proxyFirst = subscribe(
  store => {
    console.log(store.count1);

    return abortControl.signal; // If it doesn't return 'true' etc, the subscription will be cancelled.
  },
  // The property you want to subscribe to. If omitted, all items will be subscribed.
  store => [store.count1, store.count2]
);

If the initial value is not an object, it is automatically expanded to {value: value}.

const subscribe = store<number>(0);
const abortControl = new AbortController();

const proxyFirst = subscribe(store => {
  console.log(store); // {value: 0}

  return abortControl.signal; // If it doesn't return 'true' etc, the subscription will be cancelled.
});

Fixed

Additionally, fixed a bug that did not work as desired even if a value was added to the subscription dependency.

v1.10.2

12 Sep 17:41
Compare
Choose a tag to compare

fixed

Fix diff algorithm bug.

v1.10.0

24 May 17:26
Compare
Choose a tag to compare

improvement

To avoid development legacy, we have version up the build tool (VITE). Separately, option changes resulted in slightly larger file sizes for umd and smaller mjs files.