Compare commits

..

175 Commits

Author SHA1 Message Date
Juan Di Toro 6c3c4b12f2 chore: use the old build step 2023-10-25 22:15:09 +02:00
Juan Di Toro dc1dc4333c chore: cleanup 2023-10-25 21:22:04 +02:00
Juan Di Toro 6f378fbcac chore: debug 2023-10-25 21:18:23 +02:00
Juan Di Toro 5e187546b4 chore: debug 2023-10-25 21:15:04 +02:00
Derrick Hammer 74c3911acf
ci: disable limit-access-to-actor 2023-10-25 14:55:03 -04:00
Derrick Hammer d84fd76b03
ci: debug 2023-10-25 13:09:39 -04:00
Derrick Hammer f9915f5df9
ci: debug 2023-10-25 13:06:34 -04:00
Derrick Hammer 103a38b361
Merge remote-tracking branch 'origin/develop' into develop 2023-10-25 13:05:20 -04:00
Derrick Hammer a5d1130b45
ci: debug 2023-10-25 13:05:10 -04:00
semantic-release-bot 0859ea612a chore(release): 0.1.0-develop.44 [skip ci]
# [0.1.0-develop.44](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.43...v0.1.0-develop.44) (2023-10-20)

### Bug Fixes

* add postinstall for patch-package ([a1968f4](a1968f43d0))
2023-10-20 10:51:02 +00:00
Derrick Hammer 3007010860
Merge remote-tracking branch 'origin/develop' into develop 2023-10-20 06:49:34 -04:00
Derrick Hammer a1968f43d0
fix: add postinstall for patch-package 2023-10-20 06:49:28 -04:00
semantic-release-bot 2da158175c chore(release): 0.1.0-develop.43 [skip ci]
# [0.1.0-develop.43](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.42...v0.1.0-develop.43) (2023-10-20)

### Bug Fixes

* positioning error ([88e08d1](88e08d13e2))
2023-10-20 10:43:17 +00:00
Juan Di Toro 546a123874 Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-20 12:41:38 +02:00
Juan Di Toro 88e08d13e2 fix: positioning error 2023-10-20 12:41:14 +02:00
semantic-release-bot 5d7a9ecace chore(release): 0.1.0-develop.42 [skip ci]
# [0.1.0-develop.42](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.41...v0.1.0-develop.42) (2023-10-20)

### Bug Fixes

* small ui problems ([2aa2a5f](2aa2a5ff30))
2023-10-20 10:33:10 +00:00
Juan Di Toro 2aa2a5ff30 fix: small ui problems 2023-10-20 12:32:02 +02:00
semantic-release-bot 8d654cf6b2 chore(release): 0.1.0-develop.41 [skip ci]
# [0.1.0-develop.41](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.40...v0.1.0-develop.41) (2023-10-20)

### Bug Fixes

* patch ([fe8a6a7](fe8a6a7de4))
2023-10-20 10:14:45 +00:00
Juan Di Toro 4369682133 Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-20 12:13:01 +02:00
Juan Di Toro fe8a6a7de4 fix: patch 2023-10-20 12:12:52 +02:00
semantic-release-bot b50c6243f5 chore(release): 0.1.0-develop.40 [skip ci]
# [0.1.0-develop.40](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.39...v0.1.0-develop.40) (2023-10-20)

### Bug Fixes

* patch ([a7f5ee2](a7f5ee266d))
2023-10-20 10:04:12 +00:00
Juan Di Toro a7f5ee266d fix: patch 2023-10-20 12:01:28 +02:00
semantic-release-bot e25458191a chore(release): 0.1.0-develop.39 [skip ci]
# [0.1.0-develop.39](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.38...v0.1.0-develop.39) (2023-10-16)

### Bug Fixes

* export LumeStatusContextType ([d074ef5](d074ef507d))
2023-10-16 19:16:21 +00:00
Derrick Hammer 7d404cae46
Merge remote-tracking branch 'origin/develop' into develop 2023-10-16 15:14:54 -04:00
Derrick Hammer d074ef507d
fix: export LumeStatusContextType 2023-10-16 15:14:50 -04:00
semantic-release-bot 5e6cf035d9 chore(release): 0.1.0-develop.38 [skip ci]
# [0.1.0-develop.38](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.37...v0.1.0-develop.38) (2023-10-16)

### Bug Fixes

* fix import path ([f1f5d24](f1f5d24efa))
* remove extension from import ([cdf20a8](cdf20a85cc))
2023-10-16 19:08:44 +00:00
Derrick Hammer f1f5d24efa
fix: fix import path 2023-10-16 15:07:15 -04:00
Derrick Hammer cdf20a85cc
fix: remove extension from import 2023-10-16 15:00:33 -04:00
Derrick Hammer dfd3f1490c
Merge remote-tracking branch 'origin/develop' into develop 2023-10-16 14:55:07 -04:00
Derrick Hammer dc3fe6adb6
refactor: split Lume Provider into LumeStatusProvider, NetworksProvider, and AuthProvider 2023-10-16 14:55:01 -04:00
semantic-release-bot a1636f29d7 chore(release): 0.1.0-develop.37 [skip ci]
# [0.1.0-develop.37](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.36...v0.1.0-develop.37) (2023-10-13)
2023-10-13 06:32:30 +00:00
Derrick Hammer 40f6699064
Merge remote-tracking branch 'origin/develop' into develop 2023-10-13 02:31:25 -04:00
Derrick Hammer c18fc924a4
refactor: fourth pass at CircularProgress 2023-10-13 02:31:22 -04:00
semantic-release-bot f85ac28f09 chore(release): 0.1.0-develop.36 [skip ci]
# [0.1.0-develop.36](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.35...v0.1.0-develop.36) (2023-10-13)
2023-10-13 06:25:10 +00:00
Derrick Hammer 4d54603ee5
Merge remote-tracking branch 'origin/develop' into develop 2023-10-13 02:23:36 -04:00
Derrick Hammer 8a57d5d4af
refactor: third pass at CircularProgress 2023-10-13 02:23:32 -04:00
semantic-release-bot 4b2975d013 chore(release): 0.1.0-develop.35 [skip ci]
# [0.1.0-develop.35](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.34...v0.1.0-develop.35) (2023-10-13)
2023-10-13 06:14:27 +00:00
Derrick Hammer 5bb1d8fc8a
Merge remote-tracking branch 'origin/develop' into develop 2023-10-13 02:13:13 -04:00
Derrick Hammer 2567620b6b
refactor: second pass at CircularProgress 2023-10-13 02:13:07 -04:00
semantic-release-bot aa1568dffb chore(release): 0.1.0-develop.34 [skip ci]
# [0.1.0-develop.34](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.33...v0.1.0-develop.34) (2023-10-13)
2023-10-13 05:51:20 +00:00
Derrick Hammer 9d736f29c2
Merge remote-tracking branch 'origin/develop' into develop 2023-10-13 01:50:04 -04:00
Derrick Hammer 11ceeb7916
refactor: initial pass at rewriting the CircularProgress component 2023-10-13 01:49:52 -04:00
semantic-release-bot 271a43b8d1 chore(release): 0.1.0-develop.33 [skip ci]
# [0.1.0-develop.33](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.32...v0.1.0-develop.33) (2023-10-12)

### Bug Fixes

* we need pascalCase ([7c35c45](7c35c45904))
2023-10-12 19:17:29 +00:00
Derrick Hammer 3d2b9ddbec
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 15:16:03 -04:00
Derrick Hammer 7c35c45904
fix: we need pascalCase 2023-10-12 15:15:59 -04:00
semantic-release-bot d07242b496 chore(release): 0.1.0-develop.32 [skip ci]
# [0.1.0-develop.32](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.31...v0.1.0-develop.32) (2023-10-12)

### Bug Fixes

* camelCase the type, not the name ([461147b](461147b7ac))
2023-10-12 19:09:59 +00:00
Derrick Hammer 4798fc8b1b
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 15:08:33 -04:00
Derrick Hammer 461147b7ac
fix: camelCase the type, not the name 2023-10-12 15:08:30 -04:00
semantic-release-bot ee445e4340 chore(release): 0.1.0-develop.31 [skip ci]
# [0.1.0-develop.31](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.30...v0.1.0-develop.31) (2023-10-12)
2023-10-12 19:02:48 +00:00
Derrick Hammer 61b7f4c376
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 15:01:22 -04:00
Derrick Hammer b26f31e4d8
refactor: camelcase network types 2023-10-12 15:01:18 -04:00
semantic-release-bot 479690700d chore(release): 0.1.0-develop.30 [skip ci]
# [0.1.0-develop.30](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.29...v0.1.0-develop.30) (2023-10-12)

### Bug Fixes

* remove debug ([897405b](897405b092))
2023-10-12 18:55:37 +00:00
Derrick Hammer cd51b27e89
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 14:54:11 -04:00
Derrick Hammer 897405b092
fix: remove debug 2023-10-12 14:54:07 -04:00
semantic-release-bot b079759a6b chore(release): 0.1.0-develop.29 [skip ci]
# [0.1.0-develop.29](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.28...v0.1.0-develop.29) (2023-10-12)

### Bug Fixes

* debug ([d77c4c2](d77c4c2a60))
* pass props to trigger and add disabled button styling ([cccdfde](cccdfdedbb))
2023-10-12 18:49:57 +00:00
Derrick Hammer 4a229059c2
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 14:48:26 -04:00
Derrick Hammer d77c4c2a60
fix: debug 2023-10-12 14:48:19 -04:00
Derrick Hammer cccdfdedbb
fix: pass props to trigger and add disabled button styling 2023-10-12 14:47:33 -04:00
semantic-release-bot 074550bd54 chore(release): 0.1.0-develop.28 [skip ci]
# [0.1.0-develop.28](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.27...v0.1.0-develop.28) (2023-10-12)

### Bug Fixes

* handling of children ([d886b6f](d886b6f2d0))
2023-10-12 18:23:03 +00:00
Derrick Hammer 8014c5a86c
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 14:21:27 -04:00
Derrick Hammer d886b6f2d0
fix: handling of children 2023-10-12 14:21:23 -04:00
semantic-release-bot 9fc73a42fa chore(release): 0.1.0-develop.27 [skip ci]
# [0.1.0-develop.27](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.26...v0.1.0-develop.27) (2023-10-12)
2023-10-12 18:13:34 +00:00
Derrick Hammer 9c218a44d6
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 14:12:06 -04:00
Derrick Hammer 1de4d2c013
refactor: pass props to trigger 2023-10-12 14:12:03 -04:00
semantic-release-bot f687cf07c0 chore(release): 0.1.0-develop.26 [skip ci]
# [0.1.0-develop.26](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.25...v0.1.0-develop.26) (2023-10-12)
2023-10-12 18:03:58 +00:00
Derrick Hammer c2b0bd2813
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 14:02:35 -04:00
Derrick Hammer 02fd3e558f
refactor: pass props to dashboard button 2023-10-12 14:02:31 -04:00
semantic-release-bot 304df7bf96 chore(release): 0.1.0-develop.25 [skip ci]
# [0.1.0-develop.25](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.24...v0.1.0-develop.25) (2023-10-12)
2023-10-12 17:19:35 +00:00
Derrick Hammer 9f7677885c
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 13:18:23 -04:00
Derrick Hammer cbfce62f95
refactor: add inited state 2023-10-12 13:18:17 -04:00
semantic-release-bot 7f2c4fd67d chore(release): 0.1.0-develop.24 [skip ci]
# [0.1.0-develop.24](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.23...v0.1.0-develop.24) (2023-10-12)
2023-10-12 17:04:46 +00:00
Derrick Hammer 971991e808
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 13:03:29 -04:00
Derrick Hammer c77725d915
refactor: export LumeContextType 2023-10-12 13:03:25 -04:00
semantic-release-bot 4ac23efb08 chore(release): 0.1.0-develop.23 [skip ci]
# [0.1.0-develop.23](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.22...v0.1.0-develop.23) (2023-10-12)
2023-10-12 16:50:23 +00:00
Derrick Hammer 06a2f94be0
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 12:49:06 -04:00
Derrick Hammer aa6ede68f0
refactor: move state detection to context so we can set it at the app level 2023-10-12 12:48:57 -04:00
semantic-release-bot 62459cfb3a chore(release): 0.1.0-develop.22 [skip ci]
# [0.1.0-develop.22](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.21...v0.1.0-develop.22) (2023-10-12)

### Bug Fixes

* remove debug ([40ea3f9](40ea3f9fc0))
2023-10-12 16:33:29 +00:00
Derrick Hammer 2ffc9a69f0
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 12:32:21 -04:00
Derrick Hammer 40ea3f9fc0
fix: remove debug 2023-10-12 12:32:18 -04:00
semantic-release-bot b2626c5ef9 chore(release): 0.1.0-develop.21 [skip ci]
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-10-12)

### Bug Fixes

* missing fetchAndUpdateNetworks call ([bf02385](bf023856b9))
2023-10-12 16:23:58 +00:00
Derrick Hammer 8493ac1e63
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 12:22:14 -04:00
Derrick Hammer bf023856b9
fix: missing fetchAndUpdateNetworks call 2023-10-12 12:22:07 -04:00
semantic-release-bot 0397c695e2 chore(release): 0.1.0-develop.20 [skip ci]
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-10-12)

### Bug Fixes

* debug ([ba38e6b](ba38e6be70))
2023-10-12 16:03:26 +00:00
Derrick Hammer a0cd05af73
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 12:02:15 -04:00
Derrick Hammer ba38e6be70
fix: debug 2023-10-12 12:02:09 -04:00
semantic-release-bot 8d2b7b461b chore(release): 0.1.0-develop.19 [skip ci]
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-10-12)

### Bug Fixes

* change fetchAndUpdateNetworks to be a cached callback ([f68070e](f68070e38c))
2023-10-12 15:48:14 +00:00
Derrick Hammer 9c876c834a
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 11:46:59 -04:00
Derrick Hammer f68070e38c
fix: change fetchAndUpdateNetworks to be a cached callback 2023-10-12 11:46:53 -04:00
semantic-release-bot 7aed936a0b chore(release): 0.1.0-develop.18 [skip ci]
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-10-12)

### Bug Fixes

* only use the private key, not extended ([dfe8739](dfe87396b9))
2023-10-12 09:03:56 +00:00
Derrick Hammer ccce11d34d
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 05:02:38 -04:00
Derrick Hammer dfe87396b9
fix: only use the private key, not extended 2023-10-12 05:02:33 -04:00
semantic-release-bot 2073518bd0 chore(release): 0.1.0-develop.17 [skip ci]
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-10-12)

### Bug Fixes

* abort and unsub if we unmount inside the loop, and check after the loop as well ([03434b4](03434b4329))
2023-10-12 08:41:52 +00:00
Derrick Hammer da80872c3c
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 04:40:21 -04:00
Derrick Hammer 03434b4329
fix: abort and unsub if we unmount inside the loop, and check after the loop as well 2023-10-12 04:40:16 -04:00
semantic-release-bot 9dd4f05e9b chore(release): 0.1.0-develop.16 [skip ci]
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-10-12)

### Bug Fixes

* try to avoid unneeded re-rendering if we unmount while in the process of mounting ([92c18ca](92c18ca940))
2023-10-12 08:32:10 +00:00
Derrick Hammer e574100bb5
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 04:30:50 -04:00
Derrick Hammer 92c18ca940
fix: try to avoid unneeded re-rendering if we unmount while in the process of mounting 2023-10-12 04:30:44 -04:00
semantic-release-bot 531e1f3167 chore(release): 0.1.0-develop.15 [skip ci]
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-10-12)

