Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ Each extension is incased in `{}` brackets. Look below on how to copy it.
documentation: "page-name", // This is the page name for the documentation you created.

// These next ones are optional. You can choose not to include them.
tags: ["new", "graphics"], // Optional. A list of tags to add to your extension. You can put anything here, but it may be adjusted later.
example: "Username/extension.pmp", // Optional. An example project to show off how to use the extension.
creatorAlias: "Joe", // Optional. This will not change the creator link, but change the name that links to it.
notes: "Additional help by someguy", // Optional. Allows you to note anyone else who helped you or any small info.
unstable: false, // Optional. Will add a warning message that your extension is unstable.
Expand Down
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"type": "module",
"dependencies": {
"localforage": "^1.10.0",
"markdown-it": "^14.1.0"
}
}
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<meta name="viewport" content="width=device-width" />
<style>
:root {
:root, button {
font-family: Arial, Helvetica, sans-serif;
}
.sb3-comment-label {
Expand Down
78 changes: 78 additions & 0 deletions src/lib/Checkbox/Checkbox.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<script>
import { onMount } from 'svelte';
import { page } from '$app/stores';

import IconEnabled from './icon-enabled.svg';

let {
checked = $bindable(),
onclick,
onchange,
oninput,
} = $props();
const onClick = (event) => {
if (onclick) onclick(event);

// oninput comes first before checked change
if (oninput) oninput(checked);

// change the checked
checked = !checked;
// onchange goes after
if (onchange) onchange(checked);
};
</script>

<!-- TODO: Add this to svelteui -->
<button
class="checkbox"
data-checked={checked}
data-penguinmodsvelteui-checkbox="true"
onclick={onClick}
>
{#if checked}
<img src={IconEnabled} alt="√" />
{/if}
</button>

<style>
.checkbox {
position: relative;
display: block;
width: 20px;
height: 20px;
margin: 2px 0;

flex-shrink: 0;

background: transparent;
border: 1px solid rgba(0, 0, 0, 0.5);
border-radius: 3px;

cursor: pointer;
}
.checkbox img {
position: absolute;
width: calc(20px - 4px);
height: calc(20px - 4px);
left: 1px;
top: 1px;

filter: brightness(0.25);

pointer-events: none;
}
:global(body.dark-mode) .checkbox {
border-color: rgba(255, 255, 255, 0.5);
}
:global(body.dark-mode) .checkbox img {
filter: brightness(1);
}

.checkbox[data-checked="true"] {
background: dodgerblue;
}
.checkbox[data-checked="true"] img {
filter: brightness(1);
}
</style>
8 changes: 8 additions & 0 deletions src/lib/Checkbox/icon-enabled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading