Commit Graph

108 Commits

Author SHA1 Message Date
Talia 017cd9fbd2 Fix and refactor skooma.js 2024-02-01 14:00:26 +01:00
Talia 515ba550cf Fix bug in composed state 2024-02-01 14:00:26 +01:00
Talia 8cca0813d9 Refactor state module 2024-02-01 14:00:26 +01:00
Talia 97a89627b9 Make domLense error on non-element targets 2024-02-01 14:00:26 +01:00
Talia 904a5daf7c Stop removing "on" prefix from event names in skooma 2024-02-01 14:00:26 +01:00
Talia b25a3013d2 Change skooma to use svelte store contract
Since States are now also valid svelte stores, skooma now uses that API
to decide whether something is an observable state and to interact with
it.
2024-02-01 14:00:26 +01:00
Talia e293594edb Refactor skooma.js 2024-02-01 14:00:26 +01:00
Talia e75d90073e Add methods param to component generator 2024-02-01 14:00:26 +01:00
Talia 38b2127920 Add get/set filters to forward state & remove cache
Forwarded states are no longer cached, because caching would have to
happen individually for every attribute and methods combination.
2024-02-01 14:00:26 +01:00
Talia 3f838821e4 Add support for child generators as skooma args
Function arguments to skooma generators are now only treated as
initialisers if they take at least one named argument. Otherwise they
are called and their return value is evaluated as their replacement.

The process is recursive and can happen repeatedly for functions that
themselves return functions.
2024-02-01 14:00:26 +01:00
Talia 75fc1a7ce7 Refactor get/set to use `arguments` instead of ... 2024-02-01 13:35:57 +01:00
Talia 71e086cf04 Change domLense method semantics 2024-02-01 13:35:57 +01:00
Talia 2db5871cc9 Refactor API and Code
* Unified more features in SimpleState
* Flip "defer" into "synchronous" option
* Remove fallback from forward states
2024-02-01 13:35:57 +01:00
Talia c5c4e973a5 Remove valueKey from StoredState 2024-01-17 14:09:50 +01:00
Talia 47994975f9 Replace state "deep" option with "shallow" option 2024-01-17 11:52:41 +01:00
Talia 035eeb8fc0 Add subscribe method to state class
This makes the State class fully compatible with svelte stores
2024-01-17 11:39:16 +01:00
Talia 69a2aa1ca3 Allow calling `get` and `set` without property name 2024-01-17 11:31:38 +01:00
Talia 5726b8c2b9 Rename `proxy` to `values` in State class 2024-01-17 11:07:57 +01:00
Talia 5a29b0e662 Make `handle` return a value just in case it is desired 2024-01-15 11:50:27 +01:00
Talia 0e6eee28fd Make DOMState API more generic
The old interface was too specific to the way domLense works, by
assuming the value to be an array that gets mutated elsewhere (or a
proxy that behaves like one)
2024-01-15 11:48:52 +01:00
Talia eb75dc531a Remove exports from state.js 2024-01-15 11:03:11 +01:00
Talia 3b3e6467c8 Refactor exports
Export rules:
* All default exports as named exports
* Default export wherever it makes sense
2024-01-11 15:44:11 +01:00
Talia 7be7cf0210
Change DOMState value to last static value 2024-01-10 22:47:30 +01:00
Talia 61be174b6e
Add domState class 2024-01-10 20:42:47 +01:00
Talia f199f64932 Add kebab<->camel case conversion to component state 2024-01-10 15:23:10 +01:00
Talia 451718cb74 Add event method/setting to domLense 2024-01-10 15:01:46 +01:00
Talia fb000ba7a3 Replace state from component constructor entirely 2024-01-10 13:31:42 +01:00
Talia b51732636d Add component as argument to state component constructor 2024-01-10 13:28:56 +01:00
Talia f6b82e22ef Enable lense growing with empty values 2024-01-08 14:27:14 +01:00
Talia be79784b2d Add domLense helper 2024-01-08 13:37:36 +01:00
Talia f79e7a9c14
Fix error when passing `undefined` into tag generator 2023-12-30 13:17:36 +01:00
Talia b476b8651e
Bump minor version number 2023-12-30 13:09:35 +01:00
Talia cdc56f5848
Add nested state change forwarding 2023-12-27 19:58:49 +01:00
Talia 37948987b0
Add composed states 2023-12-27 18:52:42 +01:00
Talia b7bb093a0c
Compare strings in component attributes 2023-12-27 18:50:11 +01:00
Talia 7febebce65
Map names of forward states to "value" 2023-12-27 18:50:11 +01:00
Talia 64b73676cb
Make state components update attributes on state change 2023-12-23 21:16:58 +01:00
Talia b46c5d1d5c
Fix oversights in forwarded state caching 2023-12-23 21:05:55 +01:00
Talia 99d791921e
Move description above import block in readme 2023-12-23 18:25:05 +01:00
Talia b372b33f6c
Bump minor version number 2023-12-23 17:48:10 +01:00
Talia e80801b639
Cache forwarded states to avoid duplication 2023-12-23 17:46:43 +01:00
Talia e38d556531
Add fallback option to forwarded state 2023-12-23 17:31:45 +01:00
Talia cebd867bd2
Make reactive elements keep a weak ref to their reactive source 2023-12-23 17:31:01 +01:00
Talia ac484b223d
Re-structure readme 2023-12-22 18:43:47 +01:00
Talia 4a348f7806
Remove bind function from readme 2023-12-22 01:02:59 +01:00
Talia 3664c59cc0
Bump minor version number 2023-12-22 01:00:28 +01:00
Talia 04ab913b72
Fix error when accessing undefined StoredState values 2023-12-22 00:59:28 +01:00
Talia de88e6a9d6
Bump minor version number 2023-12-22 00:41:32 +01:00
Talia ae334801d4
Add forward method do state
This returns a thin wrapper State with its value proxied to a given
attribute on the backend state.
2023-12-22 00:38:54 +01:00
Talia 2a515dc47d
Bump minor version number and add website link 2023-12-21 23:58:24 +01:00