Compare commits
188 Commits
Author | SHA1 | Date |
---|---|---|
Juan Di Toro | 6c3c4b12f2 | |
Juan Di Toro | dc1dc4333c | |
Juan Di Toro | 6f378fbcac | |
Juan Di Toro | 5e187546b4 | |
Derrick Hammer | 74c3911acf | |
Derrick Hammer | d84fd76b03 | |
Derrick Hammer | f9915f5df9 | |
Derrick Hammer | 103a38b361 | |
Derrick Hammer | a5d1130b45 | |
semantic-release-bot | 0859ea612a | |
Derrick Hammer | 3007010860 | |
Derrick Hammer | a1968f43d0 | |
semantic-release-bot | 2da158175c | |
Juan Di Toro | 546a123874 | |
Juan Di Toro | 88e08d13e2 | |
semantic-release-bot | 5d7a9ecace | |
Juan Di Toro | 2aa2a5ff30 | |
semantic-release-bot | 8d654cf6b2 | |
Juan Di Toro | 4369682133 | |
Juan Di Toro | fe8a6a7de4 | |
semantic-release-bot | b50c6243f5 | |
Juan Di Toro | a7f5ee266d | |
semantic-release-bot | e25458191a | |
Derrick Hammer | 7d404cae46 | |
Derrick Hammer | d074ef507d | |
semantic-release-bot | 5e6cf035d9 | |
Derrick Hammer | f1f5d24efa | |
Derrick Hammer | cdf20a85cc | |
Derrick Hammer | dfd3f1490c | |
Derrick Hammer | dc3fe6adb6 | |
semantic-release-bot | a1636f29d7 | |
Derrick Hammer | 40f6699064 | |
Derrick Hammer | c18fc924a4 | |
semantic-release-bot | f85ac28f09 | |
Derrick Hammer | 4d54603ee5 | |
Derrick Hammer | 8a57d5d4af | |
semantic-release-bot | 4b2975d013 | |
Derrick Hammer | 5bb1d8fc8a | |
Derrick Hammer | 2567620b6b | |
semantic-release-bot | aa1568dffb | |
Derrick Hammer | 9d736f29c2 | |
Derrick Hammer | 11ceeb7916 | |
semantic-release-bot | 271a43b8d1 | |
Derrick Hammer | 3d2b9ddbec | |
Derrick Hammer | 7c35c45904 | |
semantic-release-bot | d07242b496 | |
Derrick Hammer | 4798fc8b1b | |
Derrick Hammer | 461147b7ac | |
semantic-release-bot | ee445e4340 | |
Derrick Hammer | 61b7f4c376 | |
Derrick Hammer | b26f31e4d8 | |
semantic-release-bot | 479690700d | |
Derrick Hammer | cd51b27e89 | |
Derrick Hammer | 897405b092 | |
semantic-release-bot | b079759a6b | |
Derrick Hammer | 4a229059c2 | |
Derrick Hammer | d77c4c2a60 | |
Derrick Hammer | cccdfdedbb | |
semantic-release-bot | 074550bd54 | |
Derrick Hammer | 8014c5a86c | |
Derrick Hammer | d886b6f2d0 | |
semantic-release-bot | 9fc73a42fa | |
Derrick Hammer | 9c218a44d6 | |
Derrick Hammer | 1de4d2c013 | |
semantic-release-bot | f687cf07c0 | |
Derrick Hammer | c2b0bd2813 | |
Derrick Hammer | 02fd3e558f | |
semantic-release-bot | 304df7bf96 | |
Derrick Hammer | 9f7677885c | |
Derrick Hammer | cbfce62f95 | |
semantic-release-bot | 7f2c4fd67d | |
Derrick Hammer | 971991e808 | |
Derrick Hammer | c77725d915 | |
semantic-release-bot | 4ac23efb08 | |
Derrick Hammer | 06a2f94be0 | |
Derrick Hammer | aa6ede68f0 | |
semantic-release-bot | 62459cfb3a | |
Derrick Hammer | 2ffc9a69f0 | |
Derrick Hammer | 40ea3f9fc0 | |
semantic-release-bot | b2626c5ef9 | |
Derrick Hammer | 8493ac1e63 | |
Derrick Hammer | bf023856b9 | |
semantic-release-bot | 0397c695e2 | |
Derrick Hammer | a0cd05af73 | |
Derrick Hammer | ba38e6be70 | |
semantic-release-bot | 8d2b7b461b | |
Derrick Hammer | 9c876c834a | |
Derrick Hammer | f68070e38c | |
semantic-release-bot | 7aed936a0b | |
Derrick Hammer | ccce11d34d | |
Derrick Hammer | dfe87396b9 | |
semantic-release-bot | 2073518bd0 | |
Derrick Hammer | da80872c3c | |
Derrick Hammer | 03434b4329 | |
semantic-release-bot | 9dd4f05e9b | |
Derrick Hammer | e574100bb5 | |
Derrick Hammer | 92c18ca940 | |
semantic-release-bot | 531e1f3167 | |
Derrick Hammer | fa0bfb0015 | |
Derrick Hammer | e1e82adef8 | |
semantic-release-bot | 3db776fd3c | |
Derrick Hammer | 4f5118fe34 | |
Derrick Hammer | ba86a13d8d | |
semantic-release-bot | be7365bcd4 | |
Derrick Hammer | 128bba978e | |
Derrick Hammer | ef1d307b4b | |
semantic-release-bot | 4879651a2f | |
Derrick Hammer | 1642fd44e4 | |
Derrick Hammer | 8d54ad3a59 | |
semantic-release-bot | 06ebef7583 | |
Juan Di Toro | 0db2a24f92 | |
Derrick Hammer | d08360d975 | |
semantic-release-bot | 88d1121d1f | |
Juan Di Toro | e259d74c8b | |
Juan Di Toro | f9664fc849 | |
Juan Di Toro | 099b2f2c64 | |
Derrick Hammer | 34d25e1188 | |
semantic-release-bot | a4bb67a3ac | |
Juan Di Toro | ee32356938 | |
Juan Di Toro | 7b1dc37e72 | |
semantic-release-bot | 6e1ae56a29 | |
Juan Di Toro | 7fc193ce72 | |
semantic-release-bot | b93ee7fa18 | |
Derrick Hammer | 935675f7e8 | |
Derrick Hammer | c5c6b83338 | |
semantic-release-bot | 2cd83b0b4f | |
Juan Di Toro | 7f30d9091a | |
Juan Di Toro | 4e5b8a5eab | |
Derrick Hammer | 8c253146de | |
semantic-release-bot | c59c801b2d | |
Derrick Hammer | cfee64bccb | |
Derrick Hammer | 514a134203 | |
semantic-release-bot | 6cce089ad7 | |
Derrick Hammer | 223cc991a2 | |
Derrick Hammer | 18efdbe39d | |
semantic-release-bot | a573692880 | |
Derrick Hammer | 2cea6d0974 | |
Derrick Hammer | 2ef8e09346 | |
Derrick Hammer | 0927bc566d | |
Derrick Hammer | 4873f41511 | |
semantic-release-bot | 5664e652a1 | |
Derrick Hammer | d4d3310447 | |
Derrick Hammer | dcc1428743 | |
semantic-release-bot | d8ffbbcf00 | |
Derrick Hammer | e51a0a3483 | |
Derrick Hammer | bac7a90f18 | |
Derrick Hammer | 397a014038 | |
Derrick Hammer | 9e26d23323 | |
Derrick Hammer | d2e44bf986 | |
Derrick Hammer | 0e740775cb | |
Derrick Hammer | 39f3984ee4 | |
Derrick Hammer | cce13287c3 | |
Derrick Hammer | 5a7c0b01b0 | |
Derrick Hammer | cc03b056e3 | |
Derrick Hammer | 0fab4d7f0d | |
Derrick Hammer | cf41ca6d85 | |
Derrick Hammer | cb1b30d826 | |
Derrick Hammer | e3236b557c | |
Derrick Hammer | f2f6c44803 | |
Derrick Hammer | 0d00283ba1 | |
Derrick Hammer | 6c17ea89d9 | |
Derrick Hammer | 185611f09a | |
Derrick Hammer | bb2bfe406f | |
Derrick Hammer | a04917449e | |
Derrick Hammer | 0551582887 | |
Derrick Hammer | 349fa936d5 | |
Derrick Hammer | 4982a3dd1a | |
Derrick Hammer | 32afd2f4ae | |
Derrick Hammer | 1d1a02527b | |
Derrick Hammer | c3400859dc | |
Derrick Hammer | baa4365abb | |
Derrick Hammer | 9d4a503c5c | |
Derrick Hammer | ba09919807 | |
Derrick Hammer | 9911ab0168 | |
Derrick Hammer | 31c5ec8bbe | |
Juan Di Toro | 3f4c89b3b1 | |
Juan Di Toro | a1564d9c21 | |
Juan Di Toro | ef85d921a6 | |
Juan Di Toro | 14c7f5401b | |
Juan Di Toro | 933ba14510 | |
Juan Di Toro | ef63ea067e | |
Juan Di Toro | 1fd163afc8 | |
Juan Di Toro | 3ba4734e74 | |
Juan Di Toro | aba02687db | |
Juan Di Toro | c043c5b6a1 | |
Juan Di Toro | 4e4ced81ba | |
Juan Di Toro | 4d0f13a197 | |
Juan Di Toro | 057b3c1e53 |
|
@ -0,0 +1,14 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
env: { browser: true, es2020: true },
|
||||||
|
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:storybook/recommended'],
|
||||||
|
ignorePatterns: ['dist', '.eslintrc.cjs', 'scripts'],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: ['react-refresh'],
|
||||||
|
rules: {
|
||||||
|
'react-refresh/only-export-components': [
|
||||||
|
'warn',
|
||||||
|
{ allowConstantExport: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
|
@ -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
|
|
@ -0,0 +1,24 @@
|
||||||
|
# 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?
|
|
@ -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}"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
import type { StorybookConfig } from "@storybook/react-vite";
|
||||||
|
|
||||||
|
const config: StorybookConfig = {
|
||||||
|
stories: ["../stories", "../stories/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
||||||
|
addons: [
|
||||||
|
"@storybook/addon-links",
|
||||||
|
"@storybook/addon-essentials",
|
||||||
|
"@storybook/addon-onboarding",
|
||||||
|
"@storybook/addon-interactions",
|
||||||
|
],
|
||||||
|
framework: {
|
||||||
|
name: "@storybook/react-vite",
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
docs: {
|
||||||
|
autodocs: "tag",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export default config;
|
|
@ -0,0 +1,16 @@
|
||||||
|
import type { Preview } from "@storybook/react";
|
||||||
|
import "../styles/globals.css";
|
||||||
|
|
||||||
|
const preview: Preview = {
|
||||||
|
parameters: {
|
||||||
|
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||||
|
controls: {
|
||||||
|
matchers: {
|
||||||
|
color: /(background|color)$/i,
|
||||||
|
date: /Date$/,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default preview;
|
|
@ -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))
|
2
LICENSE
2
LICENSE
|
@ -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:
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,88 @@
|
||||||
|
{
|
||||||
|
"name": "@lumeweb/sdk",
|
||||||
|
"version": "0.1.0-develop.44",
|
||||||
|
"type": "module",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"types": "lib/src/index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "gitea@git.lumeweb.com:LumeWeb/sdk.git"
|
||||||
|
},
|
||||||
|
"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": {
|
||||||
|
"@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-icons": "^1.3.0",
|
||||||
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
|
"@scure/bip39": "^1.2.1",
|
||||||
|
"camelcase": "^8.0.0",
|
||||||
|
"class-variance-authority": "^0.7.0",
|
||||||
|
"clsx": "^2.0.0",
|
||||||
|
"framer-motion": "^10.16.4",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"tailwind-merge": "^1.14.0",
|
||||||
|
"tailwindcss-animate": "^1.0.7",
|
||||||
|
"vite-plugin-node-polyfills": "^0.15.0"
|
||||||
|
},
|
||||||
|
"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-interactions": "^7.4.6",
|
||||||
|
"@storybook/addon-links": "^7.4.6",
|
||||||
|
"@storybook/addon-onboarding": "^1.0.8",
|
||||||
|
"@storybook/blocks": "^7.4.6",
|
||||||
|
"@storybook/react": "^7.4.6",
|
||||||
|
"@storybook/react-vite": "^7.4.6",
|
||||||
|
"@storybook/testing-library": "^0.2.2",
|
||||||
|
"@types/react": "^18.2.25",
|
||||||
|
"@types/react-dom": "^18.2.11",
|
||||||
|
"@types/uniqid": "^5.3.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||||
|
"@typescript-eslint/parser": "^6.7.4",
|
||||||
|
"@vitejs/plugin-react": "^4.1.0",
|
||||||
|
"autoprefixer": "^10.4.16",
|
||||||
|
"class-variance-authority": "^0.7.0",
|
||||||
|
"eslint": "^8.51.0",
|
||||||
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.3",
|
||||||
|
"eslint-plugin-storybook": "^0.6.15",
|
||||||
|
"framer-motion": "^10.16.4",
|
||||||
|
"json": "^11.0.0",
|
||||||
|
"patch-package": "^8.0.0",
|
||||||
|
"postcss": "^8.4.31",
|
||||||
|
"presetter": "*",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"storybook": "^7.4.6",
|
||||||
|
"tailwind-merge": "^1.14.0",
|
||||||
|
"tailwindcss": "^3.3.3",
|
||||||
|
"tailwindcss-animate": "^1.0.7",
|
||||||
|
"typescript": "^5.2.2",
|
||||||
|
"uniqid": "^5.4.0",
|
||||||
|
"vite": "^4.4.11",
|
||||||
|
"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-svgr": "^4.1.0"
|
||||||
|
},
|
||||||
|
"readme": "ERROR: No README data found!",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports = {
|
||||||
|
"plugins": {
|
||||||
|
"autoprefixer": {},
|
||||||
|
"tailwindcss": {}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
export const TW_PREFIX = 'lumesdk'
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env zx
|
||||||
|
import "zx/globals"
|
||||||
|
|
||||||
|
const buildCmd = $`pnpm run build-pkg`
|
||||||
|
|
||||||
|
const ogPackageJson = JSON.parse(await fs.readFile(path.resolve(process.cwd(), 'package.json'), "utf-8"))
|
||||||
|
const externals = ['react', 'react-dom']
|
||||||
|
const externalOnOgPackageJsonDeps = Object.keys(ogPackageJson.dependencies)
|
||||||
|
.filter((d) => externals.includes(d))
|
||||||
|
.reduce((acc, dK) => ({ ...acc, [dK]: ogPackageJson.dependencies[dK] }), {})
|
||||||
|
|
||||||
|
const packageJson = {
|
||||||
|
name: "@lume-sdk/components",
|
||||||
|
version: ogPackageJson.version,
|
||||||
|
main: "./lib.umd.js",
|
||||||
|
module: "./lib.es.js",
|
||||||
|
types: "./src/main.d.ts",
|
||||||
|
files: ["./src", "./style.css"],
|
||||||
|
peerDependencies: externalOnOgPackageJsonDeps
|
||||||
|
}
|
||||||
|
|
||||||
|
await buildCmd
|
||||||
|
await $`echo ${JSON.stringify(packageJson)} > ./dist/package.json`
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 112 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -0,0 +1,112 @@
|
||||||
|
import { Variant, AnimatePresence, m } from "framer-motion";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const SwitchableComponentContext = React.createContext<
|
||||||
|
SwitchableComponentContextType | undefined
|
||||||
|
>(undefined);
|
||||||
|
|
||||||
|
export const SwitchableComponentProvider = ({
|
||||||
|
children,
|
||||||
|
}: React.PropsWithChildren) => {
|
||||||
|
const [visibleComponent, setVisibleComponent] =
|
||||||
|
React.useState<SwitchableComponentType>();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SwitchableComponentContext.Provider
|
||||||
|
value={{
|
||||||
|
visibleComponent: visibleComponent ?? DEFAULT_COMPONENT,
|
||||||
|
setVisibleComponent,
|
||||||
|
}}>
|
||||||
|
{children}
|
||||||
|
</SwitchableComponentContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export function useSwitchableComponent(initialValue?: SwitchableComponentType) {
|
||||||
|
const contextValue = React.useContext(SwitchableComponentContext);
|
||||||
|
|
||||||
|
if (contextValue === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
"useSwitchableComponent hook is being used outside of its context. Please ensure that it is wrapped within a <SwitchableComponentProvider>.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
React.useEffect(() => {
|
||||||
|
// Set the initial value if it's provided
|
||||||
|
if (initialValue && contextValue.visibleComponent) {
|
||||||
|
contextValue.setVisibleComponent(initialValue);
|
||||||
|
}
|
||||||
|
}, [initialValue]);
|
||||||
|
|
||||||
|
return contextValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const variants: Record<string, Variant> = {
|
||||||
|
hidden: { y: 50, opacity: 0, position: "absolute" },
|
||||||
|
show: {
|
||||||
|
y: 0,
|
||||||
|
x: 0,
|
||||||
|
opacity: 1,
|
||||||
|
position: "relative",
|
||||||
|
transition: {
|
||||||
|
type: "tween",
|
||||||
|
ease: "easeInOut",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exit: { y: -50, opacity: 0, position: "absolute" },
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SwitchableComponent = ({
|
||||||
|
children,
|
||||||
|
index,
|
||||||
|
}: React.PropsWithChildren<{ index: string }>) => {
|
||||||
|
const [width, setWidth] = React.useState<number>();
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
<m.div
|
||||||
|
key={index}
|
||||||
|
initial="hidden"
|
||||||
|
animate="show"
|
||||||
|
exit="exit"
|
||||||
|
variants={variants}
|
||||||
|
className="h-full w-full"
|
||||||
|
style={{ maxWidth: width ?? "auto" }}
|
||||||
|
onTransitionEnd={(e) =>
|
||||||
|
setWidth(e.currentTarget.getBoundingClientRect().width!)
|
||||||
|
}>
|
||||||
|
{children}
|
||||||
|
</m.div>
|
||||||
|
</AnimatePresence>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
>
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const DEFAULT_COMPONENT = {
|
||||||
|
render: () => undefined,
|
||||||
|
index: Symbol("DEFAULT_COMPONENT").toString(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Factory function
|
||||||
|
export function makeSwitchable<T extends {}>(
|
||||||
|
Component: React.FC<T>,
|
||||||
|
index: string,
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
render(props: T) {
|
||||||
|
return <Component {...props} />;
|
||||||
|
},
|
||||||
|
index: index || Symbol(Component.name).toString(),
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
import * as Dialog from "@radix-ui/react-dialog";
|
||||||
|
import Logo from "../../../assets/lume-logo.png";
|
||||||
|
import { cva } from "class-variance-authority";
|
||||||
|
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> = {
|
||||||
|
done: "Synced",
|
||||||
|
error: "Issue",
|
||||||
|
syncing: "Syncing",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LumeDashboardTrigger = Dialog.Trigger;
|
||||||
|
LumeDashboardTrigger.displayName = "LumeDashboardTrigger";
|
||||||
|
|
||||||
|
const LumeDashboard = (props: any) => {
|
||||||
|
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 (
|
||||||
|
<Dialog.Root>
|
||||||
|
<Trigger {...props} />
|
||||||
|
<Dialog.Portal>
|
||||||
|
<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">
|
||||||
|
<div className="w-[calc(100%+38px)] border-b pb-3 -mx-5 px-5 border-neutral-900">
|
||||||
|
<img src={Logo} className="w-24" />
|
||||||
|
</div>
|
||||||
|
{uniqueNetworkTypes.map((type, index) => (
|
||||||
|
<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">
|
||||||
|
{networks
|
||||||
|
.filter((network) => network.type === type)
|
||||||
|
.map((network, networkIndex) => (
|
||||||
|
<NetworkIndicator
|
||||||
|
key={`${type}_ChainIndicator_${networkIndex}`}
|
||||||
|
network={network}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Dialog.Content>
|
||||||
|
</Dialog.Portal>
|
||||||
|
</Dialog.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const chainIndicatorVariant = cva("chainIndicatorVariant", {
|
||||||
|
variants: {
|
||||||
|
syncState: {
|
||||||
|
done: "text-primary",
|
||||||
|
error: "text-red-500",
|
||||||
|
syncing: "text-orange-500",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const NetworkIndicator = ({ network }: { network: Network }) => {
|
||||||
|
return (
|
||||||
|
<div key={network.id} className="flex flex-row gap-x-2 items-center ">
|
||||||
|
<CircularProgress chain={network} />
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<span>{network.name}</span>
|
||||||
|
<span
|
||||||
|
className={cn([
|
||||||
|
"text-[12px] -mt-1",
|
||||||
|
chainIndicatorVariant({ syncState: network.syncState }),
|
||||||
|
])}>
|
||||||
|
{SYNCSTATE_TO_TEXT[network.syncState]}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const CircularProgress = ({
|
||||||
|
chain,
|
||||||
|
className,
|
||||||
|
}: {
|
||||||
|
chain: Network;
|
||||||
|
className?: string;
|
||||||
|
}) => {
|
||||||
|
const size = 70;
|
||||||
|
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 (
|
||||||
|
<svg
|
||||||
|
className={cn([
|
||||||
|
className,
|
||||||
|
chainIndicatorVariant({ syncState: chain.syncState }),
|
||||||
|
])}
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
viewBox={`0 0 ${size} ${size}`}
|
||||||
|
version="1.1"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
style={{ transform: "rotate(-90deg)" }}>
|
||||||
|
<circle
|
||||||
|
r={size / 2 - 10}
|
||||||
|
cx={size / 2}
|
||||||
|
cy={size / 2}
|
||||||
|
fill="transparent"
|
||||||
|
stroke="#e0e0e0"
|
||||||
|
strokeWidth={`${circleWidth}px`}
|
||||||
|
strokeDasharray={`${circumference}px`}></circle>
|
||||||
|
<circle
|
||||||
|
r={size / 2 - 10}
|
||||||
|
cx={size / 2}
|
||||||
|
cy={size / 2}
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth={`${progressWidth}px`}
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeDashoffset={`${offset}px`}
|
||||||
|
fill="transparent"
|
||||||
|
strokeDasharray={`${circumference}px`}></circle>
|
||||||
|
<text
|
||||||
|
x="27px"
|
||||||
|
y="39px"
|
||||||
|
fill="currentColor"
|
||||||
|
fontSize={`${fontSize}px`}
|
||||||
|
fontWeight="normal"
|
||||||
|
style={{ transform: "rotate(90deg) translate(0px, -66px)" }}>
|
||||||
|
{chain.sync}
|
||||||
|
</text>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LumeDashboard;
|
|
@ -0,0 +1,150 @@
|
||||||
|
import React, { useState, type FC, useRef, useEffect } from "react";
|
||||||
|
import { Button } from "../../ui/button";
|
||||||
|
import {
|
||||||
|
SwitchableComponent,
|
||||||
|
SwitchableComponentProvider,
|
||||||
|
useSwitchableComponent,
|
||||||
|
} from "../../SwitchableComponent";
|
||||||
|
import * as ComponentList from "./components";
|
||||||
|
import { LazyMotion, domAnimation } from "framer-motion";
|
||||||
|
import * as Dialog from "@radix-ui/react-dialog";
|
||||||
|
import LumeLogoBg from "./LumeLogoBg";
|
||||||
|
import { LumeIdentityContext } from "./LumeIdentityContext";
|
||||||
|
|
||||||
|
const LumeIdentity: FC = () => {
|
||||||
|
const { visibleComponent, setVisibleComponent } = useSwitchableComponent(
|
||||||
|
ComponentList.SubmitButton,
|
||||||
|
);
|
||||||
|
|
||||||
|
const isSubmitButtonInView = [ComponentList.SubmitButton.index].includes(
|
||||||
|
visibleComponent.index,
|
||||||
|
);
|
||||||
|
const isLoginWithAccountKey = [ComponentList.SeedPhraseInput.index].includes(
|
||||||
|
visibleComponent.index,
|
||||||
|
);
|
||||||
|
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";
|
||||||
|
|
||||||
|
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="absolute left-[168px] top-[-8px] h-64 w-[280px] overflow-hidden">
|
||||||
|
<LumeLogoBg />
|
||||||
|
</div>
|
||||||
|
<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">
|
||||||
|
<h2 className="w-full text-5xl font-normal leading-14 text-white">
|
||||||
|
{isSubmitButtonInView || isLoginWithAccountKey
|
||||||
|
? "Sign in with Lume"
|
||||||
|
: null}
|
||||||
|
{isCreatingAccount && !isShowingSeedPhrase
|
||||||
|
? "Set up your account key"
|
||||||
|
: null}
|
||||||
|
{isShowingSeedPhrase ? "Here's your account key" : null}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-start justify-start gap-2.5">
|
||||||
|
<LazyMotion features={domAnimation}>
|
||||||
|
<SwitchableComponent index={visibleComponent.index}>
|
||||||
|
<visibleComponent.render />
|
||||||
|
</SwitchableComponent>
|
||||||
|
</LazyMotion>
|
||||||
|
{!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">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
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>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// @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
|
||||||
|
// hitting my screen, it is almost impossible to see whats happening the outline
|
||||||
|
// buttons have no contrast
|
||||||
|
export const LumeIdentityTrigger = Dialog.Trigger;
|
||||||
|
LumeIdentityTrigger.displayName = "LumeIdentityTrigger";
|
||||||
|
export default function Wrapped({ children }: React.PropsWithChildren) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const dialogContentEl = useRef<HTMLElement>();
|
||||||
|
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
|
||||||
|
</button>
|
||||||
|
</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.Overlay className="fixed z-40 inset-0 bg-black bg-opacity-50 backdrop-blur-sm" />
|
||||||
|
{/* @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>
|
||||||
|
<LumeIdentityContext.Provider value={{open, setOpen}}>
|
||||||
|
<LumeIdentity />
|
||||||
|
</LumeIdentityContext.Provider>
|
||||||
|
</SwitchableComponentProvider>
|
||||||
|
</Dialog.Content>
|
||||||
|
</Dialog.Portal>
|
||||||
|
</Dialog.Root>
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
import {
|
||||||
|
login,
|
||||||
|
// loginComplete,
|
||||||
|
// logoutComplete,
|
||||||
|
} from "@lumeweb/libkernel/kernel";
|
||||||
|
import React, { useContext } from "react";
|
||||||
|
import { useAuth } from "../../AuthProvider.js";
|
||||||
|
|
||||||
|
export const LumeIdentityContext = React.createContext<
|
||||||
|
{ open: boolean; setOpen: (open: boolean) => void } | undefined
|
||||||
|
>(undefined);
|
||||||
|
|
||||||
|
export function useLumeIdentity() {
|
||||||
|
const { isLoggedIn, setIsLoggedIn } = useAuth();
|
||||||
|
const ctx = useContext(LumeIdentityContext);
|
||||||
|
|
||||||
|
if (!ctx) {
|
||||||
|
throw new Error(
|
||||||
|
"useLumeIdentity should be used inside LumeIdentityContext.Provider",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { setOpen } = ctx;
|
||||||
|
|
||||||
|
return {
|
||||||
|
isSignedIn: isLoggedIn,
|
||||||
|
async signIn(key: Uint8Array) {
|
||||||
|
await login(key.slice(0, 32));
|
||||||
|
// await loginComplete(); # this function is buggy `auth.ts:42 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'promise') `
|
||||||
|
setIsLoggedIn(true);
|
||||||
|
setOpen(false);
|
||||||
|
},
|
||||||
|
async signOut() {
|
||||||
|
// await logoutComplete();
|
||||||
|
setIsLoggedIn(false);
|
||||||
|
setOpen(false);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,243 @@
|
||||||
|
import {
|
||||||
|
makeSwitchable,
|
||||||
|
useSwitchableComponent,
|
||||||
|
} from "../../SwitchableComponent";
|
||||||
|
import { Button } from "../../ui/button";
|
||||||
|
import { Input } from "../../ui/input";
|
||||||
|
import {
|
||||||
|
CheckIcon,
|
||||||
|
ClipboardCopyIcon,
|
||||||
|
ExclamationTriangleIcon,
|
||||||
|
} from "@radix-ui/react-icons";
|
||||||
|
import { AnimatePresence, m } from "framer-motion";
|
||||||
|
import { useLumeIdentity } 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
|
||||||
|
const SubmitButtonComponent = () => {
|
||||||
|
const { setVisibleComponent } = useSwitchableComponent();
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
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>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const SeedPhraseInputComponent = () => {
|
||||||
|
const { signIn } = useLumeIdentity();
|
||||||
|
return (
|
||||||
|
<m.form
|
||||||
|
className="flex-col flex gap-y-4"
|
||||||
|
onSubmit={async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const target = e.target as typeof e.target & {
|
||||||
|
elements: {
|
||||||
|
seedPhrase: { value: string };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const seedPhrase = target.elements.seedPhrase.value;
|
||||||
|
signIn(await seedToKey(seedPhrase));
|
||||||
|
}}>
|
||||||
|
<Input className="h-12 w-full text-lg" name="seedPhrase" />
|
||||||
|
<m.div
|
||||||
|
initial={{ y: 50 }}
|
||||||
|
animate={{ y: 0 }}
|
||||||
|
exit={{ y: -50 }}
|
||||||
|
transition={{ type: "just", delay: 0.1 }}
|
||||||
|
className="h-12">
|
||||||
|
<Button className="w-full h-full" role="submit">
|
||||||
|
<span className="text-center text-lg font-normal leading-normal">
|
||||||
|
Sign in
|
||||||
|
</span>
|
||||||
|
</Button>
|
||||||
|
</m.div>
|
||||||
|
</m.form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const SetupAccountKeyComponent = () => {
|
||||||
|
const { setVisibleComponent } = useSwitchableComponent();
|
||||||
|
const [width, setWidth] = useState<number>();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<m.div
|
||||||
|
initial={{ y: 50 }}
|
||||||
|
animate={{ y: 0 }}
|
||||||
|
exit={{ y: -50, height: "auto" }}
|
||||||
|
transition={{ type: "just", delay: 0.1 }}
|
||||||
|
className="min-h-12 h-full max-w-full"
|
||||||
|
style={{ maxWidth: width ?? "auto" }}
|
||||||
|
ref={(t) => {
|
||||||
|
if (t) {
|
||||||
|
setTimeout(() => setWidth(t.getBoundingClientRect().width!), 0);
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
<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>
|
||||||
|
</m.div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => {
|
||||||
|
const [buttonClickedState, setButtonClickedState] = useState<
|
||||||
|
"idle" | "clicked"
|
||||||
|
>("idle");
|
||||||
|
const [step, setStep] = useState<number>(0);
|
||||||
|
const { signIn } = useLumeIdentity();
|
||||||
|
|
||||||
|
const phrases = useMemo(() => {
|
||||||
|
return bip39
|
||||||
|
.generateMnemonic(wordlist, getStrength(phraseLength))
|
||||||
|
.split(" ");
|
||||||
|
}, [phraseLength]);
|
||||||
|
|
||||||
|
const key = useMemo(() => {
|
||||||
|
return phrases.join(" ");
|
||||||
|
}, [phrases]);
|
||||||
|
|
||||||
|
const copyPhrasesToClipboard = () => {
|
||||||
|
navigator.clipboard.writeText(phrases.join(" "));
|
||||||
|
setButtonClickedState("clicked");
|
||||||
|
setTimeout(() => setButtonClickedState("idle"), 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="relative">
|
||||||
|
<AnimatePresence>
|
||||||
|
{step === 1 ? (
|
||||||
|
<m.div
|
||||||
|
className={`z-10 absolute top-0 bottom-0 left-0 right-0 bg-black pointer-events-none`}
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{
|
||||||
|
opacity: 0.75,
|
||||||
|
top: -200,
|
||||||
|
left: -20,
|
||||||
|
right: -20,
|
||||||
|
bottom: 120,
|
||||||
|
}}
|
||||||
|
transition={{ type: "tween", duration: 0.1 }}></m.div>
|
||||||
|
) : null}
|
||||||
|
</AnimatePresence>
|
||||||
|
<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) => (
|
||||||
|
<div
|
||||||
|
key={`SeedPhrase_${index}`}
|
||||||
|
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>
|
||||||
|
))}
|
||||||
|
<AnimatePresence>
|
||||||
|
{step === 1 ? (
|
||||||
|
<m.div
|
||||||
|
className="text-red-400 flex flex-row gap-5 py-8"
|
||||||
|
initial={{ opacity: 0, y: 50 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
exit={{ opacity: 0, y: 50 }}
|
||||||
|
transition={{ type: "linear", delay: 0.2, duration: 0.5 }}>
|
||||||
|
<ExclamationTriangleIcon className="w-14 h-14" />
|
||||||
|
<span>Make sure to write this down for safe keeping.</span>
|
||||||
|
</m.div>
|
||||||
|
) : null}
|
||||||
|
</AnimatePresence>
|
||||||
|
<Button
|
||||||
|
className={`${TW_PREFIX} w-[calc(100%-8px)] h-12 ${
|
||||||
|
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>
|
||||||
|
</div>
|
||||||
|
{step === 0 ? (
|
||||||
|
<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
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
<AnimatePresence>
|
||||||
|
{step === 1 ? (
|
||||||
|
<m.div
|
||||||
|
className="z-20 w-full h-12"
|
||||||
|
initial={{ opacity: 0, y: -50 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
exit={{ opacity: 0, y: 50 }}
|
||||||
|
transition={{ type: "linear", delay: 2, duration: 0.5 }}>
|
||||||
|
<Button
|
||||||
|
className="w-full h-full"
|
||||||
|
onClick={async () => signIn(await seedToKey(key))}>
|
||||||
|
Sign In
|
||||||
|
</Button>
|
||||||
|
</m.div>
|
||||||
|
) : null}
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SubmitButton = makeSwitchable(
|
||||||
|
SubmitButtonComponent,
|
||||||
|
"submit-button",
|
||||||
|
);
|
||||||
|
export const SeedPhraseInput = makeSwitchable(
|
||||||
|
SeedPhraseInputComponent,
|
||||||
|
"seed-phrase-input",
|
||||||
|
);
|
||||||
|
export const SetupAccountKey = makeSwitchable(
|
||||||
|
SetupAccountKeyComponent,
|
||||||
|
"setup-account-key",
|
||||||
|
);
|
||||||
|
export const SeedPhraseGeneration = makeSwitchable(
|
||||||
|
SeedPhraseGenerationComponent,
|
||||||
|
"seed-phrase-form",
|
||||||
|
);
|
|
@ -0,0 +1,57 @@
|
||||||
|
import * as React from "react";
|
||||||
|
import { Slot } from "@radix-ui/react-slot";
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority";
|
||||||
|
|
||||||
|
import { cn } from "../utils";
|
||||||
|
|
||||||
|
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",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default:
|
||||||
|
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
||||||
|
outline:
|
||||||
|
"text-neutral-600 border border-current bg-transparent shadow-sm hover:border-white hover:text-white",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
||||||
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
||||||
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
default: "h-9 px-4 py-2",
|
||||||
|
sm: "h-8 rounded-md px-3 text-xs",
|
||||||
|
lg: "h-10 rounded-md px-8",
|
||||||
|
icon: "h-9 w-9",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export interface ButtonProps
|
||||||
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||||
|
VariantProps<typeof buttonVariants> {
|
||||||
|
asChild?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
||||||
|
const Comp = asChild ? Slot : "button";
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
Button.displayName = "Button";
|
||||||
|
|
||||||
|
export { Button, buttonVariants };
|
|
@ -0,0 +1,25 @@
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
|
import { cn } from "../utils";
|
||||||
|
|
||||||
|
export interface InputProps
|
||||||
|
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||||
|
|
||||||
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
|
({ className, type, ...props }, ref) => {
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
type={type}
|
||||||
|
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",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
Input.displayName = "Input";
|
||||||
|
|
||||||
|
export { Input };
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { type ClassValue, clsx } from "clsx";
|
||||||
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
|
export function cn(...inputs: ClassValue[]) {
|
||||||
|
return twMerge(clsx(inputs));
|
||||||
|
}
|
|
@ -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";
|
|
@ -0,0 +1,2 @@
|
||||||
|
/// <reference types="vite/client" />
|
||||||
|
/// <reference types="vite-plugin-svgr/client" />
|
|
@ -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
|
||||||
|
};
|
|
@ -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
|
||||||
|
};
|
|
@ -0,0 +1,77 @@
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
:root {
|
||||||
|
--background: 0 0% 100%;
|
||||||
|
--foreground: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--card: 0 0% 100%;
|
||||||
|
--card-foreground: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--popover: 0 0% 100%;
|
||||||
|
--popover-foreground: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--primary: 113 49% 55%;
|
||||||
|
--primary-foreground: black;
|
||||||
|
|
||||||
|
--secondary: 210 40% 96.1%;
|
||||||
|
--secondary-foreground: 222.2 47.4% 11.2%;
|
||||||
|
|
||||||
|
--muted: 0 0% 32%;
|
||||||
|
--muted-foreground: 0 0% 32%;
|
||||||
|
|
||||||
|
--accent: 210 40% 96.1%;
|
||||||
|
--accent-foreground: 222.2 47.4% 11.2%;
|
||||||
|
|
||||||
|
--destructive: 0 84.2% 60.2%;
|
||||||
|
--destructive-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--border: 0 0% 32%;
|
||||||
|
--input: 0 0% 32%;
|
||||||
|
--ring: 222.2 84% 4.9%;
|
||||||
|
|
||||||
|
--radius: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--background: 222.2 84% 4.9%;
|
||||||
|
--foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--card: 222.2 84% 4.9%;
|
||||||
|
--card-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--popover: 222.2 84% 4.9%;
|
||||||
|
--popover-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--primary: 210 40% 98%;
|
||||||
|
--primary-foreground: 222.2 47.4% 11.2%;
|
||||||
|
|
||||||
|
--secondary: 217.2 32.6% 17.5%;
|
||||||
|
--secondary-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--muted: 217.2 32.6% 17.5%;
|
||||||
|
--muted-foreground: 215 20.2% 65.1%;
|
||||||
|
|
||||||
|
--accent: 217.2 32.6% 17.5%;
|
||||||
|
--accent-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--destructive: 0 62.8% 30.6%;
|
||||||
|
--destructive-foreground: 210 40% 98%;
|
||||||
|
|
||||||
|
--border: 217.2 32.6% 17.5%;
|
||||||
|
--input: 217.2 32.6% 17.5%;
|
||||||
|
--ring: 212.7 26.8% 83.9%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
import { type Config } from "tailwindcss";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
darkMode: ["class"],
|
||||||
|
content: ["./src/**/*.{ts,tsx}"],
|
||||||
|
safelist: ["text-primary", "text-red-500", "text-orange-500"],
|
||||||
|
theme: {
|
||||||
|
container: {
|
||||||
|
center: true,
|
||||||
|
padding: "2rem",
|
||||||
|
screens: {
|
||||||
|
"2xl": "1400px",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extend: {
|
||||||
|
colors: {
|
||||||
|
border: "hsl(var(--border))",
|
||||||
|
input: "hsl(var(--input))",
|
||||||
|
ring: "hsl(var(--ring))",
|
||||||
|
background: "hsl(var(--background))",
|
||||||
|
foreground: "hsl(var(--foreground))",
|
||||||
|
primary: {
|
||||||
|
DEFAULT: "hsl(var(--primary))",
|
||||||
|
foreground: "hsl(var(--primary-foreground))",
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
DEFAULT: "hsl(var(--secondary))",
|
||||||
|
foreground: "hsl(var(--secondary-foreground))",
|
||||||
|
},
|
||||||
|
destructive: {
|
||||||
|
DEFAULT: "hsl(var(--destructive))",
|
||||||
|
foreground: "hsl(var(--destructive-foreground))",
|
||||||
|
},
|
||||||
|
muted: {
|
||||||
|
DEFAULT: "hsl(var(--muted))",
|
||||||
|
foreground: "hsl(var(--muted-foreground))",
|
||||||
|
},
|
||||||
|
accent: {
|
||||||
|
DEFAULT: "hsl(var(--accent))",
|
||||||
|
foreground: "hsl(var(--accent-foreground))",
|
||||||
|
},
|
||||||
|
popover: {
|
||||||
|
DEFAULT: "hsl(var(--popover))",
|
||||||
|
foreground: "hsl(var(--popover-foreground))",
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
DEFAULT: "hsl(var(--card))",
|
||||||
|
foreground: "hsl(var(--card-foreground))",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
borderRadius: {
|
||||||
|
lg: "var(--radius)",
|
||||||
|
md: "calc(var(--radius) - 2px)",
|
||||||
|
sm: "calc(var(--radius) - 4px)",
|
||||||
|
},
|
||||||
|
keyframes: {
|
||||||
|
"accordion-down": {
|
||||||
|
from: { height: "0" },
|
||||||
|
to: { height: "var(--radix-accordion-content-height)" },
|
||||||
|
},
|
||||||
|
"accordion-up": {
|
||||||
|
from: { height: "var(--radix-accordion-content-height)" },
|
||||||
|
to: { height: "0" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
animation: {
|
||||||
|
"accordion-down": "accordion-down 0.2s ease-out",
|
||||||
|
"accordion-up": "accordion-up 0.2s ease-out",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [require("tailwindcss-animate")],
|
||||||
|
} satisfies Config;
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
import scopeTailwind from "vite-plugin-scope-tailwind";
|
||||||
|
import { resolve } from "path";
|
||||||
|
import svgr from "vite-plugin-svgr";
|
||||||
|
import dts from "vite-plugin-dts";
|
||||||
|
import optimizer from "vite-plugin-optimizer";
|
||||||
|
import noBundlePlugin from "vite-plugin-no-bundle";
|
||||||
|
import { TW_PREFIX } from "./scoped-tailwind-prefix";
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
svgr(),
|
||||||
|
react(),
|
||||||
|
scopeTailwind({
|
||||||
|
react: true,
|
||||||
|
prefix: TW_PREFIX,
|
||||||
|
classNameTransformers: ["cn"],
|
||||||
|
}),
|
||||||
|
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: {
|
||||||
|
dedupe: ["@lumeweb/libportal", "@lumeweb/libweb", "@lumeweb/libkernel"],
|
||||||
|
// TODO: For some reason aliases are not working....
|
||||||
|
// alias: {
|
||||||
|
// '@styles/': resolve(__dirname, './styles'),
|
||||||
|
// '@components/': resolve(__dirname, './src/components'),
|
||||||
|
// '@assets/': resolve(__dirname, './src/assets'),
|
||||||
|
// '@': resolve(__dirname, './src'),
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
manifest: false,
|
||||||
|
outDir: "lib",
|
||||||
|
emptyOutDir: true,
|
||||||
|
sourcemap: true,
|
||||||
|
minify: false,
|
||||||
|
lib: {
|
||||||
|
entry: resolve(__dirname, "src/index.ts"),
|
||||||
|
name: "sdk",
|
||||||
|
fileName: "index",
|
||||||
|
formats: ["es"],
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
inlineDynamicImports: false,
|
||||||
|
},
|
||||||
|
external: [
|
||||||
|
"react",
|
||||||
|
"react-dom",
|
||||||
|
"@lumeweb/libportal",
|
||||||
|
"@lumeweb/libweb",
|
||||||
|
"@lumeweb/libkernel/module",
|
||||||
|
"@lumeweb/libkernel/kernel",
|
||||||
|
"@lumeweb/libkernel",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
Loading…
Reference in New Issue