Skip to content

Commit

Permalink
Merge pull request #16 from lowdefy/confetti
Browse files Browse the repository at this point in the history
Confetti Plugin
  • Loading branch information
Gervwyk authored Sep 21, 2023
2 parents 10f6684 + 201281a commit 2557002
Show file tree
Hide file tree
Showing 17 changed files with 300 additions and 3,320 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-onions-breathe.md
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).
98 changes: 98 additions & 0 deletions apps/docs/community-plugin-confetti/Confetti.yaml
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
```
10 changes: 9 additions & 1 deletion apps/docs/community-plugin-mongodb/MongoDB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ _ref:
properties:
content: |
This plugin extends the [Lowdefy MongoDB connection](https://docs.lowdefy.com/MongoDB) with additional request types.
- _ref:
path: templates/plugin_usage.yaml
vars:
name: '@lowdefy/community-plugin-mongodb'
packageJsonPath: ../../plugins/community-plugin-mongodb/package.json
- id: markdown
type: MarkdownWithCode
properties:
content: |
## Requests
Request types:
Expand Down
5 changes: 5 additions & 0 deletions apps/docs/community-plugin-nodemailer/EmailProvider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ _ref:
pageTitle: EmailProvider
section: '@lowdefy/community-plugin-nodemailer'
content:
- _ref:
path: templates/plugin_usage.yaml
vars:
name: '@lowdefy/community-plugin-nodemailer'
packageJsonPath: ../../plugins/community-plugin-nodemailer/package.json
- id: markdown
type: MarkdownWithCode
properties:
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/deploy/vercel.install.sh
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
3 changes: 3 additions & 0 deletions apps/docs/lowdefy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ plugins:
version: 'workspace:*'
- name: '@lowdefy/community-plugin-nodemailer'
version: 'workspace:*'
- name: '@lowdefy/community-plugin-confetti'
version: 'workspace:*'

menus:
_ref: menus.yaml

pages:
- _ref: community-plugin-confetti/Confetti.yaml
- _ref: community-plugin-nodemailer/EmailProvider.yaml
- _ref: community-plugin-mongodb/MongoDB.yaml
5 changes: 5 additions & 0 deletions apps/docs/menus.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
- id: default
links:
- id: community-plugin-confetti
type: MenuLink
pageId: Confetti
properties:
title: Confetti
- id: community-plugin-nodemailer
type: MenuGroup
properties:
Expand Down
27 changes: 27 additions & 0 deletions apps/docs/templates/plugin_usage.yaml
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
1 change: 0 additions & 1 deletion plugins/community-plugin-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@swc/cli": "0.1.62",
"@swc/core": "1.3.66"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
Expand Down
27 changes: 27 additions & 0 deletions plugins/community-plugin-confetti/package.json
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"
}
}
1 change: 1 addition & 0 deletions plugins/community-plugin-confetti/src/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Confetti } from './actions/Confetti.js';
15 changes: 15 additions & 0 deletions plugins/community-plugin-confetti/src/actions/Confetti.js
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;
5 changes: 5 additions & 0 deletions plugins/community-plugin-confetti/src/types.js
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),
};
1 change: 0 additions & 1 deletion plugins/community-plugin-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"@swc/cli": "0.1.62",
"@swc/core": "1.3.66"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
Expand Down
1 change: 0 additions & 1 deletion plugins/community-plugin-mongodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@swc/cli": "0.1.62",
"@swc/core": "1.3.66"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
Expand Down
1 change: 0 additions & 1 deletion plugins/community-plugin-nodemailer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@swc/cli": "0.1.62",
"@swc/core": "1.3.66"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
Expand Down
Loading

0 comments on commit 2557002

Please sign in to comment.