Skip to content

Commit

Permalink
Merge pull request #283 from greymass/dev
Browse files Browse the repository at this point in the history
Next Release
  • Loading branch information
aaroncox authored Dec 6, 2024
2 parents 35c7164 + d035664 commit c592969
Show file tree
Hide file tree
Showing 43 changed files with 1,565 additions and 239 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ install:
codegen:
npx @wharfkit/cli generate -u $(API_EOS_CHAIN) -f src/lib/wharf/contracts/system.ts eosio
npx @wharfkit/cli generate -u $(API_EOS_CHAIN) -f src/lib/wharf/contracts/token.ts eosio.token
npx @wharfkit/cli generate -u $(API_EOS_CHAIN) -f src/lib/wharf/contracts/msig.ts eosio.msig
npx @wharfkit/cli generate -u $(API_EOS_CHAIN) -f src/lib/wharf/contracts/delphioracle.ts delphioracle
Binary file modified bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
"type": "module",
"dependencies": {
"@accuser/svelte-plausible-analytics": "^1.0.0",
"@coinbase/cbpay-js": "^2.4.0",
"@fontsource/jetbrains-mono": "^5.1.0",
"@tailwindcss/container-queries": "^0.1.1",
"@wharfkit/account": "^1.2.0",
"@wharfkit/account-creation-plugin-greymass": "^1.2.0",
"@wharfkit/account-creation-plugin-metamask": "^1.0.2",
"@wharfkit/account-creation-plugin-metamask": "^1.1.1",
"@wharfkit/antelope": "^1.0.11",
"@wharfkit/common": "^1.4.0",
"@wharfkit/contract": "^1.1.5",
Expand All @@ -62,7 +63,7 @@
"@wharfkit/session": "^1.4.0",
"@wharfkit/transact-plugin-resource-provider": "^1.1.1",
"@wharfkit/wallet-plugin-anchor": "^1.4.0",
"@wharfkit/wallet-plugin-metamask": "1.0.0-rc10",
"@wharfkit/wallet-plugin-metamask": "^1.1.1",
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
"@wharfkit/wallet-plugin-scatter": "^1.5.1",
"@wharfkit/wallet-plugin-tokenpocket": "^1.5.1",
Expand Down
18 changes: 9 additions & 9 deletions src/lib/components/button/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
}
let {
class: className = '',
meltAction,
onclick,
variant = 'primary',
active = false,
active,
disabled = false,
...props
}: ButtonProps = $props();
const ariaRole = props.href ? 'link' : 'button';
const ariaRole = props.href ? undefined : 'button'; // undefined because anchor tag with role=link gives a warning
const ariaCurrent = props['aria-current'] || active === false ? undefined : true; // removes aria-current if active===false
const tag = props.href ? 'a' : 'button';
// Only use melt builder element if passed as a prop
Expand All @@ -46,19 +46,19 @@
<svelte:element
this={tag}
use:melt={$meltElement}
data-active={active}
data-variant={variant}
class={className}
class={props.class || ''}
role={ariaRole}
aria-current={ariaCurrent}
{disabled}
{onclick}
{...props}
{...linkProps}
>
<span class="button-text">{@render props.children()}</span>
<span>{@render props.children()}</span>
</svelte:element>

<style>
<style lang="postcss">
[data-variant='primary'] {
@apply relative inline-flex h-12 grow items-center justify-center text-nowrap rounded-lg bg-skyBlue-700 px-8 text-center text-base font-medium text-skyBlue-50 transition-all focus:outline-transparent focus-visible:outline focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-solar-500 hover:active:bg-skyBlue-800 disabled:cursor-not-allowed disabled:bg-mineShaft-900 disabled:text-white/60 disabled:opacity-30 disabled:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:bg-skyBlue-600;
}
Expand All @@ -68,10 +68,10 @@
}
[data-variant='pill'] {
@apply relative inline-flex h-10 items-center justify-center text-nowrap rounded-full border-2 border-transparent px-5 text-center text-base font-medium leading-4 transition-all focus-visible:outline focus-visible:outline-2 focus-visible:outline-solar-500 hover:active:bg-mineShaft-950 data-[active=true]:border-mineShaft-200/30 [@media(any-hover:hover)]:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:text-mineShaft-100;
@apply relative inline-flex h-10 items-center justify-center text-nowrap rounded-full border-2 border-transparent px-5 text-center text-base font-medium leading-4 transition-all focus-visible:outline focus-visible:outline-2 focus-visible:outline-solar-500 hover:active:bg-mineShaft-950 aria-[current]:border-mineShaft-200/30 [@media(any-hover:hover)]:hover:bg-mineShaft-900 [@media(any-hover:hover)]:hover:text-mineShaft-100;
}
.button-text {
span {
@apply pointer-events-none relative text-inherit;
}
</style>
2 changes: 1 addition & 1 deletion src/lib/components/code.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const codeStyles = 'bg-shark-900/40 text-xs text-white font-mono rounded-md px-2 py-1';
const preStyles =
'bg-shark-900/20 text-sm text-white font-mono rounded-lg px-2 py-2 overflow-x-scroll';
'bg-shark-900/20 text-sm text-white font-mono rounded-lg px-2 py-2 overflow-x-auto';
</script>

<svelte:element this={tag} class={props.inline ? codeStyles : preStyles}>
Expand Down
13 changes: 13 additions & 0 deletions src/lib/components/elements/action.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script lang="ts">
import Code from '../code.svelte';
interface Props {
data: Record<string, unknown>;
}
let props: Props = $props();
</script>

{#if props.data}
<Code>{JSON.stringify(props.data, null, 2)}</Code>
{/if}
1 change: 1 addition & 0 deletions src/lib/components/elements/asset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
const currencyOptions: Intl.NumberFormatOptions = {
style: 'currency',
currency: asset?.symbol.name,
currencyDisplay: 'narrowSymbol',
minimumFractionDigits: context.settings.data.advancedMode ? asset?.symbol.precision : undefined
};
Expand Down
36 changes: 11 additions & 25 deletions src/lib/components/input/asset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -121,31 +121,17 @@
}
</script>

<div class="relative">
<TextInput
bind:ref
bind:value={input}
placeholder={String(zeroValue.value)}
{autofocus}
inputmode="decimal"
step="any"
{...props}
/>

<span
class="
text-muted
pointer-events-none
absolute
inset-y-0
right-0
flex
items-center
pr-4"
>
{String(symbol.code)}
</span>
</div>
<TextInput
bind:ref
bind:value={input}
placeholder={String(zeroValue.value)}
{autofocus}
inputmode="decimal"
step="any"
{...props}
>
{String(symbol.code)}
</TextInput>

{#if debug}
<h3>Component State</h3>
Expand Down
27 changes: 13 additions & 14 deletions src/lib/components/input/bytes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,26 @@
}
</script>

<div class="relative">
<TextInput
bind:ref
bind:value={input}
placeholder="0 {unit}"
step="any"
inputmode="decimal"
{autofocus}
onblur={handleBlur}
oninput={handleInput}
{...props}
/>
<TextInput
bind:ref
bind:value={input}
placeholder="0 {unit}"
step="any"
inputmode="decimal"
{autofocus}
onblur={handleBlur}
oninput={handleInput}
{...props}
>
<button
onclick={cycleUnit}
type="button"
class="absolute inset-y-0 right-0 flex select-none items-center gap-1 rounded-md bg-transparent px-4 text-skyBlue-500 hover:text-skyBlue-300 focus:outline-none focus-visible:ring focus-visible:ring-inset focus-visible:ring-solar-500"
class="flex h-full select-none items-center gap-1 rounded-md bg-transparent text-skyBlue-500 hover:text-skyBlue-300 focus:outline-none focus-visible:ring focus-visible:ring-inset focus-visible:ring-solar-500"
>
<span class="text-sm font-medium">{unit}</span>
<ArrowUpDown class="size-4" />
</button>
</div>
</TextInput>

{#if debug}
<div class="mt-4">
Expand Down
35 changes: 11 additions & 24 deletions src/lib/components/input/number.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,20 @@
</script>

{#if unit}
<div class="relative">
<TextInput
bind:ref
bind:value={inputValue}
placeholder="0"
inputmode="decimal"
step="any"
{...props}
/>

<span
class="
text-gray-500
pointer-events-none
absolute
inset-y-0
right-0
flex
items-center
pr-4"
>
{unit}
</span>
</div>
<TextInput
bind:ref
bind:value={inputValue}
placeholder="0"
inputmode="decimal"
step="any"
{...props}
>
{unit}
</TextInput>
{:else}
<TextInput bind:ref bind:value={inputValue} placeholder="0" type="number" {...props} />
{/if}

{#if debug}
<div class="mt-4">
<h3>Component State</h3>
Expand Down
78 changes: 78 additions & 0 deletions src/lib/components/input/publickey.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<script lang="ts">
import { PublicKey } from '@wharfkit/antelope';
import type { ComponentProps } from 'svelte';
import TextInput from './text.svelte';
interface PublicKeyInputProps extends ComponentProps<typeof TextInput> {
valid?: boolean;
value: PublicKey | undefined;
debug?: boolean;
}
let {
autofocus = false,
ref = $bindable(),
valid = $bindable(false),
value: _value = $bindable(),
debug = false,
...props
}: PublicKeyInputProps = $props();
/** The string value bound to the form input */
let input: string = $state('');
/** The derived public key from the formatted input */
const pubkey: PublicKey | undefined = $derived.by(() => {
try {
return PublicKey.from(input);
} catch (e) {
console.warn(e);
return;
}
});
/** Validation states */
const satisfiesPublicKeyMatch = $derived(
String(pubkey) === input || String(pubkey?.toLegacyString()) === input
);
/** Whether or not the input value is valid */
const satisfies: boolean = $derived(satisfiesPublicKeyMatch);
/** Set the input value from a parent */
export function set(publickey: string) {
input = publickey;
}
/** Set the bindable values on form input changes */
$effect(() => {
valid = satisfies;
if (satisfies) {
_value = pubkey;
} else {
_value = undefined;
}
});
if (debug) {
$inspect({
input,
satisfies
});
}
</script>

<TextInput bind:ref bind:value={input} {autofocus} {...props} />

{#if debug}
<h3>Component State</h3>
<pre>
input (string): "{input}"
Public Key: {pubkey}

---

Valid Input: {satisfies}
Valid Public Key: {satisfiesPublicKeyMatch}
</pre>
{/if}
26 changes: 10 additions & 16 deletions src/lib/components/input/text.svelte
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import type { HTMLInputAttributes } from 'svelte/elements';
interface TextInputProps extends HTMLInputAttributes {
ref?: HTMLInputElement;
children?: Snippet;
}
let { ref = $bindable(), value = $bindable(), ...props }: TextInputProps = $props();
</script>

<div class="relative">
<div
class="relative flex h-12 gap-2 rounded-lg border-2 border-mineShaft-600 px-4 *:content-center focus-within:border-skyBlue-500 focus-within:ring focus-within:ring-1 focus-within:ring-inset focus-within:ring-skyBlue-500"
>
<input
class="
h-12
w-full
rounded-lg
border-2
border-mineShaft-600
bg-transparent
px-4
font-medium
focus:border-skyBlue-500
focus:outline-none
focus:ring
focus:ring-1
focus:ring-inset
focus:ring-skyBlue-500"
class="placeholder:text-muted w-full rounded-lg bg-transparent font-medium focus:outline-none"
type="text"
autocorrect="off"
autocomplete="off"
Expand All @@ -33,4 +23,8 @@
bind:value
{...props}
/>

<div class="text-muted select-none">
{@render props.children?.()}
</div>
</div>
Loading

0 comments on commit c592969

Please sign in to comment.