### Bug Fixes

* add all lumeweb libraries to external ([e1e82ad](e1e82adef8))
2023-10-12 07:18:29 +00:00
Derrick Hammer fa0bfb0015
Merge remote-tracking branch 'origin/develop' into develop 2023-10-12 03:17:05 -04:00
Derrick Hammer e1e82adef8
fix: add all lumeweb libraries to external 2023-10-12 03:16:55 -04:00
semantic-release-bot 3db776fd3c chore(release): 0.1.0-develop.14 [skip ci]
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-10-11)

### Bug Fixes

* use init, not kernelLoaded ([4f5118f](4f5118fe34))
2023-10-11 08:26:14 +00:00
Derrick Hammer 4f5118fe34
fix: use init, not kernelLoaded 2023-10-11 04:24:56 -04:00
Derrick Hammer ba86a13d8d
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-11 04:17:22 -04:00
semantic-release-bot be7365bcd4 chore(release): 0.1.0-develop.13 [skip ci]
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-10-11)

### Bug Fixes

* fix types ([ef1d307](ef1d307b4b))
2023-10-11 08:12:41 +00:00
Derrick Hammer 128bba978e
Merge remote-tracking branch 'origin/develop' into develop 2023-10-11 04:11:15 -04:00
Derrick Hammer ef1d307b4b
fix: fix types 2023-10-11 04:11:10 -04:00
semantic-release-bot 4879651a2f chore(release): 0.1.0-develop.12 [skip ci]
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-10-11)
2023-10-11 08:06:48 +00:00
Derrick Hammer 1642fd44e4
refactor: improve LumeProvider and track login and kernel loaded state 2023-10-11 04:05:06 -04:00
Derrick Hammer 8d54ad3a59
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-11 03:44:19 -04:00
semantic-release-bot 06ebef7583 chore(release): 0.1.0-develop.11 [skip ci]
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-10-10)

### Bug Fixes

* better components ([0db2a24](0db2a24f92))
2023-10-10 15:18:24 +00:00
Juan Di Toro 0db2a24f92 fix: better components 2023-10-10 17:16:58 +02:00
Derrick Hammer d08360d975
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-10 10:55:13 -04:00
semantic-release-bot 88d1121d1f chore(release): 0.1.0-develop.10 [skip ci]
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-10-10)

### Bug Fixes

* improve components ([f9664fc](f9664fc849))

### Features

* allow to customize the lume identity trigger ([099b2f2](099b2f2c64))
2023-10-10 14:52:11 +00:00
Juan Di Toro e259d74c8b Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-10 16:50:52 +02:00
Juan Di Toro f9664fc849 fix: improve components 2023-10-10 16:50:42 +02:00
Juan Di Toro 099b2f2c64 feat: allow to customize the lume identity trigger 2023-10-10 16:26:43 +02:00
Derrick Hammer 34d25e1188
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-10 10:02:17 -04:00
semantic-release-bot a4bb67a3ac chore(release): 0.1.0-develop.9 [skip ci]
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-10-10)

### Bug Fixes

* properly adding the scope ([7b1dc37](7b1dc37e72))
2023-10-10 11:23:07 +00:00
Juan Di Toro ee32356938 Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-10 13:21:53 +02:00
Juan Di Toro 7b1dc37e72 fix: properly adding the scope 2023-10-10 13:21:23 +02:00
semantic-release-bot 6e1ae56a29 chore(release): 0.1.0-develop.8 [skip ci]
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-10-10)

### Bug Fixes

* styles on lume identity ([7fc193c](7fc193ce72))
2023-10-10 10:42:20 +00:00
Juan Di Toro 7fc193ce72 fix: styles on lume identity 2023-10-10 12:40:39 +02:00
semantic-release-bot b93ee7fa18 chore(release): 0.1.0-develop.7 [skip ci]
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-10-09)

### Bug Fixes

* translate seed phrase length into bits ([935675f](935675f7e8))
2023-10-09 19:35:39 +00:00
Derrick Hammer 935675f7e8
fix: translate seed phrase length into bits 2023-10-09 15:34:08 -04:00
Derrick Hammer c5c6b83338
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-09 15:20:11 -04:00
semantic-release-bot 2cd83b0b4f chore(release): 0.1.0-develop.6 [skip ci]
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-10-09)

### Bug Fixes

* lib working weirdly not anymore ([7f30d90](7f30d9091a))
* modal not showing ([4e5b8a5](4e5b8a5eab))
2023-10-09 19:15:23 +00:00
Juan Di Toro 7f30d9091a fix: lib working weirdly not anymore 2023-10-09 21:13:50 +02:00
Juan Di Toro 4e5b8a5eab fix: modal not showing 2023-10-09 21:03:45 +02:00
Derrick Hammer 8c253146de
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-09 14:48:33 -04:00
semantic-release-bot c59c801b2d chore(release): 0.1.0-develop.5 [skip ci]
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-10-09)
2023-10-09 18:29:39 +00:00
Derrick Hammer cfee64bccb
Merge remote-tracking branch 'origin/develop' into develop 2023-10-09 14:28:15 -04:00
Derrick Hammer 514a134203
refactor: update to not bundle but instead chunk using vite-plugin-no-bundle 2023-10-09 14:28:09 -04:00
semantic-release-bot 6cce089ad7 chore(release): 0.1.0-develop.4 [skip ci]
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-10-09)

### Bug Fixes

* update package.json entry ([18efdbe](18efdbe39d))
2023-10-09 17:43:33 +00:00
Derrick Hammer 223cc991a2
Merge remote-tracking branch 'origin/develop' into develop 2023-10-09 13:41:46 -04:00
Derrick Hammer 18efdbe39d
fix: update package.json entry 2023-10-09 13:41:42 -04:00
semantic-release-bot a573692880 chore(release): 0.1.0-develop.3 [skip ci]
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-10-09)

### Bug Fixes

* remove private from package.json ([2ef8e09](2ef8e09346))
2023-10-09 17:33:49 +00:00
Derrick Hammer 2cea6d0974
ci: add publishConfig 2023-10-09 13:32:27 -04:00
Derrick Hammer 2ef8e09346
fix: remove private from package.json 2023-10-09 13:31:11 -04:00
Derrick Hammer 0927bc566d
Merge remote-tracking branch 'origin/develop' into develop 2023-10-09 13:29:01 -04:00
Derrick Hammer 4873f41511
chore: delete dist 2023-10-09 13:28:47 -04:00
semantic-release-bot 5664e652a1 chore(release): 0.1.0-develop.2 [skip ci]
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-10-09)

### Bug Fixes

* update vite-plugin-scope-tailwind patch ([dcc1428](dcc1428743))
2023-10-09 17:28:14 +00:00
Derrick Hammer d4d3310447
Merge branch 'develop' of git.lumeweb.com:LumeWeb/sdk into develop 2023-10-09 13:26:40 -04:00
Derrick Hammer dcc1428743
fix: update vite-plugin-scope-tailwind patch 2023-10-09 13:24:29 -04:00
semantic-release-bot d8ffbbcf00 chore(release): 0.1.0-develop.1 [skip ci]
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.0.1...v0.1.0-develop.1) (2023-10-09)

### Bug Fixes

* add patch for vite-plugin-scope-tailwind ([cc03b05](cc03b056e3))
* attributes needs to be changed ([0d00283](0d00283ba1))
* import useState ([baa4365](baa4365abb))
* lumelogobg ([ef85d92](ef85d921a6))
* set default syncState ([4982a3d](4982a3dd1a))
* types ([14c7f54](14c7f5401b))
* update stories path ([5a7c0b0](5a7c0b01b0))
* update stories path ([a049174](a04917449e))
* update syncState and how status updates work and their types ([0551582](0551582887))
* use sync not progress ([1d1a025](1d1a02527b))

### Features

* add proper tailwind scoping and config! ([aba0268](aba02687db))
* building is now done! ([1fd163a](1fd163afc8))
2023-10-09 17:10:13 +00:00
Derrick Hammer e51a0a3483
ci: add .presetterrc.json 2023-10-09 13:08:40 -04:00
Derrick Hammer bac7a90f18
ci: fix package name 2023-10-09 12:58:08 -04:00
Derrick Hammer 397a014038
ci: add npm-shrinkwrap.json 2023-10-09 12:57:14 -04:00
Derrick Hammer 9e26d23323
ci: setup 2023-10-09 12:56:05 -04:00
Derrick Hammer d2e44bf986
update LICENSE 2023-10-09 12:53:25 -04:00
Derrick Hammer 0e740775cb
refactor: LumeIdentityContext and Session no longer needed 2023-10-09 12:44:44 -04:00
Derrick Hammer 39f3984ee4
refactor: implement bip39 2023-10-09 12:43:20 -04:00
Derrick Hammer cce13287c3
ci: add files to package.json 2023-10-09 12:21:04 -04:00
Derrick Hammer 5a7c0b01b0
fix: update stories path 2023-10-09 12:18:29 -04:00
Derrick Hammer cc03b056e3
fix: add patch for vite-plugin-scope-tailwind 2023-10-09 12:04:22 -04:00
Derrick Hammer 0fab4d7f0d
chore: remove commented import 2023-10-09 12:03:47 -04:00
Derrick Hammer cf41ca6d85
dep: add patch-package 2023-10-09 12:03:32 -04:00
Derrick Hammer cb1b30d826
ci: setup 2023-10-09 10:42:46 -04:00
Derrick Hammer e3236b557c
chore: delete dist 2023-10-09 09:14:50 -04:00
Derrick Hammer f2f6c44803
ci: update vite config, and packages 2023-10-09 09:14:29 -04:00
Derrick Hammer 0d00283ba1
fix: attributes needs to be changed 2023-10-09 08:55:45 -04:00
Derrick Hammer 6c17ea89d9
style: format 2023-10-09 08:55:16 -04:00
Derrick Hammer 185611f09a
refactor: update imports 2023-10-09 03:34:02 -04:00
Derrick Hammer bb2bfe406f
refactor: update imports 2023-10-09 02:46:52 -04:00
Derrick Hammer a04917449e
fix: update stories path 2023-10-09 02:42:03 -04:00
Derrick Hammer 0551582887
fix: update syncState and how status updates work and their types 2023-10-09 02:35:36 -04:00
Derrick Hammer 349fa936d5
refactor: update imports and reformat 2023-10-09 02:34:52 -04:00
Derrick Hammer 4982a3dd1a
fix: set default syncState 2023-10-09 02:26:50 -04:00
Derrick Hammer 32afd2f4ae
refactor: change imports 2023-10-09 02:24:55 -04:00
Derrick Hammer 1d1a02527b
fix: use sync not progress 2023-10-09 02:23:16 -04:00
Derrick Hammer c3400859dc
refactor: change ChainIndicator to NetworkIndicator 2023-10-09 02:21:52 -04:00
Derrick Hammer baa4365abb
fix: import useState 2023-10-09 02:21:23 -04:00
Derrick Hammer 9d4a503c5c
refactor: render all networks dynamically 2023-10-09 02:13:47 -04:00
Derrick Hammer ba09919807
refactor: keep syncState defined and add error 2023-10-09 02:06:08 -04:00
Derrick Hammer 9911ab0168
refactor: isolate stories 2023-10-09 01:51:04 -04:00
Derrick Hammer 31c5ec8bbe
refactor: initial restructure of LumeProvider to use kernel api's 2023-10-09 01:48:40 -04:00
63 changed files with 30327 additions and 16049 deletions

13
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
jobs:
main:
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
secrets: inherit

32
.presetterrc.json Normal file
View File

@ -0,0 +1,32 @@
{
"preset": [
"@lumeweb/node-library-preset"
],
"config": {
"tsconfig": {
"compilerOptions": {
"moduleResolution": "bundler",
"typeRoots": [
"src/vite-env.d.ts"
],
"jsx": "react-jsx"
}
},
"tsconfig.build": {
"include": ["{buildSource}"],
"compilerOptions": {
"outDir": "{source}"
}
}
},
"variable": {
"source": "build",
"output": "lib",
"buildSource": "src"
},
"scripts": {
"build:vite": "vite build",
"build": "cross-env NODE_ENV=production run-s clean build:typescript:* build:vite",
"clean:buildOutput": "shx rm -rf {source}"
}
}

View File

@ -1,20 +1,19 @@
import type { StorybookConfig } from "@storybook/react-vite" import type { StorybookConfig } from "@storybook/react-vite";
import { resolve } from "node:path"
const config: StorybookConfig = { const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], stories: ["../stories", "../stories/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [ addons: [
"@storybook/addon-links", "@storybook/addon-links",
"@storybook/addon-essentials", "@storybook/addon-essentials",
"@storybook/addon-onboarding", "@storybook/addon-onboarding",
"@storybook/addon-interactions" "@storybook/addon-interactions",
], ],
framework: { framework: {
name: "@storybook/react-vite", name: "@storybook/react-vite",
options: {} options: {},
}, },
docs: { docs: {
autodocs: "tag" autodocs: "tag",
} },
} };
export default config export default config;

270
CHANGELOG.md Normal file
View File

