@visualizevalue/mint-app-base 0.1.55 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CodeEditor.client.vue +12 -2
- package/components/Mint/Detail.client.vue +9 -3
- package/components/Mint/Preview.client.vue +36 -15
- package/components/Mint/Renderer/Base.client.vue +3 -5
- package/components/Mint/Renderer/P5.client.vue +28 -7
- package/components/Page/Frame.vue +1 -1
- package/components/Tabs.vue +4 -1
- package/composables/collections.ts +2 -2
- package/composables/createMint.ts +3 -1
- package/package.json +1 -1
- package/utils/p5Script.ts +21 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="code-editor">
|
|
3
3
|
<CodeMirror
|
|
4
|
+
ref="cmRef"
|
|
4
5
|
:value="modelValue"
|
|
5
6
|
:options="cmOptions"
|
|
6
|
-
height="100%"
|
|
7
7
|
:placeholder="placeholder"
|
|
8
8
|
@change="$emit('update:modelValue', $event)"
|
|
9
|
+
height="100%"
|
|
9
10
|
original-style
|
|
10
11
|
/>
|
|
11
12
|
</div>
|
|
@@ -24,7 +25,10 @@ const props = defineProps({
|
|
|
24
25
|
type: String,
|
|
25
26
|
default: 'text/javascript'
|
|
26
27
|
},
|
|
27
|
-
theme:
|
|
28
|
+
theme: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: 'default'
|
|
31
|
+
},
|
|
28
32
|
})
|
|
29
33
|
const emit = defineEmits(['update:modelValue'])
|
|
30
34
|
|
|
@@ -35,6 +39,12 @@ const cmOptions = computed(() => ({
|
|
|
35
39
|
tabSize: 2,
|
|
36
40
|
indentWithTab: false
|
|
37
41
|
}))
|
|
42
|
+
|
|
43
|
+
const cmRef = ref()
|
|
44
|
+
|
|
45
|
+
defineExpose({
|
|
46
|
+
cmRef,
|
|
47
|
+
})
|
|
38
48
|
</script>
|
|
39
49
|
|
|
40
50
|
<style scoped>
|
|
@@ -13,13 +13,14 @@ const { component } = useCreateMintRendererComponent(props.collection)
|
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
15
|
<div class="mint-detail">
|
|
16
|
-
<
|
|
16
|
+
<Actions class="borderless">
|
|
17
|
+
<MintSelectRenderer :collection="collection" />
|
|
18
|
+
<MintAction :collection="collection" />
|
|
19
|
+
</Actions>
|
|
17
20
|
|
|
18
21
|
<MintPreview />
|
|
19
22
|
|
|
20
23
|
<component :is="components[component]" class="card" />
|
|
21
|
-
|
|
22
|
-
<MintAction :collection="collection" />
|
|
23
24
|
</div>
|
|
24
25
|
</template>
|
|
25
26
|
|
|
@@ -33,9 +34,14 @@ const { component } = useCreateMintRendererComponent(props.collection)
|
|
|
33
34
|
padding: var(--spacer);
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
> menu {
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
@media (--md) {
|
|
37
42
|
grid-template-columns: 40% 1fr;
|
|
38
43
|
|
|
44
|
+
> menu,
|
|
39
45
|
.mint-select-renderer {
|
|
40
46
|
grid-column: span 2;
|
|
41
47
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<article class="mint-preview">
|
|
3
|
+
<Embed v-if="animationUrl" :src="animationUrl" />
|
|
4
|
+
|
|
3
5
|
<div class="static">
|
|
4
6
|
<Image v-if="image" :src="image" alt="Preview" />
|
|
5
7
|
<ImagePreview v-else />
|
|
6
8
|
</div>
|
|
7
9
|
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</
|
|
10
|
+
<div class="text">
|
|
11
|
+
<h1 :class="{ '': !name }">{{ name || 'Token' }}</h1>
|
|
12
|
+
<p :class="{ '': !description }">
|
|
13
|
+
{{ description || 'No description' }}
|
|
14
|
+
</p>
|
|
15
|
+
</div>
|
|
14
16
|
</article>
|
|
15
17
|
</template>
|
|
16
18
|
|
|
@@ -20,8 +22,23 @@ const { image, animationUrl, name, description } = useCreateMintData()
|
|
|
20
22
|
|
|
21
23
|
<style scoped>
|
|
22
24
|
.mint-preview {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
position: sticky;
|
|
26
|
+
top: var(--spacer);
|
|
27
|
+
height: min-content;
|
|
28
|
+
place-content: start center;
|
|
29
|
+
border-radius: var(--card-border-radius);
|
|
30
|
+
display: grid;
|
|
31
|
+
grid-template-columns: 20% 1fr;
|
|
32
|
+
gap: var(--spacer);
|
|
33
|
+
|
|
34
|
+
> * {
|
|
35
|
+
grid-column: span 2;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.embed {
|
|
39
|
+
border-radius: var(--card-border-radius);
|
|
40
|
+
border: var(--border);
|
|
41
|
+
}
|
|
25
42
|
|
|
26
43
|
svg {
|
|
27
44
|
box-shadow: var(--border-shadow);
|
|
@@ -29,18 +46,22 @@ const { image, animationUrl, name, description } = useCreateMintData()
|
|
|
29
46
|
|
|
30
47
|
.image,
|
|
31
48
|
svg {
|
|
32
|
-
|
|
49
|
+
border-radius: var(--card-border-radius);
|
|
33
50
|
width: 100%;
|
|
34
51
|
}
|
|
35
52
|
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
53
|
+
.text {
|
|
54
|
+
height: 100%;
|
|
55
|
+
align-content: center;
|
|
40
56
|
}
|
|
41
57
|
|
|
42
|
-
.embed {
|
|
43
|
-
|
|
58
|
+
&:has(.embed) {
|
|
59
|
+
> .static {
|
|
60
|
+
grid-column: 1;
|
|
61
|
+
}
|
|
62
|
+
> .text {
|
|
63
|
+
grid-column: 2;
|
|
64
|
+
}
|
|
44
65
|
}
|
|
45
66
|
|
|
46
67
|
h1 {
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
<div class="mint-renderer-base">
|
|
3
3
|
<Actions>
|
|
4
4
|
<select class="select choose-mode" v-model="mode">
|
|
5
|
-
<option value="file" title="Data URI Encoded File Upload">
|
|
6
|
-
<option value="ipfs" title="Interplanetary File System">IPFS</option>
|
|
7
|
-
<option value="ar" title="Arweave">
|
|
8
|
-
<option value="http" title="Hypertext Transfer Protocol" disabled>HTTP</option>
|
|
9
|
-
<option value="svg" title="Scalable Vector Graphic" disabled>SVG</option>
|
|
5
|
+
<option value="file" title="Data URI Encoded File Upload">Onchain Artifact</option>
|
|
6
|
+
<option value="ipfs" title="Interplanetary File System">IPFS Identifier</option>
|
|
7
|
+
<option value="ar" title="Arweave">Arweave Transaction</option>
|
|
10
8
|
</select>
|
|
11
9
|
</Actions>
|
|
12
10
|
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="mint-renderer-p5">
|
|
3
|
-
|
|
4
3
|
<Tabs initial="base">
|
|
4
|
+
|
|
5
5
|
<template #menu="{ active, select }">
|
|
6
|
-
<Button
|
|
7
|
-
|
|
6
|
+
<Button
|
|
7
|
+
@click="select('base')"
|
|
8
|
+
:class="{ active: active === 'base' }"
|
|
9
|
+
>Static</Button>
|
|
10
|
+
<Button
|
|
11
|
+
@click="select('script')"
|
|
12
|
+
:class="{ active: active === 'script' }"
|
|
13
|
+
>P5 Script</Button>
|
|
8
14
|
</template>
|
|
15
|
+
|
|
9
16
|
<template #content="{ active }">
|
|
17
|
+
<!-- We only hide the form to maintain the file select state -->
|
|
10
18
|
<MintRendererBase v-show="active === 'base'" decouple-artifact />
|
|
11
|
-
|
|
19
|
+
<!-- We force rerender the code editor on active -->
|
|
20
|
+
<CodeEditor v-if="active === 'script'" v-model="script" class="full" ref="codeEditor" />
|
|
12
21
|
</template>
|
|
22
|
+
|
|
13
23
|
</Tabs>
|
|
14
24
|
</div>
|
|
15
25
|
</template>
|
|
16
26
|
|
|
17
27
|
<script setup>
|
|
28
|
+
import { watchDebounced } from '@vueuse/core'
|
|
29
|
+
|
|
18
30
|
const {
|
|
19
31
|
artifact,
|
|
20
32
|
image,
|
|
@@ -24,9 +36,15 @@ const {
|
|
|
24
36
|
const script = ref(DEFAULT_P5_SCRIPT)
|
|
25
37
|
|
|
26
38
|
// Keep the animationURL (for the preview) up to date
|
|
27
|
-
|
|
39
|
+
const updateUrl = () => {
|
|
28
40
|
animationUrl.value = getP5HtmlUri('Preview', script.value)
|
|
29
|
-
}
|
|
41
|
+
}
|
|
42
|
+
watchDebounced(
|
|
43
|
+
script,
|
|
44
|
+
updateUrl,
|
|
45
|
+
{ debounce: 500, maxWait: 3000 },
|
|
46
|
+
)
|
|
47
|
+
onMounted(updateUrl)
|
|
30
48
|
|
|
31
49
|
// Encode the artifact as per how the P5Renderer.sol contract expects it.
|
|
32
50
|
watchEffect(() => {
|
|
@@ -44,6 +62,8 @@ watchEffect(() => {
|
|
|
44
62
|
display: flex;
|
|
45
63
|
flex-direction: column;
|
|
46
64
|
gap: 0;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
width: 100%;
|
|
47
67
|
|
|
48
68
|
> .tabs {
|
|
49
69
|
height: min-content;
|
|
@@ -51,7 +71,8 @@ watchEffect(() => {
|
|
|
51
71
|
|
|
52
72
|
> .tabs-content {
|
|
53
73
|
border: var(--border);
|
|
54
|
-
border-
|
|
74
|
+
border-radius: var(--card-border-radius);
|
|
75
|
+
overflow: hidden;
|
|
55
76
|
height: 100%;
|
|
56
77
|
|
|
57
78
|
> * {
|
|
@@ -33,9 +33,9 @@ watch(props, () => updateBreadcrumbs())
|
|
|
33
33
|
&.inset {
|
|
34
34
|
gap: var(--spacer);
|
|
35
35
|
padding: var(--spacer);
|
|
36
|
-
overflow-x: hidden;
|
|
37
36
|
|
|
38
37
|
> *:not(.borderless) {
|
|
38
|
+
border-radius: var(--card-border-radius);
|
|
39
39
|
border: var(--border);
|
|
40
40
|
padding: var(--spacer);
|
|
41
41
|
}
|
package/components/Tabs.vue
CHANGED
|
@@ -17,7 +17,6 @@ const select = k => active.value = k
|
|
|
17
17
|
|
|
18
18
|
<style>
|
|
19
19
|
.tabs {
|
|
20
|
-
border-bottom: var(--border);
|
|
21
20
|
padding: 0 var(--size-1);
|
|
22
21
|
margin: 0;
|
|
23
22
|
display: flex;
|
|
@@ -33,6 +32,10 @@ const select = k => active.value = k
|
|
|
33
32
|
border-bottom-color: var(--background);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
35
|
+
|
|
36
|
+
.tabs-content {
|
|
37
|
+
border-top: var(--border);
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
</style>
|
|
38
41
|
|
|
@@ -256,11 +256,11 @@ export const useOnchainStore = () => {
|
|
|
256
256
|
}),
|
|
257
257
|
])
|
|
258
258
|
|
|
259
|
-
this.collections[address].renderers
|
|
259
|
+
this.collections[address].renderers[index] = {
|
|
260
260
|
address: rendererAddress.toLowerCase() as `0x${string}`,
|
|
261
261
|
name,
|
|
262
262
|
version,
|
|
263
|
-
}
|
|
263
|
+
}
|
|
264
264
|
|
|
265
265
|
index ++
|
|
266
266
|
} catch (e) {
|
|
@@ -50,7 +50,9 @@ export const useCreateMintRendererComponent = (collection: Collection) => {
|
|
|
50
50
|
})
|
|
51
51
|
|
|
52
52
|
const component = computed(() => appConfig.knownRenderers
|
|
53
|
-
.find((r
|
|
53
|
+
.find((r) =>
|
|
54
|
+
r.address.toLowerCase() === rendererAddress.value
|
|
55
|
+
)?.component || 'Base'
|
|
54
56
|
)
|
|
55
57
|
|
|
56
58
|
return {
|
package/package.json
CHANGED
package/utils/p5Script.ts
CHANGED
|
@@ -6,11 +6,30 @@ function setup() {
|
|
|
6
6
|
|
|
7
7
|
createCanvas(dimension, dimension)
|
|
8
8
|
|
|
9
|
-
background(
|
|
9
|
+
background(255)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function draw() {
|
|
13
|
-
|
|
13
|
+
const width = dimension/16
|
|
14
|
+
offset = width / 2
|
|
15
|
+
|
|
16
|
+
fill(0)
|
|
17
|
+
strokeWeight(0)
|
|
18
|
+
|
|
19
|
+
rect(
|
|
20
|
+
dimension/3 - offset, dimension/3,
|
|
21
|
+
width, dimension/3
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
rect(
|
|
25
|
+
dimension/2 - offset, dimension/2.5,
|
|
26
|
+
width, dimension/5
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
rect(
|
|
30
|
+
dimension - dimension/3 - offset, dimension/3,
|
|
31
|
+
width, dimension/3
|
|
32
|
+
)
|
|
14
33
|
}
|
|
15
34
|
`
|
|
16
35
|
|