-
Notifications
You must be signed in to change notification settings - Fork 2
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 #16 from lowdefy/confetti
Confetti Plugin
- Loading branch information
Showing
17 changed files
with
300 additions
and
3,320 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,5 @@ | ||
--- | ||
'@lowdefy/community-plugin-confetti': major | ||
--- | ||
|
||
Create new Confetti plugin package (@lowdefy/community-plugin-confetti). |
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,98 @@ | ||
_ref: | ||
path: templates/general.yaml.njk | ||
vars: | ||
pageId: Confetti | ||
pageTitle: Confetti | ||
section: '@lowdefy/community-plugin-confetti' | ||
content: | ||
- id: markdown | ||
type: MarkdownWithCode | ||
properties: | ||
content: | | ||
The `Confetti` action implements the [js-confetti](https://www.npmjs.com/package/js-confetti) `addConfetti` function. | ||
- _ref: | ||
path: templates/plugin_usage.yaml | ||
vars: | ||
name: '@lowdefy/community-plugin-confetti' | ||
packageJsonPath: ../../plugins/community-plugin-confetti/package.json | ||
- id: confetti_button | ||
type: Button | ||
style: | ||
margin: 40px | ||
maxWidth: 300 | ||
properties: | ||
title: Throw Confetti | ||
icon: GiPartyPopper | ||
size: large | ||
block: true | ||
shape: round | ||
type: default | ||
events: | ||
onClick: | ||
- id: throw_confetti | ||
type: Confetti | ||
params: | ||
confettiRadius: 3 | ||
confettiNumber: 200 | ||
- id: markdown | ||
type: MarkdownWithCode | ||
properties: | ||
content: | | ||
#### Properties | ||
- `emojis: string[]`: An array of emojis to use as confetti. | ||
- `confettiRadius: number`: The radius of non-emoji confetti. | ||
- `confettiNumber: number`: The number of confetti to display | ||
- `emojiSize: number`: The size of emoji confetti. | ||
- `confettiColors: string[]`: An array of hex colors for the confetti. | ||
### Examples | ||
```yaml | ||
id: confetti_button | ||
type: Button | ||
properties: | ||
title: Default Confetti | ||
events: | ||
onClick: | ||
- id: throw_confetti | ||
type: Confetti | ||
``` | ||
```yaml | ||
id: confetti_button | ||
type: Button | ||
properties: | ||
title: Throw Confetti | ||
icon: GiPartyPopper | ||
events: | ||
onClick: | ||
- id: throw_confetti | ||
type: Confetti | ||
params: | ||
confettiRadius: 3 | ||
confettiNumber: 200 | ||
confettiColors: | ||
- '#ff0a54' | ||
- '#ff477e' | ||
- '#ff7096' | ||
- '#ff85a1' | ||
``` | ||
```yaml | ||
id: emoji_confetti_button | ||
type: Button | ||
properties: | ||
title: Emoji Confetti | ||
icon: GiPartyPopper | ||
events: | ||
onClick: | ||
- id: throw_emoji_confetti | ||
type: Confetti | ||
params: | ||
emojis: | ||
- '💫' | ||
- '⚡️' | ||
- '💥' | ||
- '✨' | ||
emojiSize: 50 | ||
``` |
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
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
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,4 @@ | ||
# Read Lowdefy version from lowdefy.yaml using sed | ||
LOWDEFY_VERSION=$(sed -nE "s/lowdefy:(.*)/\1/p" ../lowdefy.yaml) | ||
# Substitution params are to trim whitespace from the LOWDEFY_VERSION var | ||
npx lowdefy@${LOWDEFY_VERSION//[[:space:]]/} build --config-directory ../ --server-directory . --no-next-build |
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
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
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 @@ | ||
id: usage | ||
type: MarkdownWithCode | ||
properties: | ||
content: | ||
_nunjucks: | ||
template: | | ||
To use this plugin, import the `{{ name }}` plugin in your `lowdefy.yaml` file. | ||
```yaml | ||
lowdefy: '{{ lowdefy }}' | ||
plugins: | ||
- name: '{{ name }}' | ||
version: '{{ version }}' | ||
``` | ||
on: | ||
name: | ||
_var: name | ||
version: | ||
_ref: | ||
path: | ||
_var: packageJsonPath | ||
key: version | ||
lowdefy: | ||
_ref: | ||
path: package.json | ||
key: dependencies.lowdefy |
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 |
---|---|---|
|
@@ -22,7 +22,6 @@ | |
"@swc/cli": "0.1.62", | ||
"@swc/core": "1.3.66" | ||
}, | ||
"packageManager": "[email protected]", | ||
"publishConfig": { | ||
"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,27 @@ | ||
{ | ||
"name": "@lowdefy/community-plugin-confetti", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"type": "module", | ||
"exports": { | ||
"./actions": "./dist/actions.js", | ||
"./types": "./dist/types.js" | ||
}, | ||
"files": [ | ||
"dist/*" | ||
], | ||
"scripts": { | ||
"build": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start --copy-files", | ||
"prepare": "pnpm build" | ||
}, | ||
"devDependencies": { | ||
"@swc/cli": "0.1.62", | ||
"@swc/core": "1.3.66" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"js-confetti": "0.11.0" | ||
} | ||
} |
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 @@ | ||
export { default as Confetti } from './actions/Confetti.js'; |
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,15 @@ | ||
import JSConfetti from 'js-confetti'; | ||
|
||
async function Confetti({ params = {} }) { | ||
const jsConfetti = new JSConfetti(); | ||
const { emojis, confettiRadius, confettiNumber, emojiSize, confettiColors } = params; | ||
jsConfetti.addConfetti({ | ||
emojis, | ||
confettiRadius, | ||
confettiNumber, | ||
emojiSize, | ||
confettiColors, | ||
}); | ||
} | ||
|
||
export default Confetti; |
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,5 @@ | ||
import * as actions from './actions.js'; | ||
|
||
export default { | ||
actions: Object.keys(actions), | ||
}; |
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 |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
"@swc/cli": "0.1.62", | ||
"@swc/core": "1.3.66" | ||
}, | ||
"packageManager": "[email protected]", | ||
"publishConfig": { | ||
"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 |
---|---|---|
|
@@ -27,7 +27,6 @@ | |
"@swc/cli": "0.1.62", | ||
"@swc/core": "1.3.66" | ||
}, | ||
"packageManager": "[email protected]", | ||
"publishConfig": { | ||
"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 |
---|---|---|
|
@@ -23,7 +23,6 @@ | |
"@swc/cli": "0.1.62", | ||
"@swc/core": "1.3.66" | ||
}, | ||
"packageManager": "[email protected]", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
|
Oops, something went wrong.