@ -0,0 +1,270 @@
# [0.1.0-develop.44](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.43...v0.1.0-develop.44) (2023-10-20)
### Bug Fixes
* add postinstall for patch-package ([a1968f4](https://git.lumeweb.com/LumeWeb/sdk/commit/a1968f43d02193b2c4fe1b40db56afb60e64a7df))
# [0.1.0-develop.43](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.42...v0.1.0-develop.43) (2023-10-20)
### Bug Fixes
* positioning error ([88e08d1](https://git.lumeweb.com/LumeWeb/sdk/commit/88e08d13e27093768e3dfed3c015fefe7bb1bb8b))
# [0.1.0-develop.42](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.41...v0.1.0-develop.42) (2023-10-20)
### Bug Fixes
* small ui problems ([2aa2a5f](https://git.lumeweb.com/LumeWeb/sdk/commit/2aa2a5ff30b43574e96b4057938a247ea72d446b))
# [0.1.0-develop.41](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.40...v0.1.0-develop.41) (2023-10-20)
### Bug Fixes
* patch ([fe8a6a7](https://git.lumeweb.com/LumeWeb/sdk/commit/fe8a6a7de4d2ba9a4918348b6139182cc1dac0ea))
# [0.1.0-develop.40](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.39...v0.1.0-develop.40) (2023-10-20)
### Bug Fixes
* patch ([a7f5ee2](https://git.lumeweb.com/LumeWeb/sdk/commit/a7f5ee266d8021996d55b3241e517ae273cea6fd))
# [0.1.0-develop.39](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.38...v0.1.0-develop.39) (2023-10-16)
### Bug Fixes
* export LumeStatusContextType ([d074ef5](https://git.lumeweb.com/LumeWeb/sdk/commit/d074ef507d30c94739f6a5e7aaf2af36ccbf7116))
# [0.1.0-develop.38](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.37...v0.1.0-develop.38) (2023-10-16)
### Bug Fixes
* fix import path ([f1f5d24](https://git.lumeweb.com/LumeWeb/sdk/commit/f1f5d24efa38a7d21621d618e566fb46d12ea5a6))
* remove extension from import ([cdf20a8](https://git.lumeweb.com/LumeWeb/sdk/commit/cdf20a85cc5797c5781ad3625fc892f258373852))
# [0.1.0-develop.37](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.36...v0.1.0-develop.37) (2023-10-13)
# [0.1.0-develop.36](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.35...v0.1.0-develop.36) (2023-10-13)
# [0.1.0-develop.35](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.34...v0.1.0-develop.35) (2023-10-13)
# [0.1.0-develop.34](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.33...v0.1.0-develop.34) (2023-10-13)
# [0.1.0-develop.33](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.32...v0.1.0-develop.33) (2023-10-12)
### Bug Fixes
* we need pascalCase ([7c35c45](https://git.lumeweb.com/LumeWeb/sdk/commit/7c35c45904559a28db6af4b76713ee7d7669bd95))
# [0.1.0-develop.32](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.31...v0.1.0-develop.32) (2023-10-12)
### Bug Fixes
* camelCase the type, not the name ([461147b](https://git.lumeweb.com/LumeWeb/sdk/commit/461147b7ac0d33e6c60a10566ec2b7ad87406e02))
# [0.1.0-develop.31](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.30...v0.1.0-develop.31) (2023-10-12)
# [0.1.0-develop.30](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.29...v0.1.0-develop.30) (2023-10-12)
### Bug Fixes
* remove debug ([897405b](https://git.lumeweb.com/LumeWeb/sdk/commit/897405b092d7e0789226d6907ef3092c3ffb66e0))
# [0.1.0-develop.29](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.28...v0.1.0-develop.29) (2023-10-12)
### Bug Fixes
* debug ([d77c4c2](https://git.lumeweb.com/LumeWeb/sdk/commit/d77c4c2a605a3ff695c35bd1f22759f830908ddc))
* pass props to trigger and add disabled button styling ([cccdfde](https://git.lumeweb.com/LumeWeb/sdk/commit/cccdfdedbbb659106d294cb11c0638920db94783))
# [0.1.0-develop.28](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.27...v0.1.0-develop.28) (2023-10-12)
### Bug Fixes
* handling of children ([d886b6f](https://git.lumeweb.com/LumeWeb/sdk/commit/d886b6f2d075af654ea173c607521e81af8d7bd6))
# [0.1.0-develop.27](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.26...v0.1.0-develop.27) (2023-10-12)
# [0.1.0-develop.26](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.25...v0.1.0-develop.26) (2023-10-12)
# [0.1.0-develop.25](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.24...v0.1.0-develop.25) (2023-10-12)
# [0.1.0-develop.24](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.23...v0.1.0-develop.24) (2023-10-12)
# [0.1.0-develop.23](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.22...v0.1.0-develop.23) (2023-10-12)
# [0.1.0-develop.22](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.21...v0.1.0-develop.22) (2023-10-12)
### Bug Fixes
* remove debug ([40ea3f9](https://git.lumeweb.com/LumeWeb/sdk/commit/40ea3f9fc0c779bec8a7215ecf37e1d649083be6))
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-10-12)
### Bug Fixes
* missing fetchAndUpdateNetworks call ([bf02385](https://git.lumeweb.com/LumeWeb/sdk/commit/bf023856b9e3f9dc6352a688f277ab4557f84dd4))
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-10-12)
### Bug Fixes
* debug ([ba38e6b](https://git.lumeweb.com/LumeWeb/sdk/commit/ba38e6be707e8d476aba4ad629679583c5917fcc))
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-10-12)
### Bug Fixes
* change fetchAndUpdateNetworks to be a cached callback ([f68070e](https://git.lumeweb.com/LumeWeb/sdk/commit/f68070e38c3549a952eb42fc8487fbeee34e8164))
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-10-12)
### Bug Fixes
* only use the private key, not extended ([dfe8739](https://git.lumeweb.com/LumeWeb/sdk/commit/dfe87396b9770a8c37d22bd7d30c0904bd16082c))
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-10-12)
### Bug Fixes
* abort and unsub if we unmount inside the loop, and check after the loop as well ([03434b4](https://git.lumeweb.com/LumeWeb/sdk/commit/03434b43292463602526ec590327e384a10e5f75))
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-10-12)
### Bug Fixes
* try to avoid unneeded re-rendering if we unmount while in the process of mounting ([92c18ca](https://git.lumeweb.com/LumeWeb/sdk/commit/92c18ca940b3d8651064d58600fdcf83298b305d))
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-10-12)
### Bug Fixes
* add all lumeweb libraries to external ([e1e82ad](https://git.lumeweb.com/LumeWeb/sdk/commit/e1e82adef8af6320e303be5877610fdde13de801))
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-10-11)
### Bug Fixes
* use init, not kernelLoaded ([4f5118f](https://git.lumeweb.com/LumeWeb/sdk/commit/4f5118fe34d0499b2835bece6cde5b5e7fdb8b87))
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-10-11)
### Bug Fixes
* fix types ([ef1d307](https://git.lumeweb.com/LumeWeb/sdk/commit/ef1d307b4b23b53797761bcc903ff5fd50b13471))
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-10-11)
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-10-10)
### Bug Fixes
* better components ([0db2a24](https://git.lumeweb.com/LumeWeb/sdk/commit/0db2a24f92b772c442c7e0285b7d4a02e01783b2))
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-10-10)
### Bug Fixes
* improve components ([f9664fc](https://git.lumeweb.com/LumeWeb/sdk/commit/f9664fc8498ec94e4a355f2e920bd7f706f59145))
### Features
* allow to customize the lume identity trigger ([099b2f2](https://git.lumeweb.com/LumeWeb/sdk/commit/099b2f2c649d47df83c060f3cd587ea2c8034060))
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-10-10)
### Bug Fixes
* properly adding the scope ([7b1dc37](https://git.lumeweb.com/LumeWeb/sdk/commit/7b1dc37e72b4330b0f3e6ab27454ea3cdb54e9ba))
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-10-10)
### Bug Fixes
* styles on lume identity ([7fc193c](https://git.lumeweb.com/LumeWeb/sdk/commit/7fc193ce7249898b5c83886f24e2ec114312bda1))
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-10-09)
### Bug Fixes
* translate seed phrase length into bits ([935675f](https://git.lumeweb.com/LumeWeb/sdk/commit/935675f7e8a33f87459d7fe817d260495948075b))
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-10-09)
### Bug Fixes
* lib working weirdly not anymore ([7f30d90](https://git.lumeweb.com/LumeWeb/sdk/commit/7f30d9091a4f07b5b0d692c3fdaeebd0001a29e5))
* modal not showing ([4e5b8a5](https://git.lumeweb.com/LumeWeb/sdk/commit/4e5b8a5eab0f7fb6dd9f62b3304724a327024426))
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-10-09)
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-10-09)
### Bug Fixes
* update package.json entry ([18efdbe](https://git.lumeweb.com/LumeWeb/sdk/commit/18efdbe39dcb1126b798dd35217611cefcc605d0))
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-10-09)
### Bug Fixes
* remove private from package.json ([2ef8e09](https://git.lumeweb.com/LumeWeb/sdk/commit/2ef8e09346c81af4ce4b6971a11d6d0905a7de3f))
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-10-09)
### Bug Fixes
* update vite-plugin-scope-tailwind patch ([dcc1428](https://git.lumeweb.com/LumeWeb/sdk/commit/dcc1428743dd3be867166dd326bb48c086337034))
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.0.1...v0.1.0-develop.1) (2023-10-09)
### Bug Fixes
* add patch for vite-plugin-scope-tailwind ([cc03b05](https://git.lumeweb.com/LumeWeb/sdk/commit/cc03b056e358519be9ec771893b61b25b32eed87))
* attributes needs to be changed ([0d00283](https://git.lumeweb.com/LumeWeb/sdk/commit/0d00283ba1dab7b3ae06bb665d9f550abbd329a4))
* import useState ([baa4365](https://git.lumeweb.com/LumeWeb/sdk/commit/baa4365abb37a931f46dab957a748e54ac506faa))
* lumelogobg ([ef85d92](https://git.lumeweb.com/LumeWeb/sdk/commit/ef85d921a6abd9d5788257af2d8aec52157d01e6))
* set default syncState ([4982a3d](https://git.lumeweb.com/LumeWeb/sdk/commit/4982a3dd1a8ba932c3ab4f4427aadeba6295b22f))
* types ([14c7f54](https://git.lumeweb.com/LumeWeb/sdk/commit/14c7f5401b338f1aacee19019d9e299bb5f87b1d))
* update stories path ([5a7c0b0](https://git.lumeweb.com/LumeWeb/sdk/commit/5a7c0b01b062a4ace0a66c11436339f70f6a8963))
* update stories path ([a049174](https://git.lumeweb.com/LumeWeb/sdk/commit/a04917449ef442ca20eb1cb257ab18188972c7ad))
* update syncState and how status updates work and their types ([0551582](https://git.lumeweb.com/LumeWeb/sdk/commit/05515828877bddf435eaf44108793f156302b8c0))
* use sync not progress ([1d1a025](https://git.lumeweb.com/LumeWeb/sdk/commit/1d1a02527b83d9d0892664755ec28b3ae13e3aba))
### Features
* add proper tailwind scoping and config! ([aba0268](https://git.lumeweb.com/LumeWeb/sdk/commit/aba02687dba803d53ecedb77155dca3945f53f1d))
* building is now done! ([1fd163a](https://git.lumeweb.com/LumeWeb/sdk/commit/1fd163afc879fbf1d307247e6d87cda4e0255c55))

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2023 LumeWeb Copyright (c) 2023 Hammer Technologies LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

4166
dist/lib.es.js vendored

File diff suppressed because it is too large Load Diff

1
dist/lib.es.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"lib.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

36
dist/lib.umd.js vendored

File diff suppressed because one or more lines are too long

1
dist/lib.umd.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"lib.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

11
dist/manifest.json vendored
View File

@ -1,11 +0,0 @@
{
"src/main.ts": {
"file": "lib.umd.js",
"isEntry": true,
"src": "src/main.ts"
},
"style.css": {
"file": "style.css",
"src": "style.css"
}
}

1
dist/package.json vendored
View File

@ -1 +0,0 @@
{"name":"@lume-sdk/components","version":"0.0.0","main":"./lib.umd.js","module":"./lib.es.js","types":"./src/main.d.ts","files":["./src","./style.css"],"peerDependencies":{"react":"^18.2.0","react-dom":"^18.2.0"}}

View File

@ -1,19 +0,0 @@
import React from "react";
export declare const SwitchableComponentProvider: ({ children }: React.PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
export declare function useSwitchableComponent(initialValue?: SwitchableComponentType): SwitchableComponentContextType<unknown>;
export declare const SwitchableComponent: ({ children, index }: React.PropsWithChildren<{
index: string;
}>) => import("react/jsx-runtime").JSX.Element;
type SwitchableComponentType<T extends {} = {}> = {
index: string;
render: (props: T | any) => ReturnType<React.FC>;
};
type SwitchableComponentContextType<T = unknown> = {
visibleComponent: SwitchableComponentType<T extends {} ? T : any>;
setVisibleComponent: React.Dispatch<React.SetStateAction<SwitchableComponentType<T extends {} ? T : any> | undefined>>;
};
export declare function makeSwitchable<T extends {}>(Component: React.FC<T>, index: string): {
render(props: T): import("react/jsx-runtime").JSX.Element;
index: string;
};
export {};

View File

@ -1,2 +0,0 @@
declare const LumeDashboard: () => import("react/jsx-runtime").JSX.Element;
export default LumeDashboard;

View File

@ -1 +0,0 @@
export default function Wrapped(): import("react/jsx-runtime").JSX.Element;

View File

@ -1,11 +0,0 @@
import React from "react";
export type Session = string;
export declare const LumeIdentityContext: React.Context<{
session: Session | undefined;
setSession: React.Dispatch<React.SetStateAction<Session | undefined>>;
} | undefined>;
export declare function useLumeIndentity(): {
isSignedIn: boolean;
signIn: (key: string) => void;
signOut: () => void;
};

View File

@ -1,18 +0,0 @@
export declare const SubmitButton: {
render(props: {}): import("react/jsx-runtime").JSX.Element;
index: string;
};
export declare const SeedPhraseInput: {
render(props: {}): import("react/jsx-runtime").JSX.Element;
index: string;
};
export declare const SetupAccountKey: {
render(props: {}): import("react/jsx-runtime").JSX.Element;
index: string;
};
export declare const SeedPhraseGeneration: {
render(props: {
phraseLength?: number | undefined;
}): import("react/jsx-runtime").JSX.Element;
index: string;
};

View File

@ -1,21 +0,0 @@
import React from 'react';
type LumeSyncState = 'syncing' | 'done' | 'error';
export type Chain = {
syncState: LumeSyncState;
name: string;
chainId: string;
active: boolean;
progress: number;
logs: string[];
type: 'blockchain' | 'content';
peerCount?: number;
};
type LumeObject = {
chains: Chain[];
activeResolver: 'local' | 'rpc';
};
declare const LumeProvider: ({ children }: {
children: React.ReactNode;
}) => import("react/jsx-runtime").JSX.Element;
export default LumeProvider;
export declare function useLume(): LumeObject;

View File

@ -1,11 +0,0 @@
import * as React from "react";
import { type VariantProps } from "class-variance-authority";
declare const buttonVariants: (props?: ({
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
export { Button, buttonVariants };

View File

@ -1,5 +0,0 @@
import * as React from "react";
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
}
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
export { Input };

View File

@ -1,2 +0,0 @@
import { type ClassValue } from "clsx";
export declare function cn(...inputs: ClassValue[]): string;

3
dist/src/main.d.ts vendored
View File

@ -1,3 +0,0 @@
export * from './components/lume/LumeProvider';
export * from './components/lume/LumeDashboard/LumeDashboard';
export * from './components/lume/LumeIdentity/LumeIdentity';

1
dist/style.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1,24 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -1,52 +0,0 @@
# vite-plugin-scope-tailwind
> Encapsulate and scope your TailwindCSS styles to your library and prevent them affecting styles outside.
Love using TailwindCSS? Other people also love using TailwindCSS? Trying to mix them together? Usually this leads to problems as the tailwind classes such as `flex`, `bg-red-500` will clash and change specificity.
**Potential solutions**:
- A solution would be to [prefix your `TailwindCSS` styles in your libraries](https://stackoverflow.com/a/63770585), for example `my-lib-flex`, `my-lib-bg-red-500`, but this simply isn't good enough. The solution breaks down when there are multiple libraries using `TailwindCSS`. You would need a `prefix-` for each library. Unnecessary mental load.
- Another solution would be to [make the parent app important](https://stackoverflow.com/a/65907678). But this is an anti-pattern, and is a leaky abstraction. It is not feasible to tell all the consumers of your library to do this as a pre-requisite.
## Installation
```bash
npm i vite-plugin-scope-tailwind -D
```
## Usage
`vite-plugin-scope-tailwind` to the rescue!
This plugin scopes/encapsulates/contains all the `TailwindCSS` styles of your library all in, without any extra hacking around.
Add the `scopeTailwind` plugin into the `plugins` list in your `vite.config.js`:
```ts
import scopeTailwind from "vite-plugin-scope-tailwind";
export default defineConfig({
...
plugins: [
...
scopeTailwind(), // or scopeTailwind({ react: true }) for a React app
...
],
...
});
```
### Options
```ts
{
react: boolean // If your app is a React app
ignore: RegExp | RegExp[] // If you want to exclude some classes from being scoped
}
```
---
Made with ❤️

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
{
"name": "vite-plugin-scope-tailwind",
"description": "A vite-plugin to encapsulate and scope your TailwindCSS styles to your library and prevent them affecting styles outside",
"version": "1.1.3",
"main": "./dist/cjs/index.cjs",
"types": "./dist/main.d.ts",
"files": [
"dist"
],
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@types/node": "^20.2.4",
"postcss": "^8.4.23",
"typescript": "^5.0.2",
"vite": "^4.4.9",
"vite-plugin-dts": "^3.5.2",
"vite-tsconfig-paths": "^4.2.0"
},
"dependencies": {
"@types/uniqid": "^5.3.2",
"app-root-path": "^3.1.0",
"uniqid": "^5.4.0"
}
}

View File

@ -1,30 +0,0 @@
export const appendClassForReact = (id: string, modifiers: string[]) => (code: string) => {
let modifiedCode = code;
const classNameRegex = /className/g;
const foundClassName = modifiedCode.match(classNameRegex);
if (foundClassName) {
modifiedCode = modifiedCode.replace(/className: "/g, `className: "${id} `);
}
if (modifiers != null) {
modifiers.forEach(modifier => {
const regex = new RegExp(`className: ${modifier}\\(([^)]*)\\)`, 'g');
const replacement = `className: "${id} " + ${modifier}($1)`;
const found = modifiedCode.match(regex);
if (found) {
modifiedCode = modifiedCode.replace(regex, replacement);
}
});
}
return modifiedCode;
};
export const appendClass = (id: string) => (code: string) => {
const regex = /class/g;
const found = code.match(regex);
if (found) {
const c = code.replace(/class: "/g, `class: "${id} `);
return c;
} else {
return code;
}
};

View File

@ -1,39 +0,0 @@
import path from "path";
import { AcceptedPlugin } from "postcss";
export const getPostCssConfig = async (): Promise<any | undefined> => {
try {
const {default: file} = await import(path.join(process.cwd(), "postcss.config.js"));
return file;
} catch {}
try {
const {default: file} = await import(path.join(process.cwd(), "postcss.config.cjs"));
return file;
} catch {}
try {
const {default: file} = await import(path.join(process.cwd(), "postcss.config.json"));
return file;
} catch {}
try {
const {default: file} = await import(path.join(process.cwd(), "postcss.config.ts"));
return file;
} catch {}
return {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
};
export const postCssPluginsToArray = (config: { plugins: AcceptedPlugin[] }): string[] => {
return Object.keys(config.plugins);
};

View File

@ -1,75 +0,0 @@
import { Plugin } from "vite"
import path from "path"
import * as fs from "node:fs"
import { AcceptedPlugin } from "postcss"
import uniqid from "uniqid"
import { getPostCssConfig, postCssPluginsToArray } from "./get-postcss-config"
import { prefixPlugin } from "./postcss/prefix-tailwind"
import { appendClass, appendClassForReact } from "./append-classes"
const id = uniqid("d")
/**
* @param {object} options - The options for the plugin.
* @param {boolean} options.react - If true, the plugin will be configured for React.
* @param {RegExp | RegExp[]} options.ignore - Regular expressions to ignore.
* @param {string[]} options.classNameTransformers - Functions used inside `className` that return a string.
* @returns {Plugin} - The configured plugin.
*/
const plugin = ({
react = false,
classNameTransformers = [],
ignore = []
}: {
react?: boolean
ignore?: RegExp | RegExp[]
classNameTransformers?: string[]
} = {}): Plugin => ({
name: "vite-plugin-scope-tailwind",
config: async (config) => {
let currentPostCssPlugins: AcceptedPlugin[] = [] as AcceptedPlugin[]
if (
typeof config.css !== "undefined" &&
typeof config.css.postcss !== "string" &&
typeof config.css.postcss !== "undefined"
) {
currentPostCssPlugins =
config.css.postcss.plugins ?? currentPostCssPlugins
}
const postCssConfigFile = await getPostCssConfig()
return {
css: {
postcss: {
plugins: [
...currentPostCssPlugins,
...(
await Promise.all(
postCssPluginsToArray(postCssConfigFile).map(loadPackage)
)
).map((r) => r.default),
prefixPlugin({ prefix: `${id}.`, ignore })
]
}
}
}
},
transform: react ? appendClassForReact(id, classNameTransformers) : appendClass(id)
})
async function loadPackage(pack: string) {
const packageJsonPath = path.join(
process.cwd(),
"node_modules",
pack,
"package.json"
)
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))
const mainEntry = packageJson.main
return await import(path.join(process.cwd(), "node_modules", pack, mainEntry))
}
export default plugin

View File

@ -1,72 +0,0 @@
import { AcceptedPlugin } from "postcss";
/**
* Determine if class passes test
*
* @param {string} cssClass
* @param {RegExp | RegExp[]} test
*/
function classMatchesTest(cssClass: string, test: RegExp | RegExp[]) {
if (!test) {
return false;
}
cssClass = cssClass.trim();
if (test instanceof RegExp) {
return test.exec(cssClass);
}
if (Array.isArray(test)) {
// Reassign arguments
return test.some((t) => {
if (t instanceof RegExp) {
return t.exec(cssClass);
} else {
return cssClass === t;
}
});
}
return cssClass === test;
}
export const prefixPlugin = ({
prefix,
ignore,
}: {
prefix: string;
ignore: RegExp | RegExp[];
}): AcceptedPlugin => {
return {
postcssPlugin: "prefix-tailwind-classes",
Root(root) {
root.walkRules((rule) => {
if (!rule.selectors) {
return false;
}
rule.selectors = rule.selectors.map((selector) => {
// Is class selector
if (selector.indexOf(".") !== 0) {
return selector;
}
var classes = selector.split(".");
return classes
.map((cssClass) => {
if (
classMatchesTest(cssClass, ignore) ||
cssClass.trim().length === 0
) {
return cssClass;
}
return prefix + cssClass;
})
.join(".");
});
});
},
};
};

View File

@ -1 +0,0 @@
/// <reference types="vite/client" />

View File

@ -1,23 +0,0 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}

View File

@ -1,35 +0,0 @@
/// <reference types="vite/client" />
import { defineConfig } from "vite";
import { resolve } from "path";
import tsConfigPaths from "vite-tsconfig-paths";
import dts from "vite-plugin-dts";
export default defineConfig({
plugins: [
tsConfigPaths(),
dts({
include: ["src"],
}),
],
build: {
sourcemap: true,
lib: {
entry: resolve("src", "main.ts"),
name: "vite-plugin-scope-tailwind",
formats: ["es", "cjs"],
fileName: (format) => {
switch (format) {
case "es":
return `${format}/index.mjs`;
case "cjs":
return `${format}/index.cjs`;
default:
return "index.js";
}
},
},
rollupOptions: {
external: ["fs", "path"],
},
},
});

28821
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,45 @@
{ {
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/package.json", "name": "@lumeweb/sdk",
"name": "sdk", "version": "0.1.0-develop.44",
"private": true,
"version": "0.0.0",
"type": "module", "type": "module",
"main": "./src/main.ts", "main": "lib/index.js",
"types": "./src/main.ts", "types": "lib/src/index.d.ts",
"scripts": { "repository": {
"dev": "vite", "type": "git",
"build-pkg": "tsc -p ./tsconfig.build.json && vite build", "url": "gitea@git.lumeweb.com:LumeWeb/sdk.git"
"build": "zx ./scripts/build.mjs",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
}, },
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"semantic-release": "semantic-release",
"postinstall": "patch-package"
},
"files": [
"lib"
],
"dependencies": { "dependencies": {
"@lumeweb/kernel-network-registry-client": "0.1.0-develop.10",
"@lumeweb/libkernel": "0.1.0-develop.65",
"@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-slot": "^1.0.2",
"@scure/bip39": "^1.2.1",
"camelcase": "^8.0.0",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"framer-motion": "^10.16.4", "framer-motion": "^10.16.4",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"tailwind-merge": "^1.14.0", "tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7",
"vite-plugin-node-polyfills": "^0.15.0"
}, },
"devDependencies": { "devDependencies": {
"@lumeweb/node-library-preset": "*",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-icons": "^1.3.0",
"@storybook/addon-essentials": "^7.4.6", "@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-interactions": "^7.4.6", "@storybook/addon-interactions": "^7.4.6",
"@storybook/addon-links": "^7.4.6", "@storybook/addon-links": "^7.4.6",
@ -36,27 +48,41 @@
"@storybook/react": "^7.4.6", "@storybook/react": "^7.4.6",
"@storybook/react-vite": "^7.4.6", "@storybook/react-vite": "^7.4.6",
"@storybook/testing-library": "^0.2.2", "@storybook/testing-library": "^0.2.2",
"@types/react": "^18.2.15", "@types/react": "^18.2.25",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.11",
"@types/uniqid": "^5.3.2", "@types/uniqid": "^5.3.2",
"@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.0.0", "@typescript-eslint/parser": "^6.7.4",
"@vitejs/plugin-react": "^4.0.3", "@vitejs/plugin-react": "^4.1.0",
"autoprefixer": "^10.4.16", "autoprefixer": "^10.4.16",
"eslint": "^8.45.0", "class-variance-authority": "^0.7.0",
"eslint": "^8.51.0",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3", "eslint-plugin-react-refresh": "^0.4.3",
"eslint-plugin-storybook": "^0.6.14", "eslint-plugin-storybook": "^0.6.15",
"framer-motion": "^10.16.4",
"json": "^11.0.0", "json": "^11.0.0",
"patch-package": "^8.0.0",
"postcss": "^8.4.31", "postcss": "^8.4.31",
"presetter": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.4.6", "storybook": "^7.4.6",
"tailwind-merge": "^1.14.0",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.3",
"typescript": "^5.0.2", "tailwindcss-animate": "^1.0.7",
"typescript": "^5.2.2",
"uniqid": "^5.4.0", "uniqid": "^5.4.0",
"vite": "^4.4.5", "vite": "^4.4.11",
"vite-plugin-dts": "^3.6.0", "vite-plugin-dts": "^3.6.0",
"vite-plugin-no-bundle": "^3.0.0",
"vite-plugin-node-polyfills": "^0.15.0",
"vite-plugin-optimizer": "^1.4.2",
"vite-plugin-scope-tailwind": "^1.1.3", "vite-plugin-scope-tailwind": "^1.1.3",
"vite-plugin-svgr": "^4.1.0", "vite-plugin-svgr": "^4.1.0"
"zx": "^7.2.3" },
"readme": "ERROR: No README data found!",
"publishConfig": {
"access": "public"
} }
} }

View File

@ -0,0 +1,156 @@
diff --git a/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs b/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
index 0e337b0..a4d7cbe 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
+++ b/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
@@ -1,2 +1,109 @@
-"use strict";const p=require("path");function j(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function w(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function n(){return this instanceof n?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),t}function h(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var c={exports:{}};const v={},q=Object.freeze(Object.defineProperty({__proto__:null,default:v},Symbol.toStringTag,{value:"Module"})),b=w(q);var m=typeof process<"u"&&process.pid?process.pid.toString(36):"",y="";if(typeof __webpack_require__!="function"&&typeof h<"u"){var f="",d=b;if(d.networkInterfaces)var l=d.networkInterfaces();if(l){e:for(let e in l){const r=l[e],t=r.length;for(var i=0;i<t;i++)if(r[i]!==void 0&&r[i].mac&&r[i].mac!="00:00:00:00:00:00"){f=r[i].mac;break e}}y=f?parseInt(f.replace(/\:|\D+/gi,"")).toString(36):""}}c.exports=c.exports.default=function(e,r){return(e||"")+y+m+u().toString(36)+(r||"")};c.exports.process=function(e,r){return(e||"")+m+u().toString(36)+(r||"")};c.exports.time=function(e,r){return(e||"")+u().toString(36)+(r||"")};function u(){var e=Date.now(),r=u.last||e;return u.last=e>r?e:r+1}var x=c.exports;const P=j(x),O=()=>{try{return require(p.join(process.cwd(),"postcss.config.js"))}catch{}try{return require(p.join(process.cwd(),"postcss.config.cjs"))}catch{}try{return require(p.join(process.cwd(),"postcss.config.json"))}catch{}return{plugins:{tailwindcss:{},autoprefixer:{}}}},R=e=>Object.keys(e.plugins);function E(e,r){return r?(e=e.trim(),r instanceof RegExp?r.exec(e):Array.isArray(r)?r.some(t=>t instanceof RegExp?t.exec(e):e===t):e===r):!1}const S=({prefix:e,ignore:r})=>({postcssPlugin:"prefix-tailwind-classes",Root(t){t.walkRules(n=>{if(!n.selectors)return!1;n.selectors=n.selectors.map(o=>{if(o.indexOf(".")!==0)return o;var a=o.split(".");return a.map(s=>E(s,r)||s.trim().length===0?s:e+s).join(".")})})}}),$=e=>r=>{const t=/className/g;return r.match(t)?r.replace(/className: "/g,`className: "${e} `):r},k=e=>r=>{const t=/class/g;return r.match(t)?r.replace(/class: "/g,`class: "${e} `):r},g=P("d"),D=({react:e=!1,ignore:r=[]}={})=>({name:"vite-plugin-scope-tailwind",config:t=>{var a,s;const n=((s=(a=t.css)==null?void 0:a.postcss)==null?void 0:s.plugins)??[],o=O();return{css:{postcss:{plugins:[...n,...R(o).map(_=>require(p.join(process.cwd(),"node_modules",_))),S({prefix:`${g}.`,ignore:r})]}}}},transform:e?$(g):k(g)});module.exports=D;
+'use strict'
+const p = require('path')
+
+function j (e) {return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, 'default') ? e.default : e}
+
+function w (e) {
+ if (e.__esModule) return e
+ var r = e.default
+ if (typeof r == 'function') {
+ var t = function n () {return this instanceof n ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments)}
+ t.prototype = r.prototype
+ } else t = {}
+ return Object.defineProperty(t, '__esModule', { value: !0 }), Object.keys(e).forEach(function (n) {
+ var o = Object.getOwnPropertyDescriptor(e, n)
+ Object.defineProperty(t, n, o.get ? o : { enumerable: !0, get: function () {return e[n]} })
+ }), t
+}
+
+function h (e) {throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}
+
+var c = { exports: {} }
+const v = {},
+ q = Object.freeze(Object.defineProperty({ __proto__: null, default: v }, Symbol.toStringTag, { value: 'Module' })),
+ b = w(q)
+var m = typeof process < 'u' && process.pid ? process.pid.toString(36) : '', y = ''
+if (typeof __webpack_require__ != 'function' && typeof h < 'u') {
+ var f = '', d = b
+ if (d.networkInterfaces) var l = d.networkInterfaces()
+ if (l) {
+ e:for (let e in l) {
+ const r = l[e], t = r.length
+ for (var i = 0; i < t; i++) if (r[i] !== void 0 && r[i].mac && r[i].mac != '00:00:00:00:00:00') {
+ f = r[i].mac
+ break e
+ }
+ }
+ y = f ? parseInt(f.replace(/\:|\D+/gi, '')).toString(36) : ''
+ }
+}
+c.exports = c.exports.default = function (e, r) {return (e || '') + y + m + u().toString(36) + (r || '')}
+c.exports.process = function (e, r) {return (e || '') + m + u().toString(36) + (r || '')}
+c.exports.time = function (e, r) {return (e || '') + u().toString(36) + (r || '')}
+
+function u () {
+ var e = Date.now(), r = u.last || e
+ return u.last = e > r ? e : r + 1
+}
+
+var x = c.exports
+const P = j(x), O = () => {
+ try {return require(p.join(process.cwd(), 'postcss.config.js'))} catch {}
+ try {return require(p.join(process.cwd(), 'postcss.config.cjs'))} catch {}
+ try {return require(p.join(process.cwd(), 'postcss.config.json'))} catch {}
+ return { plugins: { tailwindcss: {}, autoprefixer: {} } }
+}, R = e => Object.keys(e.plugins)
+
+function E (e, r) {return r ? (e = e.trim(), r instanceof RegExp ? r.exec(e) : Array.isArray(r) ? r.some(t => t instanceof RegExp ? t.exec(e) : e === t) : e === r) : !1}
+
+const S = ({ prefix: e, ignore: r }) => ({
+ postcssPlugin: 'prefix-tailwind-classes',
+ Root (t) {
+ t.walkRules(n => {
+ if (!n.selectors) return !1
+ n.selectors = n.selectors.map(o => {
+ if (o.indexOf('.') !== 0) return o
+ var a = o.split('.')
+ return a.map(s => E(s, r) || s.trim().length === 0 ? s : e + s).join('.')
+ })
+ })
+ }
+}), $ = (e,modifiers) => r => {
+ let modifiedCode = r;
+ const classNameRegex = /className/g;
+ const foundClassName = modifiedCode.match(classNameRegex);
+ if (foundClassName) {
+ modifiedCode = modifiedCode.replace(/className: "/g, `className: "${e} `);
+ }
+ if (modifiers != null) {
+ modifiers.forEach(modifier => {
+ const regex = new RegExp(`className: ${modifier}\\(([^)]*)\\)`, 'g');
+ const replacement = `className: "${e} " + ${modifier}($1)`;
+ const found = modifiedCode.match(regex);
+ if (found) {
+ modifiedCode = modifiedCode.replace(regex, replacement);
+ }
+ });
+ }
+ return modifiedCode;
+}, k = e => r => {
+ const t = /class/g
+ return r.match(t) ? r.replace(/class: "/g, `class: "${e} `) : r
+}, g = P('d'), D = ({ react: e = !1, ignore: r = [], prefix, classNameTransformers = [] } = {}) => ({
+ name: 'vite-plugin-scope-tailwind', config: t => {
+ var a, s
+ const n = ((s = (a = t.css) == null ? void 0 : a.postcss) == null ? void 0 : s.plugins) ?? [], o = O()
+ return {
+ css: {
+ postcss: {
+ plugins: [...n, ...R(o).map(_ => require(p.join(process.cwd(), 'node_modules', _))), S({
+ prefix: `${prefix ? prefix : g}.`,
+ ignore: r
+ })]
+ }
+ }
+ }
+ }, transform: e ? $(prefix ? prefix : g, classNameTransformers) : k(prefix ? prefix : g)
+})
+module.exports = D
//# sourceMappingURL=index.cjs.map
diff --git a/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs b/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs
index 9594d38..c86b6da 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs
+++ b/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs
@@ -111,6 +111,8 @@ const S = ({
return r.match(t) ? r.replace(/class: "/g, `class: "${e} `) : r;
}, g = P("d"), M = ({
react: e = !1,
+ classNameTransformers = [],
+ prefix,
ignore: r = []
} = {}) => ({
name: "vite-plugin-scope-tailwind",
@@ -125,13 +127,13 @@ const S = ({
...R(o).map(
(_) => require(p.join(process.cwd(), "node_modules", _))
),
- S({ prefix: `${g}.`, ignore: r })
+ S({ prefix: `${prefix ? prefix : g}.`, ignore: r })
]
}
}
};
},
- transform: e ? $(g) : k(g)
+ transform: e ? $(prefix ? prefix : g, classNameTransformers) : k(prefix ? prefix : g )
});
export {
M as default
diff --git a/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts b/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts
index 2b63f48..9396191 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts
+++ b/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts
@@ -2,5 +2,7 @@ import { Plugin } from "vite";
declare const plugin: ({ react, ignore, }?: {
react?: boolean | undefined;
ignore?: RegExp | RegExp[] | undefined;
+ classNameTransformers?: string[],
+ prefix?: string
}) => Plugin;
export default plugin;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
export const TW_PREFIX = 'lumesdk'

View File

@ -0,0 +1,38 @@
import { createContext, useState, useContext, ReactNode } from "react";
// AuthContextType
export interface AuthContextType {
isLoggedIn: boolean;
setIsLoggedIn: (value: boolean) => void;
}
// AuthContext
const AuthContext = createContext<AuthContextType | undefined>(undefined);
// AuthProvider
interface AuthProviderProps {
children: ReactNode;
}
export const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
return (
<AuthContext.Provider value={{ isLoggedIn, setIsLoggedIn }}>
{children}
</AuthContext.Provider>
);
};
// useAuth hook
export function useAuth() {
const context = useContext(AuthContext);
if (!context) {
throw new Error("useAuth must be used within an AuthProvider");
}
return context;
}
export default AuthProvider;

View File

@ -0,0 +1,45 @@
import { createContext, useState, useContext, ReactNode } from "react";
// LumeStatusContextType
export interface LumeStatusContextType {
inited: boolean;
setInited: (value: boolean) => void;
ready: boolean;
setReady: (value: boolean) => void;
}
// LumeStatusContext
export const LumeStatusContext = createContext<
LumeStatusContextType | undefined
>(undefined);
// LumeStatusProvider
interface LumeStatusProviderProps {
children: ReactNode;
}
export const LumeStatusProvider: React.FC<LumeStatusProviderProps> = ({
children,
}) => {
const [inited, setInited] = useState(false);
const [ready, setReady] = useState(false);
return (
<LumeStatusContext.Provider value={{ inited, setInited, ready, setReady }}>
{children}
</LumeStatusContext.Provider>
);
};
// useLumeStatus hook
export function useLumeStatus() {
const context = useContext(LumeStatusContext);
if (!context) {
throw new Error("useLumeStatus must be used within a LumeStatusProvider");
}
return context;
}
export default LumeStatusProvider;

View File

@ -0,0 +1,142 @@
import {
createContext,
useCallback,
useContext,
useEffect,
useRef,
useState,
} from "react";
import { createClient as createNetworkRegistryClient } from "@lumeweb/kernel-network-registry-client";
import { createNetworkClient } from "@lumeweb/libkernel/module";
type SyncState = "done" | "syncing" | "error";
export interface Network extends NetworkStatus {
name: string;
id: string;
type: string;
syncState: SyncState;
}
interface NetworkStatus {
sync: number;
peers: number;
ready: boolean;
error?: string;
}
export interface NetworksContextType {
networks: Network[];
setNetworks: React.Dispatch<React.SetStateAction<Network[]>>;
}
const networkRegistry = createNetworkRegistryClient();
// Networks Context
const NetworksContext = createContext<NetworksContextType | undefined>(
undefined,
);
const NetworksProvider = ({ children }) => {
const [networks, setNetworks] = useState<Network[]>([]);
const statusUnsubs = useRef(new Map());
const isMounted = useRef(true); // Use a ref to track mounting
const handleStatusUpdate = useCallback((id, newNetwork) => {
setNetworks((prevNetworks) => {
return prevNetworks.map((network) =>
network.id === id ? { ...network, ...newNetwork } : network,
);
});
}, []);
const fetchAndUpdateNetworks = useCallback(async () => {
const unsub = () => {
statusUnsubs.current.forEach((unsub) => unsub());
statusUnsubs.current.clear();
};
try {
const types = await networkRegistry.getTypes();
const newNetworksMap = new Map();
const newStatusUnsubs = new Map();
for (const type of types) {
if (!isMounted.current) {
unsub();
return;
}
const list = await networkRegistry.getNetworksByType(type);
for (const module of list) {
const client = createNetworkClient(module);
const name = await client.name();
const initialNetworkStatus = {
peers: 0,
ready: false,
sync: 0,
type,
name,
id: module,
syncState: "syncing",
};
const statusUnsub = client.status((newStatus) => {
const syncState = newStatus.ready
? "done"
: newStatus.error
? "error"
: "syncing";
handleStatusUpdate(module, { ...newStatus, syncState });
});
newStatusUnsubs.set(module, statusUnsub);
newNetworksMap.set(module, initialNetworkStatus);
}
}
statusUnsubs.current.forEach((unsub) => unsub());
statusUnsubs.current = newStatusUnsubs;
if (isMounted.current) {
setNetworks(Array.from(newNetworksMap.values()));
} else {
unsub();
}
} catch (error) {
if (isMounted.current) {
console.error("Error fetching and updating networks:", error);
}
}
}, [handleStatusUpdate]);
useEffect(() => {
fetchAndUpdateNetworks();
const subDone = networkRegistry.subscribeToUpdates(() =>
fetchAndUpdateNetworks(),
);
return () => {
isMounted.current = false; // Track component unmounting
subDone?.();
statusUnsubs.current.forEach((unsub) => unsub());
};
}, [fetchAndUpdateNetworks]);
return (
<NetworksContext.Provider value={{ networks, setNetworks }}>
{children}
</NetworksContext.Provider>
);
};
export function useNetworks() {
const context = useContext(NetworksContext);
if (!context) {
throw new Error("useNetworks must be used within a NetworksProvider");
}
return context;
}
export default NetworksProvider;

View File

@ -1,23 +1,34 @@
import { Variant, AnimatePresence, m } from "framer-motion"; import { Variant, AnimatePresence, m } from "framer-motion";
import React from "react"; import React from "react";
const SwitchableComponentContext = React.createContext<SwitchableComponentContextType | undefined>(undefined); const SwitchableComponentContext = React.createContext<
SwitchableComponentContextType | undefined
>(undefined);
export const SwitchableComponentProvider = ({ children }: React.PropsWithChildren) => { export const SwitchableComponentProvider = ({
const [visibleComponent, setVisibleComponent] = React.useState<SwitchableComponentType>(); children,
}: React.PropsWithChildren) => {
const [visibleComponent, setVisibleComponent] =
React.useState<SwitchableComponentType>();
return <SwitchableComponentContext.Provider return (
value={{ visibleComponent: visibleComponent ?? DEFAULT_COMPONENT, setVisibleComponent }} <SwitchableComponentContext.Provider
> value={{
visibleComponent: visibleComponent ?? DEFAULT_COMPONENT,
setVisibleComponent,
}}>
{children} {children}
</SwitchableComponentContext.Provider> </SwitchableComponentContext.Provider>
} );
};
export function useSwitchableComponent(initialValue?: SwitchableComponentType) { export function useSwitchableComponent(initialValue?: SwitchableComponentType) {
const contextValue = React.useContext(SwitchableComponentContext); const contextValue = React.useContext(SwitchableComponentContext);
if (contextValue === undefined) { if (contextValue === undefined) {
throw new Error('useSwitchableComponent hook is being used outside of its context. Please ensure that it is wrapped within a <SwitchableComponentProvider>.'); throw new Error(
"useSwitchableComponent hook is being used outside of its context. Please ensure that it is wrapped within a <SwitchableComponentProvider>.",
);
} }
React.useEffect(() => { React.useEffect(() => {
// Set the initial value if it's provided // Set the initial value if it's provided
@ -30,22 +41,25 @@ export function useSwitchableComponent(initialValue?: SwitchableComponentType) {
} }
const variants: Record<string, Variant> = { const variants: Record<string, Variant> = {
hidden: { y: 50, opacity: 0, position: 'absolute' }, hidden: { y: 50, opacity: 0, position: "absolute" },
show: { show: {
y: 0, y: 0,
x: 0, x: 0,
opacity: 1, opacity: 1,
position: 'relative', position: "relative",
transition: { transition: {
type: "tween", type: "tween",
ease: 'easeInOut' ease: "easeInOut",
}, },
}, },
exit: { y: -50, opacity: 0, position: 'absolute' } exit: { y: -50, opacity: 0, position: "absolute" },
}; };
export const SwitchableComponent = ({ children, index }: React.PropsWithChildren<{ index: string }>) => { export const SwitchableComponent = ({
const [width, setWidth] = React.useState<number>() children,
index,
}: React.PropsWithChildren<{ index: string }>) => {
const [width, setWidth] = React.useState<number>();
return ( return (
<AnimatePresence> <AnimatePresence>
<m.div <m.div
@ -55,9 +69,10 @@ export const SwitchableComponent = ({ children, index }: React.PropsWithChildren
exit="exit" exit="exit"
variants={variants} variants={variants}
className="h-full w-full" className="h-full w-full"
style={{ maxWidth: width ?? 'auto' }} style={{ maxWidth: width ?? "auto" }}
onTransitionEnd={(e) => setWidth(e.currentTarget.getBoundingClientRect().width!)} onTransitionEnd={(e) =>
> setWidth(e.currentTarget.getBoundingClientRect().width!)
}>
{children} {children}
</m.div> </m.div>
</AnimatePresence> </AnimatePresence>
@ -65,21 +80,33 @@ export const SwitchableComponent = ({ children, index }: React.PropsWithChildren
}; };
type SwitchableComponentType<T extends {} = {}> = { type SwitchableComponentType<T extends {} = {}> = {
index: string, index: string;
render: (props: T | any) => ReturnType<React.FC> render: (props: T | any) => ReturnType<React.FC>;
} };
type SwitchableComponentContextType<T = unknown> = { type SwitchableComponentContextType<T = unknown> = {
visibleComponent: SwitchableComponentType<T extends {} ? T : any>, visibleComponent: SwitchableComponentType<T extends {} ? T : any>;
setVisibleComponent: React.Dispatch<React.SetStateAction<SwitchableComponentType<T extends {} ? T : any> | undefined>> setVisibleComponent: React.Dispatch<
} React.SetStateAction<
SwitchableComponentType<T extends {} ? T : any> | undefined
>
>;
};
const DEFAULT_COMPONENT = { render: () => undefined, index: Symbol('DEFAULT_COMPONENT').toString() } const DEFAULT_COMPONENT = {
render: () => undefined,
index: Symbol("DEFAULT_COMPONENT").toString(),
};
// Factory function // Factory function
export function makeSwitchable<T extends {}>(Component: React.FC<T>, index: string) { export function makeSwitchable<T extends {}>(
Component: React.FC<T>,
index: string,
) {
return { return {
render(props: T) { return <Component {...props} /> }, render(props: T) {
index: index || Symbol(Component.name).toString() return <Component {...props} />;
},
index: index || Symbol(Component.name).toString(),
}; };
}; }

View File

@ -1,17 +0,0 @@
import { StoryFn, Meta } from '@storybook/react';
import LumeDashboard from './LumeDashboard';
import LumeProvider from '../LumeProvider';
export default {
title: 'LumeDashboard',
component: LumeDashboard,
} as Meta<typeof LumeDashboard>;
const Template: StoryFn<typeof LumeDashboard> = (args) => <LumeProvider>
<LumeDashboard {...args} />
</LumeProvider>;
export const Primary = Template.bind({});
Primary.args = {
// Add initial props here
};

View File

@ -1,138 +1,172 @@
import * as Dialog from "@radix-ui/react-dialog" import * as Dialog from "@radix-ui/react-dialog";
import { Chain, useLume } from "../LumeProvider" import Logo from "../../../assets/lume-logo.png";
import Logo from "../../../assets/lume-logo.png" import { cva } from "class-variance-authority";
import { cva } from "class-variance-authority" import { cn } from "../../utils";
import { cn } from "../../utils" import React from "react";
import camelCase from "camelcase";
import { useNetworks, type Network } from "../../NetworksProvider";
import { TW_PREFIX } from "../../../../scoped-tailwind-prefix";
const SYNCSTATE_TO_TEXT: Record<Network["syncState"], string> = {
const SYNCSTATE_TO_TEXT: Record<Chain["syncState"], string> = {
done: "Synced", done: "Synced",
error: "Issue", error: "Issue",
syncing: "Syncing" syncing: "Syncing",
} };
const LumeDashboard = () => { export const LumeDashboardTrigger = Dialog.Trigger;
const { chains } = useLume() LumeDashboardTrigger.displayName = "LumeDashboardTrigger";
const contentChains = chains.filter((c) => c.type === "content") const LumeDashboard = (props: any) => {
const blockchainChains = chains.filter((c) => c.type === "blockchain") const { children }: { children: React.PropsWithChildren } = props;
const { networks } = useNetworks();
const networkTypes = networks.map((network) => network.type);
const uniqueNetworkTypes = Array.from(new Set(networkTypes));
const DefaultTrigger = (props: any) => (
<LumeDashboardTrigger asChild {...props}>
<button
className={cn(
"bg-primary text-primary-foreground p-2 px-4 text-sm font-semibold font-mono rounded-md",
{
"disabled:pointer-events-none disabled:opacity-50": props.disabled,
},
)}
{...props}>
Open Dashboard
</button>
</LumeDashboardTrigger>
);
const GivenTrigger = React.Children.toArray(
children?.children || (children as any) || [],
)
.filter((c) => {
if (typeof c === "object") {
//@ts-expect-error -- I dont know what the type of this should be, i just know that this works
return c.type?.displayName === "LumeDashboardTrigger";
}
return false;
})
.at(0);
const Trigger = GivenTrigger ? () => GivenTrigger : DefaultTrigger;
return ( return (
<Dialog.Root> <Dialog.Root>
<Dialog.Trigger>Open</Dialog.Trigger> <Trigger {...props} />
<Dialog.Portal> <Dialog.Portal>
<Dialog.Overlay className="fixed z-40 inset-0 bg-black bg-opacity-50 backdrop-blur-sm" /> <Dialog.Overlay className="fixed z-40 inset-0 bg-black bg-opacity-50 backdrop-blur-sm" />
<Dialog.Content className="fixed p-5 z-50 right-0 bottom-0 top-0 w-[300px] bg-neutral-950 text-white border-black border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500"> <Dialog.Content className="fixed p-5 z-50 right-0 bottom-0 top-0 w-[300px] bg-neutral-950 text-white border-black border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500">
<div className="w-[calc(100%+38px)] border-b pb-3 -mx-5 px-5 border-neutral-900"> <div className="w-[calc(100%+38px)] border-b pb-3 -mx-5 px-5 border-neutral-900">
<img src={Logo} className="w-24" /> <img src={Logo} className="w-24" />
</div> </div>
<div className="mt-4 mb-8"> {uniqueNetworkTypes.map((type, index) => (
<h2 className="text-xl mb-4"> Content </h2> <div className="mt-4 mb-8" key={`NetworkTypeSection_${index}`}>
<h2 className="text-xl mb-4">
{camelCase(type, { pascalCase: true })}
</h2>
<div className="grid grid-cols-2"> <div className="grid grid-cols-2">
{contentChains.map((chain, index) => ( {networks
<ChainIndicator .filter((network) => network.type === type)
key={`Content_ChainIndicator_${index}`} .map((network, networkIndex) => (
chain={chain} <NetworkIndicator
key={`${type}_ChainIndicator_${networkIndex}`}
network={network}
/> />
))} ))}
</div> </div>
</div> </div>
<div className="mt-4 mb-8">
<h2 className="text-xl mb-4"> Blockchain </h2>
<div className="grid grid-cols-2">
{blockchainChains.map((chain, index) => (
<ChainIndicator
key={`Blockchain_ChainIndicator_${index}`}
chain={chain}
/>
))} ))}
</div>
</div>
</Dialog.Content> </Dialog.Content>
</Dialog.Portal> </Dialog.Portal>
</Dialog.Root> </Dialog.Root>
) );
} };
const chainIndicatorVariant = cva("chainIndicatorVariant", { const chainIndicatorVariant = cva("chainIndicatorVariant", {
variants: { variants: {
syncState: { syncState: {
done: "text-primary", done: "text-primary",
error: "text-red-500", error: "text-red-500",
syncing: "text-orange-500" syncing: "text-orange-500",
} },
} },
}); });
const ChainIndicator = ({ chain }: { chain: Chain }) => {
const NetworkIndicator = ({ network }: { network: Network }) => {
return ( return (
<div key={chain.chainId} className="flex flex-row gap-x-2 items-center "> <div key={network.id} className="flex flex-row gap-x-2 items-center ">
<CircularProgress chain={chain} /> <CircularProgress chain={network} />
<div className="flex flex-col"> <div className="flex flex-col">
<span>{chain.name}</span> <span>{network.name}</span>
<span <span
className={cn(['text-[12px] -mt-1', chainIndicatorVariant({syncState: chain.syncState})])} className={cn([
> "text-[12px] -mt-1",
{SYNCSTATE_TO_TEXT[chain.syncState]} chainIndicatorVariant({ syncState: network.syncState }),
])}>
{SYNCSTATE_TO_TEXT[network.syncState]}
</span> </span>
</div> </div>
</div> </div>
) );
} };
const CircularProgress = ({ const CircularProgress = ({
chain, chain,
className className,
}: { }: {
chain: Chain chain: Network;
className?: string className?: string;
}) => { }) => {
const progressOffset = ((100 - chain.progress) / 100) * 282.74 // These math are not mathing const size = 70;
const textOffset = (chain.progress / 100) * (30 - 44) + 44 const progressWidth = size * 0.03; // based on size
const circleWidth = size * 0.03; // based on size
const radius = size / 2 - 10;
const circumference = 2 * radius * Math.PI;
const offset = circumference * ((100 - chain.sync) / 100);
const fontSize = size * 0.2; // based on size
return ( return (
<svg <svg
className={cn([className, chainIndicatorVariant({syncState: chain.syncState})])} className={cn([
width="36" className,
height="36" chainIndicatorVariant({ syncState: chain.syncState }),
viewBox="0 0 100 100" ])}
width={size}
height={size}
viewBox={`0 0 ${size} ${size}`}
version="1.1" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
style={{ transform: "rotate(-90deg)" }} style={{ transform: "rotate(-90deg)" }}>
>
<circle <circle
r="45" r={size / 2 - 10}
cx="50" cx={size / 2}
cy="50" cy={size / 2}
fill="transparent" fill="transparent"
stroke="#e0e0e0" stroke="#e0e0e0"
stroke-width="4px" strokeWidth={`${circleWidth}px`}
stroke-dasharray="282.74px" strokeDasharray={`${circumference}px`}></circle>
stroke-dashoffset="0"
></circle>
<circle <circle
r="45" r={size / 2 - 10}
cx="50" cx={size / 2}
cy="50" cy={size / 2}
stroke="currentColor" stroke="currentColor"
stroke-width="4px" strokeWidth={`${progressWidth}px`}
stroke-linecap="round" strokeLinecap="round"
stroke-dashoffset={`${progressOffset}px`} strokeDashoffset={`${offset}px`}
fill="transparent" fill="transparent"
stroke-dasharray="282.74px" strokeDasharray={`${circumference}px`}></circle>
></circle>
<text <text
x={textOffset} x="27px"
y="57.5px" y="39px"
fill="currentColor" fill="currentColor"
font-size="26px" fontSize={`${fontSize}px`}
font-weight="normal" fontWeight="normal"
style={{ transform: "rotate(90deg) translate(0px, -98px)" }} style={{ transform: "rotate(90deg) translate(0px, -66px)" }}>
> {chain.sync}
{chain.progress}
</text> </text>
</svg> </svg>
) );
} };
export default LumeDashboard export default LumeDashboard;

View File

@ -1,14 +0,0 @@
import { StoryFn, Meta } from '@storybook/react';
import LumeIdentity from './LumeIdentity';
export default {
title: 'LumeIdentity',
component: LumeIdentity,
} as Meta<typeof LumeIdentity>;
const Template: StoryFn<typeof LumeIdentity> = (args) => <LumeIdentity {...args} />;
export const Primary = Template.bind({});
Primary.args = {
// Add initial props here
};

View File

@ -1,34 +1,54 @@
import React from 'react'; import React, { useState, type FC, useRef, useEffect } from "react";
import { Button } from '../../../components/ui/button'; import { Button } from "../../ui/button";
import { SwitchableComponent, SwitchableComponentProvider, useSwitchableComponent } from '../../../components/SwitchableComponent'; import {
SwitchableComponent,
SwitchableComponentProvider,
useSwitchableComponent,
} from "../../SwitchableComponent";
import * as ComponentList from "./components"; import * as ComponentList from "./components";
import { LumeIdentityContext, Session } from './LumeIdentityContext'; import { LazyMotion, domAnimation } from "framer-motion";
import { LazyMotion, domAnimation } from 'framer-motion'; import * as Dialog from "@radix-ui/react-dialog";
import * as Dialog from '@radix-ui/react-dialog'; import LumeLogoBg from "./LumeLogoBg";
import LumeLogoBg from './LumeLogoBg'; import { LumeIdentityContext } from "./LumeIdentityContext";
const LumeIdentity: React.FC = () => { const LumeIdentity: FC = () => {
const { visibleComponent, setVisibleComponent } = useSwitchableComponent(ComponentList.SubmitButton) const { visibleComponent, setVisibleComponent } = useSwitchableComponent(
ComponentList.SubmitButton,
);
const isSubmitButtonInView = [ComponentList.SubmitButton.index].includes(visibleComponent.index) const isSubmitButtonInView = [ComponentList.SubmitButton.index].includes(
const isLoginWithAccountKey = [ComponentList.SeedPhraseInput.index].includes(visibleComponent.index) visibleComponent.index,
const isCreatingAccount = [ComponentList.SetupAccountKey.index].includes(visibleComponent.index) );
const isShowingSeedPhrase = [ComponentList.SeedPhraseGeneration.index].includes(visibleComponent.index) const isLoginWithAccountKey = [ComponentList.SeedPhraseInput.index].includes(
const isFinalStep = [ComponentList.SeedPhraseGeneration.index].includes(visibleComponent.index) visibleComponent.index,
const shouldShowBackButton = isCreatingAccount );
const isCreatingAccount = [ComponentList.SetupAccountKey.index].includes(
visibleComponent.index,
);
const isShowingSeedPhrase = [
ComponentList.SeedPhraseGeneration.index,
].includes(visibleComponent.index);
const isFinalStep = [ComponentList.SeedPhraseGeneration.index].includes(
visibleComponent.index,
);
const shouldShowBackButton = isCreatingAccount;
const coloredOrLine = isSubmitButtonInView ? 'text-primary' : 'text-border' const coloredOrLine = isSubmitButtonInView ? "text-primary" : "text-border";
return (
return <div className="relative w-96 max-w-full inline-flex flex-col items-center justify-center gap-2.5 bg-zinc-950 px-8 py-11 transition-[height] duration-100 [&>*]:transition-all [&>*]:duration-100 overflow-hidden"> <div className="relative w-96 max-w-full inline-flex flex-col items-center justify-center gap-2.5 bg-zinc-950 px-8 py-11 transition-[height] duration-100 [&>*]:transition-all [&>*]:duration-100 overflow-hidden">
<div className="absolute left-[168px] top-[-8px] h-64 w-[280px] overflow-hidden"> <div className="absolute left-[168px] top-[-8px] h-64 w-[280px] overflow-hidden">
<LumeLogoBg /> <LumeLogoBg />
</div> </div>
<div className="w-full z-10 flex flex-col items-center justify-center gap-10"> <div className="w-full z-10 flex flex-col items-center justify-center gap-10">
<div className="flex flex-col items-start justify-start gap-10"> <div className="flex flex-col items-start justify-start gap-10">
<h2 className="w-full text-5xl font-normal leading-14 text-white"> <h2 className="w-full text-5xl font-normal leading-14 text-white">
{isSubmitButtonInView || isLoginWithAccountKey ? 'Sign in with Lume' : null} {isSubmitButtonInView || isLoginWithAccountKey
{isCreatingAccount && !isShowingSeedPhrase ? 'Set up your account key' : null} ? "Sign in with Lume"
: null}
{isCreatingAccount && !isShowingSeedPhrase
? "Set up your account key"
: null}
{isShowingSeedPhrase ? "Here's your account key" : null} {isShowingSeedPhrase ? "Here's your account key" : null}
</h2> </h2>
</div> </div>
@ -38,44 +58,93 @@ const LumeIdentity: React.FC = () => {
<visibleComponent.render /> <visibleComponent.render />
</SwitchableComponent> </SwitchableComponent>
</LazyMotion> </LazyMotion>
{!isFinalStep ? <> {!isFinalStep ? (
<div className={`relative h-7 w-full overflow-hidden ${coloredOrLine}`}> <>
<svg width="409" height="28" className="max-w-full -left-1/2" viewBox="0 0 409 28" fill="none" xmlns="http://www.w3.org/2000/svg"> <div
<path fillRule="evenodd" clipRule="evenodd" d="M183 13H0V14H183V13ZM224 14H409V13H224V14Z" fill="currentColor" /> className={`relative h-7 w-full overflow-hidden ${coloredOrLine}`}>
<path d="M199.75 19.0781C198.359 19.0781 197.299 18.6562 196.57 17.8125C195.841 16.9688 195.477 15.7344 195.477 14.1094C195.477 12.4896 195.839 11.2656 196.562 10.4375C197.292 9.60417 198.354 9.1875 199.75 9.1875C201.151 9.1875 202.216 9.60417 202.945 10.4375C203.674 11.2656 204.039 12.4896 204.039 14.1094C204.039 15.7344 203.674 16.9688 202.945 17.8125C202.216 18.6562 201.151 19.0781 199.75 19.0781ZM199.75 18.0234C200.729 18.0234 201.479 17.6901 202 17.0234C202.521 16.3516 202.781 15.3802 202.781 14.1094C202.781 12.8385 202.521 11.8776 202 11.2266C201.484 10.5703 200.734 10.2422 199.75 10.2422C198.771 10.2422 198.023 10.5703 197.508 11.2266C196.992 11.8776 196.734 12.8385 196.734 14.1094C196.734 15.3854 196.992 16.3568 197.508 17.0234C198.023 17.6901 198.771 18.0234 199.75 18.0234ZM206.742 19.0234C206.367 19.0234 206.18 18.9219 206.18 18.7188V9.69531C206.18 9.54948 206.214 9.44531 206.281 9.38281C206.349 9.3151 206.456 9.28125 206.602 9.28125H208.938C210.047 9.28125 210.88 9.47656 211.438 9.86719C212 10.2578 212.281 10.8802 212.281 11.7344C212.281 12.3125 212.141 12.7995 211.859 13.1953C211.583 13.5859 211.193 13.8802 210.688 14.0781V14.1328C210.958 14.2266 211.18 14.4089 211.352 14.6797C211.529 14.9453 211.724 15.3411 211.938 15.8672L213.023 18.6094C213.049 18.7031 213.062 18.7682 213.062 18.8047C213.062 18.9505 212.867 19.0234 212.477 19.0234H212.336C212.195 19.0234 212.073 19.0052 211.969 18.9688C211.87 18.9271 211.807 18.8724 211.781 18.8047L210.727 16.0781C210.591 15.724 210.432 15.4479 210.25 15.25C210.068 15.0521 209.852 14.9141 209.602 14.8359C209.352 14.7578 209.036 14.7188 208.656 14.7188H207.406V18.7188C207.406 18.9219 207.221 19.0234 206.852 19.0234H206.742ZM209.234 13.6641C209.562 13.6641 209.862 13.5859 210.133 13.4297C210.409 13.2734 210.625 13.0651 210.781 12.8047C210.943 12.5391 211.023 12.2578 211.023 11.9609C211.023 11.4141 210.857 11.0078 210.523 10.7422C210.19 10.4714 209.729 10.3359 209.141 10.3359H207.406V13.6641H209.234Z" fill="currentColor" /> <svg
width="409"
height="28"
className="max-w-full -left-1/2"
viewBox="0 0 409 28"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M183 13H0V14H183V13ZM224 14H409V13H224V14Z"
fill="currentColor"
/>
<path
d="M199.75 19.0781C198.359 19.0781 197.299 18.6562 196.57 17.8125C195.841 16.9688 195.477 15.7344 195.477 14.1094C195.477 12.4896 195.839 11.2656 196.562 10.4375C197.292 9.60417 198.354 9.1875 199.75 9.1875C201.151 9.1875 202.216 9.60417 202.945 10.4375C203.674 11.2656 204.039 12.4896 204.039 14.1094C204.039 15.7344 203.674 16.9688 202.945 17.8125C202.216 18.6562 201.151 19.0781 199.75 19.0781ZM199.75 18.0234C200.729 18.0234 201.479 17.6901 202 17.0234C202.521 16.3516 202.781 15.3802 202.781 14.1094C202.781 12.8385 202.521 11.8776 202 11.2266C201.484 10.5703 200.734 10.2422 199.75 10.2422C198.771 10.2422 198.023 10.5703 197.508 11.2266C196.992 11.8776 196.734 12.8385 196.734 14.1094C196.734 15.3854 196.992 16.3568 197.508 17.0234C198.023 17.6901 198.771 18.0234 199.75 18.0234ZM206.742 19.0234C206.367 19.0234 206.18 18.9219 206.18 18.7188V9.69531C206.18 9.54948 206.214 9.44531 206.281 9.38281C206.349 9.3151 206.456 9.28125 206.602 9.28125H208.938C210.047 9.28125 210.88 9.47656 211.438 9.86719C212 10.2578 212.281 10.8802 212.281 11.7344C212.281 12.3125 212.141 12.7995 211.859 13.1953C211.583 13.5859 211.193 13.8802 210.688 14.0781V14.1328C210.958 14.2266 211.18 14.4089 211.352 14.6797C211.529 14.9453 211.724 15.3411 211.938 15.8672L213.023 18.6094C213.049 18.7031 213.062 18.7682 213.062 18.8047C213.062 18.9505 212.867 19.0234 212.477 19.0234H212.336C212.195 19.0234 212.073 19.0052 211.969 18.9688C211.87 18.9271 211.807 18.8724 211.781 18.8047L210.727 16.0781C210.591 15.724 210.432 15.4479 210.25 15.25C210.068 15.0521 209.852 14.9141 209.602 14.8359C209.352 14.7578 209.036 14.7188 208.656 14.7188H207.406V18.7188C207.406 18.9219 207.221 19.0234 206.852 19.0234H206.742ZM209.234 13.6641C209.562 13.6641 209.862 13.5859 210.133 13.4297C210.409 13.2734 210.625 13.0651 210.781 12.8047C210.943 12.5391 211.023 12.2578 211.023 11.9609C211.023 11.4141 210.857 11.0078 210.523 10.7422C210.19 10.4714 209.729 10.3359 209.141 10.3359H207.406V13.6641H209.234Z"
fill="currentColor"
/>
</svg> </svg>
</div> </div>
<Button className="h-12 w-full" variant={isSubmitButtonInView ? undefined : 'outline'} onClick={() => setVisibleComponent(shouldShowBackButton ? ComponentList.SubmitButton : ComponentList.SetupAccountKey)}> <Button
<span className="text-center text-lg font-normal leading-normal">{shouldShowBackButton ? 'Go Back' : 'Create an Account'}</span> className="h-12 w-full"
variant={isSubmitButtonInView ? undefined : "outline"}
onClick={() =>
setVisibleComponent(
shouldShowBackButton
? ComponentList.SubmitButton
: ComponentList.SetupAccountKey,
)
}>
<span className="text-center text-lg font-normal leading-normal">
{shouldShowBackButton ? "Go Back" : "Create an Account"}
</span>
</Button> </Button>
</> : null} </>
) : null}
</div> </div>
</div> </div>
</div> </div>
);
}; };
// @ditorodev: We should see how we improve this to be more like Google's SSO // @ditorodev: We should see how we improve this to be more like Google's SSO
// contrast is not very good, as im testing on a train with a lot of sunlight // contrast is not very good, as im testing on a train with a lot of sunlight
// hitting my screen, it is almost impossible to see whats happening the outline // hitting my screen, it is almost impossible to see whats happening the outline
// buttons have no contrast // buttons have no contrast
export default function Wrapped() { export const LumeIdentityTrigger = Dialog.Trigger;
const [session, setSession] = React.useState<Session>(); LumeIdentityTrigger.displayName = "LumeIdentityTrigger";
return <LumeIdentityContext.Provider value={{ session, setSession }}> export default function Wrapped({ children }: React.PropsWithChildren) {
<Dialog.Root> const [open, setOpen] = useState(false);
<Dialog.Trigger asChild> const dialogContentEl = useRef<HTMLElement>();
<button className='bg-primary text-primary-foreground p-2 px-4 text-sm font-semibold font-mono rounded-md'> const DefaultTrigger = () => (
<LumeIdentityTrigger asChild>
<button className="bg-primary text-primary-foreground p-2 px-4 text-sm font-semibold font-mono rounded-md">
Open Lume Open Lume
</button> </button>
</Dialog.Trigger> </LumeIdentityTrigger>
);
const GivenTrigger = React.Children.toArray(children)
.filter((c) => {
if (typeof c === "object") {
//@ts-expect-error -- I dont know what the type of this should be, i just know that this works
return c.type?.displayName === "LumeIdentityTrigger";
}
return false;
})
.at(0);
const Trigger = GivenTrigger ? () => GivenTrigger : DefaultTrigger;
return (
<Dialog.Root open={open} onOpenChange={setOpen}>
<Trigger />
<Dialog.Portal> <Dialog.Portal>
<Dialog.Overlay className="bg-black/90 data-[state=open]:animate-overlayShow fixed inset-0" /> <Dialog.Overlay className="fixed z-40 inset-0 bg-black bg-opacity-50 backdrop-blur-sm" />
<Dialog.Content className='w-full h-full flex items-center justify-center'> {/* @ditorodev: `left-[calc(50%-192px)]` these two are me being dumb and lazy, would be cool to fix with proper centering */}
<Dialog.Content className="absolute left-[calc(50%-192px)] top-12 mx-auto my-auto w-96 max-w-full h-auto z-40 flex items-center justify-center" >
<SwitchableComponentProvider> <SwitchableComponentProvider>
<LumeIdentityContext.Provider value={{open, setOpen}}>
<LumeIdentity /> <LumeIdentity />
</LumeIdentityContext.Provider>
</SwitchableComponentProvider> </SwitchableComponentProvider>
</Dialog.Content> </Dialog.Content>
</Dialog.Portal> </Dialog.Portal>
</Dialog.Root> </Dialog.Root>
</LumeIdentityContext.Provider> );
} }

View File

@ -1,43 +1,39 @@
import React from "react"; import {
login,
// loginComplete,
// logoutComplete,
} from "@lumeweb/libkernel/kernel";
import React, { useContext } from "react";
import { useAuth } from "../../AuthProvider.js";
export type Session = string; export const LumeIdentityContext = React.createContext<
export const LumeIdentityContext = React.createContext<{ { open: boolean; setOpen: (open: boolean) => void } | undefined
session: Session | undefined; >(undefined);
setSession: React.Dispatch<React.SetStateAction<Session | undefined>>;
} | undefined>(undefined);
export function useLumeIndentity() {
const contextValue = React.useContext(LumeIdentityContext);
// When the `session` changes we want to update the `session` in the local storage? export function useLumeIdentity() {
React.useEffect(() => { const { isLoggedIn, setIsLoggedIn } = useAuth();
if (contextValue?.session) { const ctx = useContext(LumeIdentityContext);
localStorage.setItem('lume-session', contextValue.session);
} else { if (!ctx) {
localStorage.removeItem('lume-session'); throw new Error(
"useLumeIdentity should be used inside LumeIdentityContext.Provider",
);
} }
}, [contextValue?.session]);
// Get the session from the local storage const { setOpen } = ctx;
React.useEffect(() => {
const session = localStorage.getItem('lume-session');
if (session) {
contextValue?.setSession(session);
}
}, []);
if (contextValue === undefined) {
throw new Error('useLumeIndentity hook is being used outside of its context. Please ensure that it is wrapped within a <LumeIdentityProvider>.');
}
return { return {
isSignedIn: !!contextValue.session, isSignedIn: isLoggedIn,
signIn: (key: string) => { async signIn(key: Uint8Array) {
console.log('signing in with key', key); await login(key.slice(0, 32));
// TODO: From the key generate a session, and store it // await loginComplete(); # this function is buggy `auth.ts:42 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'promise') `
contextValue.setSession('session'); setIsLoggedIn(true);
setOpen(false);
}, },
signOut: () => { async signOut() {
contextValue.setSession(undefined); // await logoutComplete();
setIsLoggedIn(false);
setOpen(false);
}, },
}; };
} }

File diff suppressed because one or more lines are too long

View File

@ -1,44 +1,84 @@
import { makeSwitchable, useSwitchableComponent } from "../../SwitchableComponent"; import {
makeSwitchable,
useSwitchableComponent,
} from "../../SwitchableComponent";
import { Button } from "../../ui/button"; import { Button } from "../../ui/button";
import { Input } from "../../ui/input"; import { Input } from "../../ui/input";
import { CheckIcon, ClipboardCopyIcon, ExclamationTriangleIcon } from "@radix-ui/react-icons"; import {
CheckIcon,
ClipboardCopyIcon,
ExclamationTriangleIcon,
} from "@radix-ui/react-icons";
import { AnimatePresence, m } from "framer-motion"; import { AnimatePresence, m } from "framer-motion";
import React from "react"; import { useLumeIdentity } from "./LumeIdentityContext";
import { useLumeIndentity } from "./LumeIdentityContext"; import { useMemo, useState } from "react";
import * as bip39 from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
import { TW_PREFIX } from "../../../../scoped-tailwind-prefix";
async function seedToKey(seed: string) {
return bip39.mnemonicToSeed(seed);
}
function getStrength(wordCount: number) {
switch (wordCount) {
case 12:
return 128;
case 15:
return 160;
case 18:
return 192;
case 21:
return 224;
case 24:
return 256;
default:
throw new Error("Invalid word count");
}
}
// Extracted components // Extracted components
const SubmitButtonComponent = () => { const SubmitButtonComponent = () => {
const { setVisibleComponent } = useSwitchableComponent(); const { setVisibleComponent } = useSwitchableComponent();
return ( return (
<Button className='w-full h-12' variant={"outline"} onClick={() => setVisibleComponent(SeedPhraseInput)}> <Button
<span className="text-center text-lg font-normal leading-normal">Sign in with Account Key</span> className="w-full h-12"
variant={"outline"}
onClick={() => setVisibleComponent(SeedPhraseInput)}>
<span className="text-center text-lg font-normal leading-normal">
Sign in with Account Key
</span>
</Button> </Button>
) );
}; };
const SeedPhraseInputComponent = () => { const SeedPhraseInputComponent = () => {
const { signIn } = useLumeIndentity(); const { signIn } = useLumeIdentity();
return ( return (
<m.form className='flex-col flex gap-y-4' onSubmit={(e) => { <m.form
className="flex-col flex gap-y-4"
onSubmit={async (e) => {
e.preventDefault(); e.preventDefault();
const target = e.target as typeof e.target & { const target = e.target as typeof e.target & {
elements: { elements: {
seedPhrase: { value: string }; seedPhrase: { value: string };
} };
}; };
const seedPhrase = target.elements.seedPhrase.value; const seedPhrase = target.elements.seedPhrase.value;
signIn(seedPhrase) signIn(await seedToKey(seedPhrase));
}}> }}>
<Input className='h-12 w-full text-lg' name="seedPhrase" /> <Input className="h-12 w-full text-lg" name="seedPhrase" />
<m.div <m.div
initial={{ y: 50 }} initial={{ y: 50 }}
animate={{ y: 0 }} animate={{ y: 0 }}
exit={{ y: -50 }} exit={{ y: -50 }}
transition={{ type: "just", delay: 0.1 }} transition={{ type: "just", delay: 0.1 }}
className="h-12" className="h-12">
> <Button className="w-full h-full" role="submit">
<Button className='w-full h-full' role="submit"> <span className="text-center text-lg font-normal leading-normal">
<span className="text-center text-lg font-normal leading-normal">Sign in</span> Sign in
</span>
</Button> </Button>
</m.div> </m.div>
</m.form> </m.form>
@ -47,36 +87,46 @@ const SeedPhraseInputComponent = () => {
const SetupAccountKeyComponent = () => { const SetupAccountKeyComponent = () => {
const { setVisibleComponent } = useSwitchableComponent(); const { setVisibleComponent } = useSwitchableComponent();
const [width, setWidth] = React.useState<number>(); const [width, setWidth] = useState<number>();
return ( return (
<m.div <m.div
initial={{ y: 50 }} initial={{ y: 50 }}
animate={{ y: 0 }} animate={{ y: 0 }}
exit={{ y: -50, height: 'auto' }} exit={{ y: -50, height: "auto" }}
transition={{ type: "just", delay: 0.1 }} transition={{ type: "just", delay: 0.1 }}
className="min-h-12 h-full max-w-full" className="min-h-12 h-full max-w-full"
style={{ maxWidth: width ?? 'auto' }} style={{ maxWidth: width ?? "auto" }}
ref={(t) => setTimeout(() => setWidth(t!.getBoundingClientRect().width!), 0)} ref={(t) => {
> if (t) {
<Button className='w-full h-full' onClick={() => setVisibleComponent(SeedPhraseGeneration)}> setTimeout(() => setWidth(t.getBoundingClientRect().width!), 0);
<span className="text-center text-lg font-normal leading-normal">I get it, I'll keep it safe. Let's see the key.</span> }
}}>
<Button
className="w-full h-full"
onClick={() => setVisibleComponent(SeedPhraseGeneration)}>
<span className="text-center text-lg font-normal leading-normal">
I get it, I'll keep it safe. Let's see the key.
</span>
</Button> </Button>
</m.div> </m.div>
) );
}; };
const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => { const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => {
const [buttonClickedState, setButtonClickedState] = React.useState<"idle" | "clicked">("idle"); const [buttonClickedState, setButtonClickedState] = useState<
const [step, setStep] = React.useState<number>(0); "idle" | "clicked"
const { signIn } = useLumeIndentity(); >("idle");
const [step, setStep] = useState<number>(0);
const { signIn } = useLumeIdentity();
const phrases = React.useMemo(() => { const phrases = useMemo(() => {
// TODO: Replace with actual BIP39 or whatever is used for phrase generation return bip39
return Array(phraseLength).fill("a phrase") .generateMnemonic(wordlist, getStrength(phraseLength))
.split(" ");
}, [phraseLength]); }, [phraseLength]);
const key = React.useMemo(() => { const key = useMemo(() => {
return phrases.join(" "); return phrases.join(" ");
}, [phrases]); }, [phrases]);
@ -84,62 +134,110 @@ const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => {
navigator.clipboard.writeText(phrases.join(" ")); navigator.clipboard.writeText(phrases.join(" "));
setButtonClickedState("clicked"); setButtonClickedState("clicked");
setTimeout(() => setButtonClickedState("idle"), 1000); setTimeout(() => setButtonClickedState("idle"), 1000);
} };
return ( return (
<div className="relative"> <div className="relative">
<AnimatePresence> <AnimatePresence>
{step === 1 ? <m.div className={`z-10 absolute top-0 bottom-0 left-0 right-0 bg-black pointer-events-none`} {step === 1 ? (
<m.div
className={`z-10 absolute top-0 bottom-0 left-0 right-0 bg-black pointer-events-none`}
initial={{ opacity: 0 }} initial={{ opacity: 0 }}
animate={{ opacity: 0.75, top: -200, left: -20, right: -20, bottom: 120 }} animate={{
transition={{ type: "tween", duration: 0.1 }} opacity: 0.75,
></m.div> : null} top: -200,
left: -20,
right: -20,
bottom: 120,
}}
transition={{ type: "tween", duration: 0.1 }}></m.div>
) : null}
</AnimatePresence> </AnimatePresence>
<div className="z-20 relative mb-2.5 w-full h-full flex-wrap justify-center items-center gap-2.5 inline-flex"> <div className="z-20 relative mb-2 w-full h-full flex-wrap justify-center items-center gap-2 inline-flex">
{phrases.map((phrase, index) => ( {phrases.map((phrase, index) => (
<div key={`SeedPhrase_${index}`} className={`justify-center items-center gap-2.5 flex w-[calc(33%-10px)] h-10 rounded border border-current relative ring-current text-neutral-700`}> <div
<span className=" text-white text-md font-normal leading-normal w-full h-fit px-2.5 bg-transparent text-center">{phrase}</span> key={`SeedPhrase_${index}`}
<span className="left-[6px] top-0 absolute text-current text-xs font-normal leading-normal">{index + 1}</span> className={`${TW_PREFIX} relative justify-center items-center gap-2 flex h-10 rounded border border-current ring-current text-neutral-700 w-[calc(33%-8px)]`}>
<span
className={`${TW_PREFIX} text-white text-md font-normal leading-normal w-full h-fit px-2 bg-transparent text-center`}>
{phrase}
</span>
<span
className={`${TW_PREFIX} left-[6px] top-0 absolute text-current text-xs font-normal leading-normal`}>
{index + 1}
</span>
</div> </div>
))} ))}
<AnimatePresence> <AnimatePresence>
{step === 1 ? <m.div className="text-red-400 flex flex-row gap-5 py-8" {step === 1 ? (
<m.div
className="text-red-400 flex flex-row gap-5 py-8"
initial={{ opacity: 0, y: 50 }} initial={{ opacity: 0, y: 50 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 50 }} exit={{ opacity: 0, y: 50 }}
transition={{ type: "linear", delay: 0.2, duration: 0.5 }} transition={{ type: "linear", delay: 0.2, duration: 0.5 }}>
>
<ExclamationTriangleIcon className="w-14 h-14" /> <ExclamationTriangleIcon className="w-14 h-14" />
<span>Make sure to write this down for safe keeping.</span> <span>Make sure to write this down for safe keeping.</span>
</m.div> : null} </m.div>
) : null}
</AnimatePresence> </AnimatePresence>
<Button className={`w-full h-12 ${buttonClickedState === 'clicked' ? '!text-primary !border-primary' : ''}`} variant="outline" onClick={copyPhrasesToClipboard}> <Button
{buttonClickedState === 'clicked' ? <CheckIcon className="w-5 h-5 mr-2.5" /> : <ClipboardCopyIcon className="w-5 h-5 mr-2.5" />} className={`${TW_PREFIX} w-[calc(100%-8px)] h-12 ${
{buttonClickedState === 'clicked' ? 'Copied!' : 'Copy Account Key'} buttonClickedState === "clicked"
? "!text-primary !border-primary"
: ""
}`}
variant="outline"
onClick={copyPhrasesToClipboard}>
{buttonClickedState === "clicked" ? (
<CheckIcon className="w-5 h-5 mr-2.5" />
) : (
<ClipboardCopyIcon className="w-5 h-5 mr-2.5" />
)}
{buttonClickedState === "clicked" ? "Copied!" : "Copy Account Key"}
</Button> </Button>
</div> </div>
{step === 0 ? ( {step === 0 ? (
<Button className="z-20 w-full h-12 text-white bg-neutral-700 hover:bg-neutral-800" variant="secondary" onClick={() => setStep(1)}> <Button
className="z-20 ml-1 w-[calc(100%-8px)] h-12 text-white border border-neutral-700 bg-neutral-700 hover:bg-neutral-800"
variant="secondary"
onClick={() => setStep(1)}>
Continue Continue
</Button> </Button>
) : null} ) : null}
<AnimatePresence> <AnimatePresence>
{step === 1 ? <m.div className="z-20 w-full h-12" {step === 1 ? (
<m.div
className="z-20 w-full h-12"
initial={{ opacity: 0, y: -50 }} initial={{ opacity: 0, y: -50 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 50 }} exit={{ opacity: 0, y: 50 }}
transition={{ type: "linear", delay: 2, duration: 0.5 }} transition={{ type: "linear", delay: 2, duration: 0.5 }}>
> <Button
<Button className="w-full h-full" onClick={() => signIn(key)}> className="w-full h-full"
onClick={async () => signIn(await seedToKey(key))}>
Sign In Sign In
</Button> </Button>
</m.div> : null} </m.div>
) : null}
</AnimatePresence> </AnimatePresence>
</div> </div>
) );
}; };
export const SubmitButton = makeSwitchable(SubmitButtonComponent, 'submit-button'); export const SubmitButton = makeSwitchable(
export const SeedPhraseInput = makeSwitchable(SeedPhraseInputComponent, 'seed-phrase-input'); SubmitButtonComponent,
export const SetupAccountKey = makeSwitchable(SetupAccountKeyComponent, 'setup-account-key'); "submit-button",
export const SeedPhraseGeneration = makeSwitchable(SeedPhraseGenerationComponent, 'seed-phrase-form'); );
export const SeedPhraseInput = makeSwitchable(
SeedPhraseInputComponent,
"seed-phrase-input",
);
export const SetupAccountKey = makeSwitchable(
SetupAccountKeyComponent,
"setup-account-key",
);
export const SeedPhraseGeneration = makeSwitchable(
SeedPhraseGenerationComponent,
"seed-phrase-form",
);

View File

@ -1,74 +0,0 @@
import React, { useContext } from 'react';
type LumeSyncState = 'syncing' | 'done' | 'error'
export type Chain = {
syncState: LumeSyncState,
name: string,
chainId: string,
active: boolean,
progress: number, // in porcentage
logs: string[],
type: 'blockchain' | 'content',
peerCount?: number
}
type LumeObject = {
chains: Chain[],
activeResolver: 'local' | 'rpc'
}
type LumeContext = {
lume: LumeObject
}
const LumeContext = React.createContext<LumeContext | undefined>(undefined);
const LumeProvider = ({ children }: { children: React.ReactNode }) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [lume, _setLume] = React.useState<LumeObject>({
chains: [
{
name: 'Ethereum',
syncState: 'done',
chainId: '1',
active: true,
progress: 100,
logs: [],
type: 'blockchain'
},
{
name: "IPFS",
syncState: 'syncing',
chainId: '2',
active: false,
progress: 50,
logs: [],
type: 'content',
peerCount: 3
}
],
activeResolver: 'local',
});
// Here you can add the logic to update the lume state
return (
<LumeContext.Provider value={{ lume }}>
{children}
</LumeContext.Provider>
);
};
export default LumeProvider;
export function useLume() {
const ctx = useContext(LumeContext);
if (!ctx) {
throw new Error('useLume must be used within a LumeProvider');
}
const { lume } = ctx;
return lume
}

View File

@ -1,8 +1,8 @@
import * as React from "react" import * as React from "react";
import { Slot } from "@radix-ui/react-slot" import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority" import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "../../components/utils" import { cn } from "../utils";
const buttonVariants = cva( const buttonVariants = cva(
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
@ -31,27 +31,27 @@ const buttonVariants = cva(
variant: "default", variant: "default",
size: "default", size: "default",
}, },
} },
) );
export interface ButtonProps export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> { VariantProps<typeof buttonVariants> {
asChild?: boolean asChild?: boolean;
} }
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => { ({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button" const Comp = asChild ? Slot : "button";
return ( return (
<Comp <Comp
className={cn(buttonVariants({ variant, size, className }))} className={cn(buttonVariants({ variant, size, className }))}
ref={ref} ref={ref}
{...props} {...props}
/> />
) );
} },
) );
Button.displayName = "Button" Button.displayName = "Button";
export { Button, buttonVariants } export { Button, buttonVariants };

View File

@ -1,9 +1,9 @@
import * as React from "react" import * as React from "react";
import { cn } from "../../components/utils" import { cn } from "../utils";
export interface InputProps export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> { } extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>( const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => { ({ className, type, ...props }, ref) => {
@ -12,14 +12,14 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
type={type} type={type}
className={cn( className={cn(
"flex h-9 w-full text-white rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 focus:border-white", "flex h-9 w-full text-white rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 focus:border-white",
className className,
)} )}
ref={ref} ref={ref}
{...props} {...props}
/> />
) );
} },
) );
Input.displayName = "Input" Input.displayName = "Input";
export { Input } export { Input };

View File

@ -1,6 +1,6 @@
import { type ClassValue, clsx } from "clsx" import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge" import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) { export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs)) return twMerge(clsx(inputs));
} }

24
src/index.ts Normal file
View File

@ -0,0 +1,24 @@
export {
default as AuthProvider,
useAuth,
type AuthContextType,
} from "./components/AuthProvider";
export {
default as NetworksProvider,
useNetworks,
type NetworksContextType,
} from "./components/NetworksProvider";
export {
default as LumeStatusProvider,
useLumeStatus,
type LumeStatusContextType,
} from "./components/LumeStatusProvider";
export {
default as LumeDashboard,
LumeDashboardTrigger,
} from "./components/lume/LumeDashboard/LumeDashboard";
export {
default as LumeIdentity,
LumeIdentityTrigger,
} from "./components/lume/LumeIdentity/LumeIdentity";
import "../styles/globals.css";

View File

@ -1,4 +0,0 @@
export { default as LumeProvider, useLume } from './components/lume/LumeProvider';
export { default as LumeDashboard } from './components/lume/LumeDashboard/LumeDashboard';
export { default as LumeIdentity } from './components/lume/LumeIdentity/LumeIdentity';
import "../styles/globals.css";

View File

@ -0,0 +1,20 @@
import React from "react";
import { StoryFn, Meta } from "@storybook/react";
import LumeDashboard from "../src/components/lume/LumeDashboard/LumeDashboard.js";
import NetworksProvider from "../src/components/NetworksProvider.js";
export default {
title: "LumeDashboard",
component: LumeDashboard,
} as Meta<typeof LumeDashboard>;
const Template: StoryFn<typeof LumeDashboard> = (args) => (
<NetworksProvider>
<LumeDashboard {...args} />
</NetworksProvider>
);
export const Primary = Template.bind({});
Primary.args = {
// Add initial props here
};

View File

@ -0,0 +1,20 @@
import React from "react";
import { StoryFn, Meta } from "@storybook/react";
import LumeIdentity from "../src/components/lume/LumeIdentity/LumeIdentity.js";
import AuthProvider from "../src/components/AuthProvider.js";
export default {
title: "LumeIdentity",
component: LumeIdentity,
} as Meta<typeof LumeIdentity>;
const Template: StoryFn<typeof LumeIdentity> = (args) => (
<AuthProvider>
<LumeIdentity {...args} />
</AuthProvider>
);
export const Primary = Template.bind({});
Primary.args = {
// Add initial props here
};

View File

@ -1,15 +1,9 @@
import {type Config} from "tailwindcss"; import { type Config } from "tailwindcss";
export default { export default {
darkMode: ["class"], darkMode: ["class"],
content: [ content: ["./src/**/*.{ts,tsx}"],
'./src/**/*.{ts,tsx}', safelist: ["text-primary", "text-red-500", "text-orange-500"],
],
safelist: [
'text-primary',
'text-red-500',
'text-orange-500',
],
theme: { theme: {
container: { container: {
center: true, center: true,
@ -76,4 +70,4 @@ export default {
}, },
}, },
plugins: [require("tailwindcss-animate")], plugins: [require("tailwindcss-animate")],
} satisfies Config } satisfies Config;

View File

@ -1,47 +0,0 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"composite": true,
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"outDir": "./dist",
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
// "paths": {
// "@/*": ["src/*"],
// "@/styles/*": ["styles/*"],
// },
"typeRoots": [
"src/vite-env.d.ts"
]
},
"include": [
"./src/**/*",
// "./src/components/lume/LumeDashboard/LumeDashboard."
],
"exclude": [
"**/*.stories.tsx"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

View File

@ -1,41 +0,0 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"composite": true,
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
// "paths": {
// "@/*": ["src/*"],
// "@/styles/*": ["styles/*"],
// },
"typeRoots": ["src/vite-env.d.ts"]
},
"include": [
"src",
"scripts",
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

View File

@ -1,13 +0,0 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": [
"vite.config.ts",
"lib"
]
}

View File

@ -1,23 +1,34 @@
import { defineConfig } from "vite" import { defineConfig } from "vite";
import react from "@vitejs/plugin-react" import react from "@vitejs/plugin-react";
import scopeTailwind from "./lib/vite-plugin-scope-tailwind/src/main" import scopeTailwind from "vite-plugin-scope-tailwind";
import { resolve } from "path" import { resolve } from "path";
import svgr from "vite-plugin-svgr" import svgr from "vite-plugin-svgr";
import dts from "vite-plugin-dts" import dts from "vite-plugin-dts";
// import css from 'rollup-plugin-css-only' import optimizer from "vite-plugin-optimizer";
import noBundlePlugin from "vite-plugin-no-bundle";
import { TW_PREFIX } from "./scoped-tailwind-prefix";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
svgr(), svgr(),
react(), react(),
scopeTailwind({ react: true, classNameTransformers: ["cn"] }), scopeTailwind({
dts({ react: true,
tsconfigPath: "tsconfig.build.json" prefix: TW_PREFIX,
classNameTransformers: ["cn"],
}), }),
// css({ output: 'styles/globals.css' }) dts({
tsconfigPath: "tsconfig.build.json",
}),
optimizer({
"node-fetch":
"const e = undefined; export default e;export {e as Response, e as FormData, e as Blob};",
}),
noBundlePlugin(),
], ],
resolve: { resolve: {
dedupe: ["@lumeweb/libportal", "@lumeweb/libweb", "@lumeweb/libkernel"],
// TODO: For some reason aliases are not working.... // TODO: For some reason aliases are not working....
// alias: { // alias: {
// '@styles/': resolve(__dirname, './styles'), // '@styles/': resolve(__dirname, './styles'),
@ -27,23 +38,30 @@ export default defineConfig({
// }, // },
}, },
build: { build: {
manifest: true, manifest: false,
outDir: "dist", outDir: "lib",
emptyOutDir: true, emptyOutDir: true,
sourcemap: true, sourcemap: true,
minify: false,
lib: { lib: {
entry: resolve(__dirname, "src/main.ts"), entry: resolve(__dirname, "src/index.ts"),
name: "lume-sdk", name: "sdk",
fileName: (format) => `lib.${format}.js` fileName: "index",
formats: ["es"],
}, },
rollupOptions: { rollupOptions: {
output: {
inlineDynamicImports: false,
},
external: [ external: [
"react", "react",
"react-dom", "react-dom",
// "framer-motion", "@lumeweb/libportal",
// "tailwind-merge", "@lumeweb/libweb",
// "class-variance-authority" "@lumeweb/libkernel/module",
] "@lumeweb/libkernel/kernel",
} "@lumeweb/libkernel",
} ],
}) },
},
});