django-lucide 1.2.0__py3-none-any.whl

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.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-lucide
3
+ Version: 1.2.0
4
+ Summary: Use lucide in your Django and Jinja templates.
5
+ Author-email: Francisco Macedo <me@fmacedo.com>
6
+ License: MIT
7
+ Project-URL: Changelog, https://github.com/franciscobmacedo/lucide/blob/main/CHANGELOG.md
8
+ Project-URL: Funding, https://ko-fi.com/fmacedo
9
+ Project-URL: Repository, https://github.com/franciscobmacedo/lucide
10
+ Keywords: Django
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Framework :: Django :: 3.2
13
+ Classifier: Framework :: Django :: 4.0
14
+ Classifier: Framework :: Django :: 4.1
15
+ Classifier: Framework :: Django :: 4.2
16
+ Classifier: Framework :: Django :: 5.0
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Natural Language :: English
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.8
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: Implementation :: CPython
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.8
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Provides-Extra: django
33
+ Requires-Dist: django>=2.2; extra == "django"
34
+ Provides-Extra: jinja
35
+ Requires-Dist: jinja2>=2.8; extra == "jinja"
36
+ Dynamic: license-file
37
+
38
+ # lucide
39
+
40
+ Use [Lucide icons](https://lucide.dev/) in your Django and Jinja templates.
41
+
42
+ > **Fork of [franciscobmacedo/lucide](https://github.com/franciscobmacedo/lucide)** with additional features:
43
+ > - Dynamic template attribute rendering (use `{{ variables }}` in attributes)
44
+ > - Icon alias support with deprecation warnings (246 aliases)
45
+ > - Automatic icon updates via GitHub Actions
46
+
47
+ ## Requirements
48
+
49
+ Python 3.8 to 3.12 supported.
50
+
51
+ Django 3.2 to 5.0 supported.
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ pip install django-lucide
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ The `lucide` package supports both Django templates and Jinja templates.
62
+
63
+ ### Django templates
64
+
65
+ 1. Add to your `INSTALLED_APPS`:
66
+
67
+ ```python
68
+ INSTALLED_APPS = [
69
+ ...,
70
+ "lucide",
71
+ ...,
72
+ ]
73
+ ```
74
+
75
+ 2. Load the template library:
76
+
77
+ ```django
78
+ {% load lucide %}
79
+ ```
80
+
81
+ 3. Use icons:
82
+
83
+ ```django
84
+ {% lucide "arrow-down" %}
85
+ {% lucide "arrow-down" size=40 class="mr-4" %}
86
+ {% lucide "arrow-down" stroke_width=1 data_controller="icon" %}
87
+ ```
88
+
89
+ #### Dynamic attributes
90
+
91
+ You can use template variables in attributes:
92
+
93
+ ```django
94
+ {% lucide "user" class="{{ css_class }}" data-id="{{ user.id }}" %}
95
+ ```
96
+
97
+ #### Icon aliases
98
+
99
+ Old icon names automatically resolve to new names with a deprecation warning:
100
+
101
+ ```django
102
+ {% lucide "edit-2" %} {# Works, but warns to use "pen" instead #}
103
+ ```
104
+
105
+ ### Jinja templates
106
+
107
+ 1. Add the global function to your environment:
108
+
109
+ ```python
110
+ from lucide.jinja import lucide
111
+ from jinja2 import Environment
112
+
113
+ env = Environment()
114
+ env.globals.update({"lucide": lucide})
115
+ ```
116
+
117
+ 2. Use icons:
118
+
119
+ ```jinja
120
+ {{ lucide("arrow-down") }}
121
+ {{ lucide("arrow-down", size=40, class="mr-4") }}
122
+ ```
123
+
124
+ ## Icon reference
125
+
126
+ Browse all available icons at [lucide.dev/icons](https://lucide.dev/icons/).
127
+
128
+ ## Acknowledgements
129
+
130
+ - Original package by [franciscobmacedo](https://github.com/franciscobmacedo/lucide)
131
+ - Inspired by [Adam Johnson's heroicons](https://github.com/adamchainz/heroicons)
@@ -0,0 +1,13 @@
1
+ django_lucide-1.2.0.dist-info/licenses/LICENSE,sha256=giQ34SCBLlgHTV4u1GYERElJLV-y_59xNDf95rNkhKA,2039
2
+ lucide/__init__.py,sha256=ujIrBOkMJ7Uxtos5XymkWJ6fJ2UeRCLp4yIKmcp1XHU,3249
3
+ lucide/_compat.py,sha256=9CsDL4Gwi7v7ESDAEZV2iWurecfChHQVjk56MqxzF4E,778
4
+ lucide/aliases.json,sha256=fqNfivlisrRW41vhuBN5n_xifeB770EpP2g2_yq18Jg,9156
5
+ lucide/jinja.py,sha256=Yach1qdVEnR0jMOIqdFWBxdE-61pOE5vyLOlIE0a8lI,350
6
+ lucide/lucide.zip,sha256=boOujNArFYrIxwcaM2ubNU_TXlxx4EZWxVM702_2MlY,625790
7
+ lucide/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ lucide/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ lucide/templatetags/lucide.py,sha256=SXiLPaDFj_hcm9qUNkMGAuo0JEyFyETcj7g4vELrRTo,1967
10
+ django_lucide-1.2.0.dist-info/METADATA,sha256=z53Kq3WeYS7b5WSg68O6soEf2qYQCMUT-CWJiAjRnR4,3476
11
+ django_lucide-1.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ django_lucide-1.2.0.dist-info/top_level.txt,sha256=kB-N0BjFblvzHlNhWT73sXeCYCWbbhuvfRMaEoVYECM,7
13
+ django_lucide-1.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,39 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Adam Johnson
4
+ Copyright (c) 2024 Francisco Macedo
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
24
+
25
+ The contained Lucide zip file is distributed under MIT License:
26
+
27
+ Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
28
+
29
+ Permission to use, copy, modify, and/or distribute this software for any
30
+ purpose with or without fee is hereby granted, provided that the above
31
+ copyright notice and this permission notice appear in all copies.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
34
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
35
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
36
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
37
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
38
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
39
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1 @@
1
+ lucide
lucide/__init__.py ADDED
@@ -0,0 +1,108 @@
1
+ from __future__ import annotations
2
+
3
+ import functools
4
+ import json
5
+ import warnings
6
+ from contextlib import closing
7
+ from copy import deepcopy
8
+ from xml.etree import ElementTree
9
+ from zipfile import ZipFile
10
+
11
+ from lucide._compat import open_binary
12
+ from lucide._compat import open_text
13
+ from lucide._compat import str_removeprefix
14
+
15
+
16
+ class IconDoesNotExist(Exception):
17
+ pass
18
+
19
+
20
+ @functools.lru_cache(maxsize=1)
21
+ def _load_aliases() -> dict[str, str]:
22
+ """Load alias mappings from aliases.json."""
23
+ try:
24
+ aliases_data = open_text("lucide", "aliases.json")
25
+ with closing(aliases_data):
26
+ return json.load(aliases_data)
27
+ except FileNotFoundError:
28
+ return {}
29
+
30
+
31
+ def _resolve_icon_name(name: str) -> tuple[str, bool]:
32
+ """
33
+ Resolve icon name, checking aliases if needed.
34
+ Returns (resolved_name, was_alias).
35
+ """
36
+ aliases = _load_aliases()
37
+ if name in aliases:
38
+ return aliases[name], True
39
+ return name, False
40
+
41
+
42
+ @functools.lru_cache(maxsize=128)
43
+ def _load_icon_svg(name: str) -> ElementTree.Element:
44
+ """Load icon SVG by exact name (no alias resolution)."""
45
+ zip_data = open_binary("lucide", "lucide.zip")
46
+ with closing(zip_data), ZipFile(zip_data, "r") as zip_file:
47
+ try:
48
+ svg_bytes = zip_file.read(f"{name}.svg")
49
+ except KeyError:
50
+ raise IconDoesNotExist(f"The icon {name!r} does not exist.")
51
+
52
+ svg = ElementTree.fromstring(svg_bytes.decode())
53
+ for node in svg.iter():
54
+ # Prevent output using the 'ns0' prefix for tags
55
+ node.tag = ElementTree.QName(
56
+ str_removeprefix(node.tag, "{http://www.w3.org/2000/svg}")
57
+ ) # type: ignore[assignment] # unclear if really allowed
58
+ return svg
59
+
60
+
61
+ def _load_icon(name: str) -> ElementTree.Element:
62
+ """Load icon by name, resolving aliases with deprecation warning."""
63
+ try:
64
+ return _load_icon_svg(name)
65
+ except IconDoesNotExist:
66
+ # Try alias resolution
67
+ resolved_name, was_alias = _resolve_icon_name(name)
68
+ if was_alias:
69
+ warnings.warn(
70
+ f"Icon '{name}' is deprecated, use '{resolved_name}' instead.",
71
+ DeprecationWarning,
72
+ stacklevel=4, # Point to the template/caller
73
+ )
74
+ return _load_icon_svg(resolved_name)
75
+ raise
76
+
77
+
78
+ _PATH_ATTR_NAMES = frozenset(
79
+ {
80
+ "stroke-linecap",
81
+ "stroke-linejoin",
82
+ "vector-effect",
83
+ }
84
+ )
85
+
86
+
87
+ def _render_icon(name: str, size: int | None, **kwargs: object) -> str:
88
+ svg = deepcopy(_load_icon(name))
89
+ if size is not None:
90
+ svg.attrib["width"] = svg.attrib["height"] = str(size)
91
+
92
+ svg_attrs = {}
93
+ path_attrs = {}
94
+ for raw_name, value in kwargs.items():
95
+ attr_name = raw_name.replace("_", "-")
96
+ if attr_name in _PATH_ATTR_NAMES:
97
+ path_attrs[attr_name] = str(value)
98
+ else:
99
+ svg_attrs[attr_name] = str(value)
100
+
101
+ svg.attrib.update(svg_attrs)
102
+ if path_attrs:
103
+ for path in svg.findall("path"):
104
+ path.attrib.update(path_attrs)
105
+
106
+ string = ElementTree.tostring(svg, encoding="unicode")
107
+ # Inline SVG's don't need xmlns
108
+ return string.replace(' xmlns="http://www.w3.org/2000/svg"', "", 1)
lucide/_compat.py ADDED
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ from typing import IO
5
+
6
+ if sys.version_info < (3, 9):
7
+
8
+ def str_removeprefix(self: str, prefix: str) -> str:
9
+ if self.startswith(prefix):
10
+ return self[len(prefix) :]
11
+ else: # pragma: no cover
12
+ return self[:]
13
+
14
+ else:
15
+ str_removeprefix = str.removeprefix
16
+
17
+
18
+ if sys.version_info >= (3, 9):
19
+ from importlib.resources import files
20
+
21
+ def open_binary(pkg: str, filename: str) -> IO[bytes]:
22
+ return (files(pkg) / filename).open("rb")
23
+
24
+ def open_text(pkg: str, filename: str) -> IO[str]:
25
+ return (files(pkg) / filename).open("r", encoding="utf-8")
26
+
27
+ else:
28
+ from importlib.resources import open_binary # noqa: F401
29
+ from importlib.resources import open_text # noqa: F401
lucide/aliases.json ADDED
@@ -0,0 +1,248 @@
1
+ {
2
+ "activity-square": "square-activity",
3
+ "alarm-check": "alarm-clock-check",
4
+ "alarm-minus": "alarm-clock-minus",
5
+ "alarm-plus": "alarm-clock-plus",
6
+ "alert-circle": "circle-alert",
7
+ "alert-octagon": "octagon-alert",
8
+ "alert-triangle": "triangle-alert",
9
+ "align-center": "text-align-center",
10
+ "align-justify": "text-align-justify",
11
+ "align-left": "text-align-start",
12
+ "align-right": "text-align-end",
13
+ "area-chart": "chart-area",
14
+ "arrow-down-01": "arrow-down-0-1",
15
+ "arrow-down-10": "arrow-down-1-0",
16
+ "arrow-down-az": "arrow-down-a-z",
17
+ "arrow-down-circle": "circle-arrow-down",
18
+ "arrow-down-left-from-circle": "circle-arrow-out-down-left",
19
+ "arrow-down-left-from-square": "square-arrow-out-down-left",
20
+ "arrow-down-left-square": "square-arrow-down-left",
21
+ "arrow-down-right-from-circle": "circle-arrow-out-down-right",
22
+ "arrow-down-right-from-square": "square-arrow-out-down-right",
23
+ "arrow-down-right-square": "square-arrow-down-right",
24
+ "arrow-down-square": "square-arrow-down",
25
+ "arrow-down-za": "arrow-down-z-a",
26
+ "arrow-left-circle": "circle-arrow-left",
27
+ "arrow-left-square": "square-arrow-left",
28
+ "arrow-right-circle": "circle-arrow-right",
29
+ "arrow-right-square": "square-arrow-right",
30
+ "arrow-up-01": "arrow-up-0-1",
31
+ "arrow-up-10": "arrow-up-1-0",
32
+ "arrow-up-az": "arrow-up-a-z",
33
+ "arrow-up-circle": "circle-arrow-up",
34
+ "arrow-up-left-from-circle": "circle-arrow-out-up-left",
35
+ "arrow-up-left-from-square": "square-arrow-out-up-left",
36
+ "arrow-up-left-square": "square-arrow-up-left",
37
+ "arrow-up-right-from-circle": "circle-arrow-out-up-right",
38
+ "arrow-up-right-from-square": "square-arrow-out-up-right",
39
+ "arrow-up-right-square": "square-arrow-up-right",
40
+ "arrow-up-square": "square-arrow-up",
41
+ "arrow-up-za": "arrow-up-z-a",
42
+ "asterisk-square": "square-asterisk",
43
+ "axis-3-d": "axis-3d",
44
+ "badge-help": "badge-question-mark",
45
+ "bar-chart": "chart-no-axes-column-increasing",
46
+ "bar-chart-2": "chart-no-axes-column",
47
+ "bar-chart-3": "chart-column",
48
+ "bar-chart-4": "chart-column-increasing",
49
+ "bar-chart-big": "chart-column-big",
50
+ "bar-chart-horizontal": "chart-bar",
51
+ "bar-chart-horizontal-big": "chart-bar-big",
52
+ "between-horizonal-end": "between-horizontal-end",
53
+ "between-horizonal-start": "between-horizontal-start",
54
+ "book-template": "book-dashed",
55
+ "box-select": "square-dashed",
56
+ "candlestick-chart": "chart-candlestick",
57
+ "check-circle": "circle-check-big",
58
+ "check-circle-2": "circle-check",
59
+ "check-square": "square-check-big",
60
+ "check-square-2": "square-check",
61
+ "chevron-down-circle": "circle-chevron-down",
62
+ "chevron-down-square": "square-chevron-down",
63
+ "chevron-left-circle": "circle-chevron-left",
64
+ "chevron-left-square": "square-chevron-left",
65
+ "chevron-right-circle": "circle-chevron-right",
66
+ "chevron-right-square": "square-chevron-right",
67
+ "chevron-up-circle": "circle-chevron-up",
68
+ "chevron-up-square": "square-chevron-up",
69
+ "chrome": "chromium",
70
+ "circle-help": "circle-question-mark",
71
+ "circle-slashed": "circle-slash-2",
72
+ "clipboard-edit": "clipboard-pen",
73
+ "clipboard-signature": "clipboard-pen-line",
74
+ "code-2": "code-xml",
75
+ "code-square": "square-code",
76
+ "columns": "columns-2",
77
+ "columns-settings": "columns-3-cog",
78
+ "contact-2": "contact-round",
79
+ "curly-braces": "braces",
80
+ "divide-circle": "circle-divide",
81
+ "divide-square": "square-divide",
82
+ "dot-square": "square-dot",
83
+ "download-cloud": "cloud-download",
84
+ "edit": "square-pen",
85
+ "edit-2": "pen",
86
+ "edit-3": "pen-line",
87
+ "equal-square": "square-equal",
88
+ "file-audio": "file-headphone",
89
+ "file-audio-2": "file-headphone",
90
+ "file-axis-3-d": "file-axis-3d",
91
+ "file-badge-2": "file-badge",
92
+ "file-bar-chart": "file-chart-column-increasing",
93
+ "file-bar-chart-2": "file-chart-column",
94
+ "file-check-2": "file-check-corner",
95
+ "file-code-2": "file-code-corner",
96
+ "file-cog-2": "file-cog",
97
+ "file-edit": "file-pen",
98
+ "file-json": "file-braces",
99
+ "file-json-2": "file-braces-corner",
100
+ "file-key-2": "file-key",
101
+ "file-line-chart": "file-chart-line",
102
+ "file-lock-2": "file-lock",
103
+ "file-minus-2": "file-minus-corner",
104
+ "file-pie-chart": "file-chart-pie",
105
+ "file-plus-2": "file-plus-corner",
106
+ "file-question": "file-question-mark",
107
+ "file-search-2": "file-search-corner",
108
+ "file-signature": "file-pen-line",
109
+ "file-type-2": "file-type-corner",
110
+ "file-video": "file-play",
111
+ "file-video-2": "file-video-camera",
112
+ "file-volume-2": "file-signal",
113
+ "file-warning": "file-exclamation-point",
114
+ "file-x-2": "file-x-corner",
115
+ "filter": "funnel",
116
+ "filter-x": "funnel-x",
117
+ "fingerprint": "fingerprint-pattern",
118
+ "folder-cog-2": "folder-cog",
119
+ "folder-edit": "folder-pen",
120
+ "fork-knife": "utensils",
121
+ "fork-knife-crossed": "utensils-crossed",
122
+ "form-input": "rectangle-ellipsis",
123
+ "function-square": "square-function",
124
+ "gantt-chart": "chart-no-axes-gantt",
125
+ "gantt-chart-square": "square-chart-gantt",
126
+ "gauge-circle": "circle-gauge",
127
+ "git-commit": "git-commit-horizontal",
128
+ "globe-2": "earth",
129
+ "grab": "hand-grab",
130
+ "grid": "grid-3x3",
131
+ "grid-2-x-2": "grid-2x2",
132
+ "grid-2-x-2-check": "grid-2x2-check",
133
+ "grid-2-x-2-plus": "grid-2x2-plus",
134
+ "grid-2-x-2-x": "grid-2x2-x",
135
+ "grid-3-x-3": "grid-3x3",
136
+ "help-circle": "circle-question-mark",
137
+ "helping-hand": "hand-helping",
138
+ "home": "house",
139
+ "ice-cream": "ice-cream-cone",
140
+ "ice-cream-2": "ice-cream-bowl",
141
+ "indent": "list-indent-increase",
142
+ "indent-decrease": "list-indent-decrease",
143
+ "indent-increase": "list-indent-increase",
144
+ "inspect": "square-mouse-pointer",
145
+ "kanban-square": "square-kanban",
146
+ "kanban-square-dashed": "square-dashed-kanban",
147
+ "laptop-2": "laptop-minimal",
148
+ "layers-3": "layers",
149
+ "layout": "panels-top-left",
150
+ "letter-text": "text-initial",
151
+ "library-square": "square-library",
152
+ "line-chart": "chart-line",
153
+ "loader-2": "loader-circle",
154
+ "location-edit": "map-pin-pen",
155
+ "m-square": "square-m",
156
+ "mail-question": "mail-question-mark",
157
+ "menu-square": "square-menu",
158
+ "message-circle-question": "message-circle-question-mark",
159
+ "mic-2": "mic-vocal",
160
+ "minus-circle": "circle-minus",
161
+ "minus-square": "square-minus",
162
+ "more-horizontal": "ellipsis",
163
+ "more-vertical": "ellipsis-vertical",
164
+ "mouse-pointer-square-dashed": "square-dashed-mouse-pointer",
165
+ "move-3-d": "move-3d",
166
+ "outdent": "list-indent-decrease",
167
+ "paintbrush-2": "paintbrush-vertical",
168
+ "palmtree": "tree-palm",
169
+ "panel-bottom-inactive": "panel-bottom-dashed",
170
+ "panel-left-inactive": "panel-left-dashed",
171
+ "panel-right-inactive": "panel-right-dashed",
172
+ "panel-top-inactive": "panel-top-dashed",
173
+ "panels-left-right": "columns-3",
174
+ "panels-top-bottom": "rows-3",
175
+ "parking-circle": "circle-parking",
176
+ "parking-circle-off": "circle-parking-off",
177
+ "parking-square": "square-parking",
178
+ "parking-square-off": "square-parking-off",
179
+ "pause-circle": "circle-pause",
180
+ "pause-octagon": "octagon-pause",
181
+ "pen-box": "square-pen",
182
+ "pen-square": "square-pen",
183
+ "percent-circle": "circle-percent",
184
+ "percent-diamond": "diamond-percent",
185
+ "percent-square": "square-percent",
186
+ "pi-square": "square-pi",
187
+ "pie-chart": "chart-pie",
188
+ "pilcrow-square": "square-pilcrow",
189
+ "play-circle": "circle-play",
190
+ "play-square": "square-play",
191
+ "plug-zap-2": "plug-zap",
192
+ "plus-circle": "circle-plus",
193
+ "plus-square": "square-plus",
194
+ "power-circle": "circle-power",
195
+ "power-square": "square-power",
196
+ "rotate-3-d": "rotate-3d",
197
+ "rows": "rows-2",
198
+ "scale-3-d": "scale-3d",
199
+ "scatter-chart": "chart-scatter",
200
+ "school-2": "university",
201
+ "scissors-square": "square-scissors",
202
+ "scissors-square-dashed-bottom": "square-bottom-dashed-scissors",
203
+ "send-horizonal": "send-horizontal",
204
+ "shield-close": "shield-x",
205
+ "shield-question": "shield-question-mark",
206
+ "sidebar": "panel-left",
207
+ "sidebar-close": "panel-left-close",
208
+ "sidebar-open": "panel-left-open",
209
+ "sigma-square": "square-sigma",
210
+ "slash-square": "square-slash",
211
+ "sliders": "sliders-vertical",
212
+ "sort-asc": "arrow-up-narrow-wide",
213
+ "sort-desc": "arrow-down-wide-narrow",
214
+ "split-square-horizontal": "square-split-horizontal",
215
+ "split-square-vertical": "square-split-vertical",
216
+ "square-gantt-chart": "square-chart-gantt",
217
+ "stars": "sparkles",
218
+ "stop-circle": "circle-stop",
219
+ "subtitles": "captions",
220
+ "table-config": "columns-3-cog",
221
+ "terminal-square": "square-terminal",
222
+ "test-tube-2": "test-tube-diagonal",
223
+ "text": "text-align-start",
224
+ "text-selection": "text-select",
225
+ "train": "tram-front",
226
+ "tv-2": "tv-minimal",
227
+ "unlock": "lock-open",
228
+ "unlock-keyhole": "lock-keyhole-open",
229
+ "upload-cloud": "cloud-upload",
230
+ "user-2": "user-round",
231
+ "user-check-2": "user-round-check",
232
+ "user-circle": "circle-user",
233
+ "user-circle-2": "circle-user-round",
234
+ "user-cog-2": "user-round-cog",
235
+ "user-minus-2": "user-round-minus",
236
+ "user-plus-2": "user-round-plus",
237
+ "user-square": "square-user",
238
+ "user-square-2": "square-user-round",
239
+ "user-x-2": "user-round-x",
240
+ "users-2": "users-round",
241
+ "verified": "badge-check",
242
+ "wallet-2": "wallet-minimal",
243
+ "wand-2": "wand-sparkles",
244
+ "wrap-text": "text-wrap",
245
+ "x-circle": "circle-x",
246
+ "x-octagon": "octagon-x",
247
+ "x-square": "square-x"
248
+ }
lucide/jinja.py ADDED
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+
3
+ from markupsafe import Markup
4
+
5
+ import lucide as _lucide
6
+
7
+
8
+ def lucide(name: str, *, size: int | None = 24, **kwargs: object) -> str:
9
+ return _render_icon(name, size, **kwargs)
10
+
11
+
12
+ def _render_icon(name: str, size: int | None, **kwargs: object) -> str:
13
+ return Markup(_lucide._render_icon(name, size, **kwargs))
lucide/lucide.zip ADDED
Binary file
lucide/py.typed ADDED
File without changes
File without changes
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ from django import template
4
+ from django.template import Context, Template, TemplateSyntaxError
5
+ from django.utils.safestring import SafeString, mark_safe
6
+
7
+ import lucide as _lucide
8
+
9
+ register = template.Library()
10
+
11
+
12
+ @register.simple_tag(takes_context=True) # Added takes_context=True
13
+ def lucide(context: Context, name: str, *, size: int | None = 24, **kwargs: object) -> str:
14
+ return _render_icon(context, name, size, **kwargs) # Pass context
15
+
16
+
17
+ def _render_icon(context: Context, name: str, size: int | None, **kwargs: object) -> str:
18
+ processed_kwargs = {}
19
+ for key, value in kwargs.items():
20
+ # Original SafeString to str conversion logic
21
+ value_to_process = value + "" if isinstance(value, SafeString) else value
22
+
23
+ if isinstance(value_to_process, str) and \
24
+ ("{" in value_to_process and ("{{" in value_to_process or "{%" in value_to_process)):
25
+ # If the string value appears to contain Django template syntax,
26
+ # try to render it using the current template context.
27
+ try:
28
+ # Create a Template object from the attribute value and render it
29
+ attr_template = Template(value_to_process)
30
+ processed_kwargs[key] = attr_template.render(context)
31
+ except TemplateSyntaxError:
32
+ # In case of a syntax error within the attribute's template string,
33
+ # fall back to using the original (un-rendered) string.
34
+ # This prevents breaking templates with unintentional or malformed template syntax in attributes.
35
+ processed_kwargs[key] = value_to_process
36
+ else:
37
+ # Value is not a string or does not appear to contain template syntax.
38
+ # Use it as is (after SafeString conversion if applicable).
39
+ processed_kwargs[key] = value_to_process
40
+
41
+ return mark_safe(_lucide._render_icon(name, size, **processed_kwargs))