wagtail-daisIE 0.1.2__tar.gz
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.
- wagtail_daisie-0.1.2/PKG-INFO +232 -0
- wagtail_daisie-0.1.2/README.md +202 -0
- wagtail_daisie-0.1.2/pyproject.toml +66 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/__init__.py +2 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/apps.py +7 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/form_fields.py +26 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/migrations/0001_initial.py +128 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/migrations/__init__.py +0 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/models.py +425 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/panels.py +21 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/templates/wagtail_daisIE/admin/daisyui_size_widget.html +8 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/templates/wagtail_daisIE/previews/theme.html +743 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/templates/wagtail_daisIE/tags/theme.html +46 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/templatetags/__init__.py +0 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/templatetags/wagtail_daisIE_tags.py +68 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/wagtail_hooks.py +36 -0
- wagtail_daisie-0.1.2/src/wagtail_daisIE/widgets.py +118 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wagtail-daisIE
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Create reusable DaisyUI themes through Wagtail
|
|
5
|
+
License-Expression: BSD-3-Clause
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Framework :: Django :: 5.0
|
|
15
|
+
Classifier: Framework :: Django :: 5.1
|
|
16
|
+
Classifier: Framework :: Django :: 6.0
|
|
17
|
+
Classifier: Framework :: Wagtail
|
|
18
|
+
Classifier: Framework :: Wagtail :: 6
|
|
19
|
+
Classifier: Framework :: Wagtail :: 7
|
|
20
|
+
Requires-Dist: django>=5.0
|
|
21
|
+
Requires-Dist: django-colorfield>=0.14.0
|
|
22
|
+
Requires-Dist: wagtail>=7.3.2
|
|
23
|
+
Requires-Python: >=3.13
|
|
24
|
+
Project-URL: Homepage, https://github.com/baldwinboy/wagtail-daisIE
|
|
25
|
+
Project-URL: Repository, https://github.com/baldwinboy/wagtail-daisIE
|
|
26
|
+
Project-URL: Changelog, https://github.com/baldwinboy/wagtail-daisIE/blob/main/CHANGELOG.md
|
|
27
|
+
Project-URL: Documentation, https://github.com/baldwinboy/wagtail-daisIE/blob/main/README.md
|
|
28
|
+
Project-URL: Issues, https://github.com/baldwinboy/wagtail-daisIE/issues
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Wagtail DaisyUI Interface Editor
|
|
32
|
+
|
|
33
|
+
Create reusable [DaisyUI](https://daisyui.com/) themes through Wagtail and apply them to pages.
|
|
34
|
+
|
|
35
|
+
## Links
|
|
36
|
+
|
|
37
|
+
- [Documentation](https://github.com/baldwinboy/wagtail-daisIE/blob/main/README.md)
|
|
38
|
+
- [Changelog](https://github.com/baldwinboy/wagtail-daisIE/blob/main/CHANGELOG.md)
|
|
39
|
+
- [Contributing](https://github.com/baldwinboy/wagtail-daisIE/blob/main/CONTRIBUTING.md)
|
|
40
|
+
- [Discussions](https://github.com/baldwinboy/wagtail-daisIE/discussions)
|
|
41
|
+
- [Security](https://github.com/baldwinboy/wagtail-daisIE/security)
|
|
42
|
+
|
|
43
|
+
## Supported versions
|
|
44
|
+
|
|
45
|
+
This package supports Wagtail 7.0 and up, and all [compatible versions of Python and Django](https://docs.wagtail.org/en/stable/releases/upgrading.html#compatible-django-python-versions).
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Pick the command for your preferred package installer:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uv add wagtail-daisIE
|
|
53
|
+
poetry add wagtail-daisIE
|
|
54
|
+
pip install wagtail-daisIE
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick start
|
|
58
|
+
|
|
59
|
+
### 1. Add to `INSTALLED_APPS`
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
# myproject/settings.py
|
|
63
|
+
INSTALLED_APPS = [
|
|
64
|
+
...
|
|
65
|
+
"wagtail_daisIE",
|
|
66
|
+
"colorfield",
|
|
67
|
+
...
|
|
68
|
+
]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Run migrations
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
python manage.py migrate
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 3. Create a theme
|
|
78
|
+
|
|
79
|
+
In the Wagtail admin, navigate to Snippets > DaisyUI Themes and create a new theme. Configure:
|
|
80
|
+
|
|
81
|
+
- **Name**: A unique identifier (e.g. `my-theme`)
|
|
82
|
+
- **Set as default**: Check this to make it the fallback theme
|
|
83
|
+
- **Color scheme**: `light`, `dark`, or `normal`
|
|
84
|
+
- **Colors**: Primary, secondary, accent, neutral, base surfaces, semantic colors
|
|
85
|
+
- **Border radii**: Box, field, selector
|
|
86
|
+
- **Sizes**: Field, selector, border width
|
|
87
|
+
- **Effects**: Depth (3D) and noise toggle
|
|
88
|
+
|
|
89
|
+
### 4. Use the page mixin
|
|
90
|
+
|
|
91
|
+
Add `DaisyUIThemePageMixin` to any Wagtail Page model:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from wagtail.models import Page
|
|
95
|
+
from wagtail.admin.panels import FieldPanel
|
|
96
|
+
from wagtail_daisIE.models import DaisyUIThemePageMixin
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class MyPage(DaisyUIThemePageMixin, Page):
|
|
100
|
+
body = RichTextField()
|
|
101
|
+
|
|
102
|
+
content_panels = Page.content_panels + [
|
|
103
|
+
FieldPanel("body"),
|
|
104
|
+
FieldPanel("daisyui_theme"), # Add the theme selector
|
|
105
|
+
]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This mixin adds:
|
|
109
|
+
|
|
110
|
+
- A `daisyui_theme` ForeignKey field to `DaisyUITheme`
|
|
111
|
+
- Automatic injection of `daisyui_theme` into the page template context
|
|
112
|
+
- A `get_daisyui_theme()` method that returns the selected theme (or the default theme if none is selected)
|
|
113
|
+
|
|
114
|
+
### 5. Render the theme in your templates
|
|
115
|
+
|
|
116
|
+
Load the template tags and render the theme CSS in `<head>`:
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
{% load wagtailcore_tags wagtail_daisIE_tags %}
|
|
120
|
+
<!DOCTYPE html>
|
|
121
|
+
<html{% if daisyui_theme %} data-theme="{{ daisyui_theme.name }}"{% endif %}>
|
|
122
|
+
<head>
|
|
123
|
+
...
|
|
124
|
+
{% daisyui_theme_css daisyui_theme %}
|
|
125
|
+
</head>
|
|
126
|
+
<body>
|
|
127
|
+
{% block content %}{% endblock %}
|
|
128
|
+
</body>
|
|
129
|
+
</html>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The `{% daisyui_theme_css %}` tag outputs an inline `<style>` block with all DaisyUI CSS custom properties for the theme.
|
|
133
|
+
|
|
134
|
+
Alternatively, use `{% daisyui_theme_inline_css %}` to get the raw CSS string for custom placement:
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<style>
|
|
138
|
+
{% daisyui_theme_inline_css daisyui_theme %}
|
|
139
|
+
</style>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 6. Load DaisyUI and Tailwind CSS
|
|
143
|
+
|
|
144
|
+
Add DaisyUI and Tailwind CSS to your base template. For a quick setup, use the CDN:
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
|
|
148
|
+
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Or use [Django Tailwind CLI](https://django-tailwind-cli.readthedocs.io/latest/):
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
# settings.py
|
|
155
|
+
STATICFILES_DIRS = [BASE_DIR / "assets"]
|
|
156
|
+
# Custom CSS paths
|
|
157
|
+
TAILWIND_CLI_SRC_CSS = "src/styles/main.css"
|
|
158
|
+
TAILWIND_CLI_DIST_CSS = "css/app.css"
|
|
159
|
+
|
|
160
|
+
# Enable DaisyUI
|
|
161
|
+
TAILWIND_CLI_USE_DAISY_UI = True
|
|
162
|
+
|
|
163
|
+
# Use an already-installed Tailwind binary (e.g. `brew install tailwindcss`)
|
|
164
|
+
TAILWIND_CLI_USE_SYSTEM_BINARY = True
|
|
165
|
+
|
|
166
|
+
# Auto-inject @source directives for editable-installed external apps (opt-in)
|
|
167
|
+
TAILWIND_CLI_AUTO_SOURCE_EXTERNAL_APPS = True
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Or install via npm and build with your own pipeline:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm install daisyui @tailwindcss/cli tailwindcss
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## API reference
|
|
177
|
+
|
|
178
|
+
### `DaisyUIThemePageMixin`
|
|
179
|
+
|
|
180
|
+
An abstract Django model mixin for Wagtail Pages.
|
|
181
|
+
|
|
182
|
+
**Fields:**
|
|
183
|
+
|
|
184
|
+
| Field | Type | Description |
|
|
185
|
+
|-------|------|-------------|
|
|
186
|
+
| `daisyui_theme` | `ForeignKey(DaisyUITheme)` | The selected theme, or `None` |
|
|
187
|
+
|
|
188
|
+
**Methods:**
|
|
189
|
+
|
|
190
|
+
| Method | Returns | Description |
|
|
191
|
+
|--------|---------|-------------|
|
|
192
|
+
| `get_daisyui_theme()` | `DaisyUITheme \| None` | Returns the selected theme, or the default theme if none was selected |
|
|
193
|
+
|
|
194
|
+
**Context:**
|
|
195
|
+
|
|
196
|
+
| Variable | Type | Description |
|
|
197
|
+
|----------|------|-------------|
|
|
198
|
+
| `daisyui_theme` | `DaisyUITheme \| None` | Available in all page templates |
|
|
199
|
+
|
|
200
|
+
### Template tags
|
|
201
|
+
|
|
202
|
+
| Tag | Type | Output |
|
|
203
|
+
|-----|------|--------|
|
|
204
|
+
| `{% daisyui_theme_css theme %}` | Inclusion tag | Inline `<style>` block with DaisyUI CSS custom properties |
|
|
205
|
+
| `{% daisyui_theme_inline_css theme %}` | Simple tag | Raw CSS string for custom placement |
|
|
206
|
+
|
|
207
|
+
### `DaisyUITheme`
|
|
208
|
+
|
|
209
|
+
A snippet model representing a DaisyUI theme. Accessible via Snippets in the Wagtail admin.
|
|
210
|
+
|
|
211
|
+
**Properties:** name, default, prefers_dark, color_scheme, colors, radii, sizes, effects.
|
|
212
|
+
|
|
213
|
+
## Settings
|
|
214
|
+
|
|
215
|
+
No Django settings are required. The package works out of the box once added to `INSTALLED_APPS`.
|
|
216
|
+
|
|
217
|
+
## Development
|
|
218
|
+
|
|
219
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and contribution workflow.
|
|
220
|
+
|
|
221
|
+
Key commands (via `just`):
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
just install # Install Python and Node.js dependencies
|
|
225
|
+
just demo # Run the demo site
|
|
226
|
+
just test # Run tests
|
|
227
|
+
just lint # Run all linters
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
`wagtail-daisIE` is licensed under the BSD 3-Clause License.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Wagtail DaisyUI Interface Editor
|
|
2
|
+
|
|
3
|
+
Create reusable [DaisyUI](https://daisyui.com/) themes through Wagtail and apply them to pages.
|
|
4
|
+
|
|
5
|
+
## Links
|
|
6
|
+
|
|
7
|
+
- [Documentation](https://github.com/baldwinboy/wagtail-daisIE/blob/main/README.md)
|
|
8
|
+
- [Changelog](https://github.com/baldwinboy/wagtail-daisIE/blob/main/CHANGELOG.md)
|
|
9
|
+
- [Contributing](https://github.com/baldwinboy/wagtail-daisIE/blob/main/CONTRIBUTING.md)
|
|
10
|
+
- [Discussions](https://github.com/baldwinboy/wagtail-daisIE/discussions)
|
|
11
|
+
- [Security](https://github.com/baldwinboy/wagtail-daisIE/security)
|
|
12
|
+
|
|
13
|
+
## Supported versions
|
|
14
|
+
|
|
15
|
+
This package supports Wagtail 7.0 and up, and all [compatible versions of Python and Django](https://docs.wagtail.org/en/stable/releases/upgrading.html#compatible-django-python-versions).
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Pick the command for your preferred package installer:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv add wagtail-daisIE
|
|
23
|
+
poetry add wagtail-daisIE
|
|
24
|
+
pip install wagtail-daisIE
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
### 1. Add to `INSTALLED_APPS`
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
# myproject/settings.py
|
|
33
|
+
INSTALLED_APPS = [
|
|
34
|
+
...
|
|
35
|
+
"wagtail_daisIE",
|
|
36
|
+
"colorfield",
|
|
37
|
+
...
|
|
38
|
+
]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Run migrations
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python manage.py migrate
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 3. Create a theme
|
|
48
|
+
|
|
49
|
+
In the Wagtail admin, navigate to Snippets > DaisyUI Themes and create a new theme. Configure:
|
|
50
|
+
|
|
51
|
+
- **Name**: A unique identifier (e.g. `my-theme`)
|
|
52
|
+
- **Set as default**: Check this to make it the fallback theme
|
|
53
|
+
- **Color scheme**: `light`, `dark`, or `normal`
|
|
54
|
+
- **Colors**: Primary, secondary, accent, neutral, base surfaces, semantic colors
|
|
55
|
+
- **Border radii**: Box, field, selector
|
|
56
|
+
- **Sizes**: Field, selector, border width
|
|
57
|
+
- **Effects**: Depth (3D) and noise toggle
|
|
58
|
+
|
|
59
|
+
### 4. Use the page mixin
|
|
60
|
+
|
|
61
|
+
Add `DaisyUIThemePageMixin` to any Wagtail Page model:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from wagtail.models import Page
|
|
65
|
+
from wagtail.admin.panels import FieldPanel
|
|
66
|
+
from wagtail_daisIE.models import DaisyUIThemePageMixin
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class MyPage(DaisyUIThemePageMixin, Page):
|
|
70
|
+
body = RichTextField()
|
|
71
|
+
|
|
72
|
+
content_panels = Page.content_panels + [
|
|
73
|
+
FieldPanel("body"),
|
|
74
|
+
FieldPanel("daisyui_theme"), # Add the theme selector
|
|
75
|
+
]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This mixin adds:
|
|
79
|
+
|
|
80
|
+
- A `daisyui_theme` ForeignKey field to `DaisyUITheme`
|
|
81
|
+
- Automatic injection of `daisyui_theme` into the page template context
|
|
82
|
+
- A `get_daisyui_theme()` method that returns the selected theme (or the default theme if none is selected)
|
|
83
|
+
|
|
84
|
+
### 5. Render the theme in your templates
|
|
85
|
+
|
|
86
|
+
Load the template tags and render the theme CSS in `<head>`:
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
{% load wagtailcore_tags wagtail_daisIE_tags %}
|
|
90
|
+
<!DOCTYPE html>
|
|
91
|
+
<html{% if daisyui_theme %} data-theme="{{ daisyui_theme.name }}"{% endif %}>
|
|
92
|
+
<head>
|
|
93
|
+
...
|
|
94
|
+
{% daisyui_theme_css daisyui_theme %}
|
|
95
|
+
</head>
|
|
96
|
+
<body>
|
|
97
|
+
{% block content %}{% endblock %}
|
|
98
|
+
</body>
|
|
99
|
+
</html>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The `{% daisyui_theme_css %}` tag outputs an inline `<style>` block with all DaisyUI CSS custom properties for the theme.
|
|
103
|
+
|
|
104
|
+
Alternatively, use `{% daisyui_theme_inline_css %}` to get the raw CSS string for custom placement:
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<style>
|
|
108
|
+
{% daisyui_theme_inline_css daisyui_theme %}
|
|
109
|
+
</style>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 6. Load DaisyUI and Tailwind CSS
|
|
113
|
+
|
|
114
|
+
Add DaisyUI and Tailwind CSS to your base template. For a quick setup, use the CDN:
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
|
|
118
|
+
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or use [Django Tailwind CLI](https://django-tailwind-cli.readthedocs.io/latest/):
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
# settings.py
|
|
125
|
+
STATICFILES_DIRS = [BASE_DIR / "assets"]
|
|
126
|
+
# Custom CSS paths
|
|
127
|
+
TAILWIND_CLI_SRC_CSS = "src/styles/main.css"
|
|
128
|
+
TAILWIND_CLI_DIST_CSS = "css/app.css"
|
|
129
|
+
|
|
130
|
+
# Enable DaisyUI
|
|
131
|
+
TAILWIND_CLI_USE_DAISY_UI = True
|
|
132
|
+
|
|
133
|
+
# Use an already-installed Tailwind binary (e.g. `brew install tailwindcss`)
|
|
134
|
+
TAILWIND_CLI_USE_SYSTEM_BINARY = True
|
|
135
|
+
|
|
136
|
+
# Auto-inject @source directives for editable-installed external apps (opt-in)
|
|
137
|
+
TAILWIND_CLI_AUTO_SOURCE_EXTERNAL_APPS = True
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Or install via npm and build with your own pipeline:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm install daisyui @tailwindcss/cli tailwindcss
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## API reference
|
|
147
|
+
|
|
148
|
+
### `DaisyUIThemePageMixin`
|
|
149
|
+
|
|
150
|
+
An abstract Django model mixin for Wagtail Pages.
|
|
151
|
+
|
|
152
|
+
**Fields:**
|
|
153
|
+
|
|
154
|
+
| Field | Type | Description |
|
|
155
|
+
|-------|------|-------------|
|
|
156
|
+
| `daisyui_theme` | `ForeignKey(DaisyUITheme)` | The selected theme, or `None` |
|
|
157
|
+
|
|
158
|
+
**Methods:**
|
|
159
|
+
|
|
160
|
+
| Method | Returns | Description |
|
|
161
|
+
|--------|---------|-------------|
|
|
162
|
+
| `get_daisyui_theme()` | `DaisyUITheme \| None` | Returns the selected theme, or the default theme if none was selected |
|
|
163
|
+
|
|
164
|
+
**Context:**
|
|
165
|
+
|
|
166
|
+
| Variable | Type | Description |
|
|
167
|
+
|----------|------|-------------|
|
|
168
|
+
| `daisyui_theme` | `DaisyUITheme \| None` | Available in all page templates |
|
|
169
|
+
|
|
170
|
+
### Template tags
|
|
171
|
+
|
|
172
|
+
| Tag | Type | Output |
|
|
173
|
+
|-----|------|--------|
|
|
174
|
+
| `{% daisyui_theme_css theme %}` | Inclusion tag | Inline `<style>` block with DaisyUI CSS custom properties |
|
|
175
|
+
| `{% daisyui_theme_inline_css theme %}` | Simple tag | Raw CSS string for custom placement |
|
|
176
|
+
|
|
177
|
+
### `DaisyUITheme`
|
|
178
|
+
|
|
179
|
+
A snippet model representing a DaisyUI theme. Accessible via Snippets in the Wagtail admin.
|
|
180
|
+
|
|
181
|
+
**Properties:** name, default, prefers_dark, color_scheme, colors, radii, sizes, effects.
|
|
182
|
+
|
|
183
|
+
## Settings
|
|
184
|
+
|
|
185
|
+
No Django settings are required. The package works out of the box once added to `INSTALLED_APPS`.
|
|
186
|
+
|
|
187
|
+
## Development
|
|
188
|
+
|
|
189
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and contribution workflow.
|
|
190
|
+
|
|
191
|
+
Key commands (via `just`):
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
just install # Install Python and Node.js dependencies
|
|
195
|
+
just demo # Run the demo site
|
|
196
|
+
just test # Run tests
|
|
197
|
+
just lint # Run all linters
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
`wagtail-daisIE` is licensed under the BSD 3-Clause License.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wagtail-daisIE"
|
|
3
|
+
version = "0.1.2"
|
|
4
|
+
description = "Create reusable DaisyUI themes through Wagtail"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
classifiers = [
|
|
8
|
+
"Development Status :: 3 - Alpha",
|
|
9
|
+
"Intended Audience :: Developers",
|
|
10
|
+
"Operating System :: OS Independent",
|
|
11
|
+
"Programming Language :: Python",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.13",
|
|
14
|
+
"Programming Language :: Python :: 3.14",
|
|
15
|
+
"Framework :: Django",
|
|
16
|
+
"Framework :: Django :: 5.0",
|
|
17
|
+
"Framework :: Django :: 5.1",
|
|
18
|
+
"Framework :: Django :: 6.0",
|
|
19
|
+
"Framework :: Wagtail",
|
|
20
|
+
"Framework :: Wagtail :: 6",
|
|
21
|
+
"Framework :: Wagtail :: 7",
|
|
22
|
+
]
|
|
23
|
+
requires-python = ">=3.13"
|
|
24
|
+
dependencies = [
|
|
25
|
+
"Django>=5.0",
|
|
26
|
+
"django-colorfield>=0.14.0",
|
|
27
|
+
"Wagtail>=7.3.2",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/baldwinboy/wagtail-daisIE"
|
|
32
|
+
Repository = "https://github.com/baldwinboy/wagtail-daisIE"
|
|
33
|
+
Changelog = "https://github.com/baldwinboy/wagtail-daisIE/blob/main/CHANGELOG.md"
|
|
34
|
+
Documentation = "https://github.com/baldwinboy/wagtail-daisIE/blob/main/README.md"
|
|
35
|
+
Issues = "https://github.com/baldwinboy/wagtail-daisIE/issues"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
"dj-database-url==2.1.0",
|
|
40
|
+
"pre-commit==3.4.0",
|
|
41
|
+
"prek>=0.4.1",
|
|
42
|
+
"pytest==8.1.1",
|
|
43
|
+
"pytest-cov==5.0.0",
|
|
44
|
+
"pytest-django==4.8.0",
|
|
45
|
+
"ruff>=0.15.9",
|
|
46
|
+
]
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["uv_build>=0.11.1,<0.12"]
|
|
49
|
+
build-backend = "uv_build"
|
|
50
|
+
|
|
51
|
+
[tool.uv.build-backend]
|
|
52
|
+
module-name = "wagtail_daisIE"
|
|
53
|
+
source-exclude = [
|
|
54
|
+
"wagtail_daisIE/static_src",
|
|
55
|
+
"wagtail_daisIE/test",
|
|
56
|
+
"wagtail_daisIE/static/wagtail_daisIE/js/.gitignore",
|
|
57
|
+
"testmanage.py",
|
|
58
|
+
".*",
|
|
59
|
+
"*.js",
|
|
60
|
+
"*.json",
|
|
61
|
+
"*.ini",
|
|
62
|
+
"*.yml",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
DJANGO_SETTINGS_MODULE = "wagtail_daisIE.test.settings"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from django import forms
|
|
2
|
+
|
|
3
|
+
from .widgets import DaisyUISize, DaisyUISizeUnitChoices, DaisyUISizeWidget
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DaisyUISizeFormField(forms.MultiValueField):
|
|
7
|
+
widget = DaisyUISizeWidget
|
|
8
|
+
|
|
9
|
+
def __init__(self, **kwargs):
|
|
10
|
+
kwargs.pop("max_length", None)
|
|
11
|
+
fields = (
|
|
12
|
+
forms.FloatField(min_value=0), # or allow negative if needed
|
|
13
|
+
forms.ChoiceField(choices=DaisyUISizeUnitChoices.choices),
|
|
14
|
+
)
|
|
15
|
+
# We need to set require_all_fields to True so that if one part is missing,
|
|
16
|
+
# the whole field is considered incomplete.
|
|
17
|
+
kwargs.setdefault("require_all_fields", True)
|
|
18
|
+
super().__init__(fields=fields, **kwargs)
|
|
19
|
+
|
|
20
|
+
def compress(self, data_list):
|
|
21
|
+
"""Combine the two sub-values back into a DaisyUISize object."""
|
|
22
|
+
if data_list:
|
|
23
|
+
number, unit = data_list
|
|
24
|
+
if number is not None and unit in dict(DaisyUISizeUnitChoices.choices):
|
|
25
|
+
return DaisyUISize(float(number), unit)
|
|
26
|
+
return None
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Generated by Django 6.0.4 on 2026-06-10 12:48
|
|
2
|
+
|
|
3
|
+
import colorfield.fields
|
|
4
|
+
import django.db.models.deletion
|
|
5
|
+
import modelcluster.fields
|
|
6
|
+
import wagtail.models.preview
|
|
7
|
+
import wagtail_daisIE.models
|
|
8
|
+
from django.conf import settings
|
|
9
|
+
from django.db import migrations, models
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Migration(migrations.Migration):
|
|
13
|
+
|
|
14
|
+
initial = True
|
|
15
|
+
|
|
16
|
+
dependencies = [
|
|
17
|
+
('wagtailcore', '0097_baselogentry_uuid_action_timestamp_indexes'),
|
|
18
|
+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
operations = [
|
|
22
|
+
migrations.CreateModel(
|
|
23
|
+
name='DaisyUITheme',
|
|
24
|
+
fields=[
|
|
25
|
+
('live', models.BooleanField(default=True, editable=False, verbose_name='live')),
|
|
26
|
+
('has_unpublished_changes', models.BooleanField(default=False, editable=False, verbose_name='has unpublished changes')),
|
|
27
|
+
('first_published_at', models.DateTimeField(blank=True, db_index=True, null=True, verbose_name='first published at')),
|
|
28
|
+
('last_published_at', models.DateTimeField(editable=False, null=True, verbose_name='last published at')),
|
|
29
|
+
('go_live_at', models.DateTimeField(blank=True, null=True, verbose_name='go live date/time')),
|
|
30
|
+
('expire_at', models.DateTimeField(blank=True, null=True, verbose_name='expiry date/time')),
|
|
31
|
+
('expired', models.BooleanField(default=False, editable=False, verbose_name='expired')),
|
|
32
|
+
('locked', models.BooleanField(default=False, editable=False, verbose_name='locked')),
|
|
33
|
+
('locked_at', models.DateTimeField(editable=False, null=True, verbose_name='locked at')),
|
|
34
|
+
('name', models.CharField(max_length=255, primary_key=True, serialize=False, unique=True, verbose_name='Name')),
|
|
35
|
+
('default', models.BooleanField(default=False, help_text='Is this the default theme?', verbose_name='Set as default')),
|
|
36
|
+
('prefers_dark', models.BooleanField(default=False, help_text='Is this the default dark theme?', verbose_name='Set as default dark theme')),
|
|
37
|
+
('color_scheme', models.CharField(choices=[('normal', 'Normal'), ('light', 'Light'), ('dark', 'Dark')], default='light', help_text='This theme will be applied to browsers with this color scheme', max_length=128, verbose_name='Color scheme')),
|
|
38
|
+
('latest_revision', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.revision', verbose_name='latest revision')),
|
|
39
|
+
('live_revision', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.revision', verbose_name='live revision')),
|
|
40
|
+
('locked_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='locked_%(class)ss', to=settings.AUTH_USER_MODEL, verbose_name='locked by')),
|
|
41
|
+
],
|
|
42
|
+
options={
|
|
43
|
+
'verbose_name': 'DaisyUI Theme',
|
|
44
|
+
'verbose_name_plural': 'DaisyUI Themes',
|
|
45
|
+
},
|
|
46
|
+
bases=(wagtail.models.preview.PreviewableMixin, models.Model),
|
|
47
|
+
),
|
|
48
|
+
migrations.CreateModel(
|
|
49
|
+
name='DaisyUIThemeColors',
|
|
50
|
+
fields=[
|
|
51
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
52
|
+
('primary', colorfield.fields.ColorField(default='#422ad5ff', help_text='The main color of your theme', image_field=None, max_length=25, samples=None, verbose_name='Primary theme color')),
|
|
53
|
+
('primary_content', colorfield.fields.ColorField(default='#e0e7ffff', help_text='Foreground content color to use on primary color', image_field=None, max_length=25, samples=None, verbose_name='Primary theme content color')),
|
|
54
|
+
('secondary', colorfield.fields.ColorField(default='#f43098ff', help_text='The secondary color of your theme', image_field=None, max_length=25, samples=None, verbose_name='Secondary theme color')),
|
|
55
|
+
('secondary_content', colorfield.fields.ColorField(default='#f9e4f0ff', help_text='Foreground content color to use on secondary color', image_field=None, max_length=25, samples=None, verbose_name='Secondary theme content color')),
|
|
56
|
+
('accent', colorfield.fields.ColorField(default='#00d3bbff', help_text='The accent color of your theme', image_field=None, max_length=25, samples=None, verbose_name='Accent theme color')),
|
|
57
|
+
('accent_content', colorfield.fields.ColorField(default='#084d49ff', help_text='Foreground content color to use on accent color', image_field=None, max_length=25, samples=None, verbose_name='Accent theme content color')),
|
|
58
|
+
('neutral', colorfield.fields.ColorField(default='#0b0809ff', help_text='For not-saturated parts of UI', image_field=None, max_length=25, samples=None, verbose_name='Neutral dark color')),
|
|
59
|
+
('neutral_content', colorfield.fields.ColorField(default='#e7e3e4ff', help_text='Foreground content color to use on neutral color', image_field=None, max_length=25, samples=None, verbose_name='Neutral dark content color')),
|
|
60
|
+
('base_100', colorfield.fields.ColorField(default='#ffffffff', help_text='Used for blank backgrounds', image_field=None, max_length=25, samples=None, verbose_name='Base surface color of page')),
|
|
61
|
+
('base_200', colorfield.fields.ColorField(default='##f8f8f8ff', help_text='To create elevations', image_field=None, max_length=25, samples=None, verbose_name='Base color, darker shade')),
|
|
62
|
+
('base_300', colorfield.fields.ColorField(default='#eeeeeeff', help_text='To create elevations', image_field=None, max_length=25, samples=None, verbose_name='Base color, even darker shade')),
|
|
63
|
+
('base_content', colorfield.fields.ColorField(default='#1b1718ff', help_text='Foreground content color to use on base color', image_field=None, max_length=25, samples=None, verbose_name='Base content color')),
|
|
64
|
+
('info', colorfield.fields.ColorField(default='#00bafeff', help_text='For informative/helpful messages', image_field=None, max_length=25, samples=None, verbose_name='Info color')),
|
|
65
|
+
('info_content', colorfield.fields.ColorField(default='#042e49ff', help_text='Foreground content color to use on info color', image_field=None, max_length=25, samples=None, verbose_name='Info content color')),
|
|
66
|
+
('success', colorfield.fields.ColorField(default='#00d390ff', help_text='For success/safe messages', image_field=None, max_length=25, samples=None, verbose_name='Success color')),
|
|
67
|
+
('success_content', colorfield.fields.ColorField(default='#004c39ff', help_text='Foreground content color to use on success color', image_field=None, max_length=25, samples=None, verbose_name='Success content color')),
|
|
68
|
+
('warning', colorfield.fields.ColorField(default='#fcb700ff', help_text='For warning/caution messages', image_field=None, max_length=25, samples=None, verbose_name='Warning color')),
|
|
69
|
+
('warning_content', colorfield.fields.ColorField(default='#793205ff', help_text='Foreground content color to use on warning color', image_field=None, max_length=25, samples=None, verbose_name='Warning content color')),
|
|
70
|
+
('error', colorfield.fields.ColorField(default='#ff637dff', help_text='For error/danger/destructive messages', image_field=None, max_length=25, samples=None, verbose_name='Error color')),
|
|
71
|
+
('error_content', colorfield.fields.ColorField(default='#4d0218ff', help_text='Foreground content color to use on error color', image_field=None, max_length=25, samples=None, verbose_name='Error content color')),
|
|
72
|
+
('theme', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='colors', to='wagtail_daisIE.daisyuitheme', unique=True)),
|
|
73
|
+
],
|
|
74
|
+
options={
|
|
75
|
+
'verbose_name': 'DaisyUI Theme Colors',
|
|
76
|
+
'verbose_name_plural': 'DaisyUI Theme Colors',
|
|
77
|
+
},
|
|
78
|
+
),
|
|
79
|
+
migrations.CreateModel(
|
|
80
|
+
name='DaisyUIThemeEffects',
|
|
81
|
+
fields=[
|
|
82
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
83
|
+
('depth', models.BooleanField(default=True, help_text='Add 3D depth on fields & selectors', verbose_name='Depth effect')),
|
|
84
|
+
('noise', models.BooleanField(default=False, help_text='Add noise pattern on fields & selectors', verbose_name='Noise effect')),
|
|
85
|
+
('theme', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='effects', to='wagtail_daisIE.daisyuitheme', unique=True)),
|
|
86
|
+
],
|
|
87
|
+
options={
|
|
88
|
+
'verbose_name': 'DaisyUI Theme Effects',
|
|
89
|
+
'verbose_name_plural': 'DaisyUI Theme Effects',
|
|
90
|
+
},
|
|
91
|
+
),
|
|
92
|
+
migrations.CreateModel(
|
|
93
|
+
name='DaisyUIThemeRadii',
|
|
94
|
+
fields=[
|
|
95
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
96
|
+
('box', wagtail_daisIE.models.DaisyUISizeField(default='0.5rem', help_text='For card, modal, alert UI', verbose_name='Box border radius')),
|
|
97
|
+
('field', wagtail_daisIE.models.DaisyUISizeField(default='0.25rem', help_text='For button, input, select, tab UI', verbose_name='Field border radius')),
|
|
98
|
+
('selector', wagtail_daisIE.models.DaisyUISizeField(default='1rem', help_text='For checkbox, toggle, badge UI', verbose_name='Selector border radius')),
|
|
99
|
+
('theme', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='radii', to='wagtail_daisIE.daisyuitheme', unique=True)),
|
|
100
|
+
],
|
|
101
|
+
options={
|
|
102
|
+
'verbose_name': 'DaisyUI Theme Border Radii',
|
|
103
|
+
'verbose_name_plural': 'DaisyUI Theme Border Radii',
|
|
104
|
+
},
|
|
105
|
+
),
|
|
106
|
+
migrations.CreateModel(
|
|
107
|
+
name='DaisyUIThemeSizes',
|
|
108
|
+
fields=[
|
|
109
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
110
|
+
('field', wagtail_daisIE.models.DaisyUISizeField(default='0.25rem', help_text='For button, input, select, tab UI', verbose_name='Field base size')),
|
|
111
|
+
('selector', wagtail_daisIE.models.DaisyUISizeField(default='0.25rem', help_text='For checkbox, toggle, badge UI', verbose_name='Selector base size')),
|
|
112
|
+
('border', wagtail_daisIE.models.DaisyUISizeField(default='1px', help_text='For all elements', verbose_name='Border width')),
|
|
113
|
+
('theme', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='sizes', to='wagtail_daisIE.daisyuitheme', unique=True)),
|
|
114
|
+
],
|
|
115
|
+
options={
|
|
116
|
+
'verbose_name': 'DaisyUI Theme Sizes',
|
|
117
|
+
'verbose_name_plural': 'DaisyUI Theme Sizes',
|
|
118
|
+
},
|
|
119
|
+
),
|
|
120
|
+
migrations.AddConstraint(
|
|
121
|
+
model_name='daisyuitheme',
|
|
122
|
+
constraint=models.UniqueConstraint(condition=models.Q(('default', True)), fields=('default',), name='wagtail_daisIE.unique_default_theme'),
|
|
123
|
+
),
|
|
124
|
+
migrations.AddConstraint(
|
|
125
|
+
model_name='daisyuitheme',
|
|
126
|
+
constraint=models.UniqueConstraint(condition=models.Q(('prefers_dark', True)), fields=('prefers_dark',), name='wagtail_daisIE.unique_default_dark_theme'),
|
|
127
|
+
),
|
|
128
|
+
]
|
|
File without changes
|