-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tari-project/transfer
init: move from tari-labs
- Loading branch information
Showing
63 changed files
with
9,019 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
# Publishing all NPM packages to the npm registry when the version number changes | ||
# See https://github.com/marketplace/actions/npm-publish for more information | ||
name: Publish package to npmjs | ||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
# Publish the lib to the NPM registry | ||
publish-typescript-bindings: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- run: npm ci | ||
- uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
token: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
access: 'public' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"arrowParens": "always", | ||
"bracketSpacing": true, | ||
"endOfLine": "lf", | ||
"jsxBracketSameLine": false, | ||
"quoteProps": "consistent", | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"trailingComma": "all", | ||
"useTabs": true, | ||
"printWidth": 180 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,67 @@ | ||
# tari-tower | ||
|
||
Source for the tower animation used in [_Tari Universe_](https://github.com/tari-project/universe). | ||
|
||
### Installation | ||
|
||
```bash | ||
npm i @tari-project/tari-tower | ||
``` | ||
|
||
## Usage | ||
|
||
Initialise | ||
|
||
```tsx | ||
import { loadTowerAnimation } from '@tari-project/tari-tower'; | ||
|
||
loadTowerAnimation(); | ||
``` | ||
|
||
Available methods: | ||
|
||
| name | args | description | | ||
| ------------------------ | ------------------------------------------------------------------------------------------------ | -------------------------------------------------- | | ||
| `loadTowerAnimation` | **canvasId**: `string` <br/> **offset?**: `number` | initialise all the animation logic + canvas | | ||
| `removeTowerAnimation` | `none` | stop the animation and remove canvas | | ||
| `setAnimationState` | **id**: `'start'\|'stop'\|'fail'\|'sucess'\|'sucess2'\|'sucess3'` <br/> **isReplay?:** `boolean` | set the animation state | | ||
| `setAnimationProperties` | properties:`{property:string; value:unknown}[]` | set properties (e.g colours in dark vs light mode) | | ||
|
||
Available values: | ||
|
||
| name | description | | ||
| ---------------------- | --------------------------------------------------------------------------- | | ||
| `animationStatus` | the state of the animation | | ||
| `animationStatusIndex` | the index of the animation state (useful as a trigger in dependencya array) | | ||
|
||
## Contributing | ||
|
||
### Development | ||
|
||
note: _must be built first to be able to reference the lib locally_ | ||
|
||
```bash | ||
npm ci | ||
npm run build | ||
npm run dev | ||
``` | ||
|
||
- make changes in the `lib` directory | ||
- export anything you want available in `/lib/main.ts` | ||
- update readme | ||
|
||
### Distribution | ||
|
||
- make sure your tari labs registry PAT is set up | ||
- bump version in package.json | ||
- build changes: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
- publish changes: | ||
|
||
``` | ||
npm publish | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import globals from 'globals'; | ||
import pluginJs from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
export default [ | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
...tseslint.configs.stylistic, | ||
{ | ||
ignores: ['node_modules', '/dist/', './public/assets/**/*.js'], | ||
languageOptions: { | ||
globals: globals.browser, | ||
parser: tsParser, | ||
}, | ||
rules: { | ||
'no-unused-vars': 'off', // base rule must be disabled | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
args: 'none', | ||
caughtErrors: 'all', | ||
ignoreRestSiblings: false, | ||
reportUsedIgnorePattern: false, | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
caughtErrorsIgnorePattern: '^_', | ||
}, | ||
], | ||
}, | ||
}, | ||
eslintConfigPrettier, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="icon" type="image/x-icon" href="tari.svg" /> | ||
<title>Tari Universe Tower Animation</title> | ||
<link rel="modulepreload" href="./src/index.ts" /> | ||
<style> | ||
html, | ||
body { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0; | ||
} | ||
body { | ||
overflow: hidden; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="./src/index.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { loadTowerAnimation, removeTowerAnimation } from './scripts/index.ts'; | ||
import { properties } from './scripts/core/properties.ts'; | ||
import { result, stateManager, status, statusIndex } from './scripts/logic/stateManager.ts'; | ||
|
||
function setAnimationState(id: string, isReplay = false) { | ||
stateManager.set(id, isReplay); | ||
} | ||
|
||
interface Property { | ||
property: string; | ||
value: unknown; | ||
} | ||
function setAnimationProperties(newProps: Property[]) { | ||
for (const item of newProps) { | ||
properties[item.property] = item.value; | ||
} | ||
} | ||
|
||
export { | ||
loadTowerAnimation, | ||
removeTowerAnimation, | ||
setAnimationProperties, | ||
status as animationStatus, | ||
statusIndex as animationStatusIndex, | ||
result as animationResult, | ||
setAnimationState, | ||
}; |
Oops, something went wrong.