Commit graph

43 commits

Author SHA1 Message Date
Juro Oravec
eceebb9696
feat: on_render (#1231)
* feat: on_render

* docs: fix typos

* refactor: fix linter errors

* refactor: make `error` in on_render_after optional to fix benchmarks

* refactor: benchmark attempt 2

* refactor: fix linter errors

* refactor: fix formatting
2025-06-04 19:30:03 +02:00
Juro Oravec
8677ee7941
refactor: deprecate template caching, get_template_name, get_template, assoc template with Comp cls (#1222)
* refactor: deprecate template caching, get_template_name, get_template, assoc template with Comp cls

* refactor: change implementation

* refactor: handle cached template loader

* refactor: fix tests

* refactor: fix test on windows

* refactor: try to  fix type errors

* refactor: Re-cast `context` to fix type errors

* refactor: fix linter error

* refactor: fix typing

* refactor: more linter fixes

* refactor: more linter errors

* refactor: revert extra node metadata
2025-06-01 19:20:22 +02:00
Juro Oravec
bae0f28813
refactor: Instantiate component when rendering, and remove metadata stack (#1212)
* refactor: Instantiate component when rendering, and remove metadata stack

* refactor: update test

* refactor: fix linter errors

* docs: remove example from changelog
2025-05-25 23:33:38 +02:00
Juro Oravec
e054a68715
feat: Component.args/kwargs/slots and {{ component_vars.args/kwargs/s… (#1205)
* feat: Component.args/kwargs/slots and {{ component_vars.args/kwargs/slots }}

* docs: fix typo in changelog
2025-05-24 23:24:34 +02:00
Juro Oravec
ccf02fa316
chore: util to manage URLs in the codebase (#1179)
* chore: util to manage URLs in the codebase

* docs: mentiion validate_links and supported_versions in docs

* refactor: fix linter errors
2025-05-11 14:59:34 +02:00
Juro Oravec
2dacac1f43
temp (#1172) 2025-05-06 21:48:18 +02:00
Juro Oravec
28b61c1609
refactor: Update docs and tests to use get_template_data() (#1161)
* refactor: update docs and tests to use get_template_data()

* refactor: fix linting

* docs: add note about difference between the two methods
2025-05-03 12:04:10 +02:00
Juro Oravec
59f82307ae
docs: docstrings, fundamentals, and minor changes (#1145)
* docs: docstrings, fundamentals, and minor changes

* refactor: fix tests + linter errors
2025-04-24 12:47:04 +02:00
Juro Oravec
c650e7f3a5
refactor: prefix component ID with c (#1127) 2025-04-14 12:01:16 +02:00
Juro Oravec
7dfcb447c4
feat: add decorator for writing component tests (#1008)
* feat: add decorator for writing component tests

* refactor: udpate changelog + update deps pins

* refactor: fix deps

* refactor: make cached_ref into generic and fix linter errors

* refactor: fix coverage testing

* refactor: use global var instead of env var for is_testing state
2025-03-02 19:46:12 +01:00
lilian D
8b5579d2be
feat:forward context processors variables in context in ISOLATED mode (#975)
* feat:forward context processors variables in context in ISOLATED mode

	provide context_processors_data property to Component to access those variables in Component

* refactor: internalize RequestContext and pass HttpRequest internally

* docs: document HttpRequest and context processors

---------

Co-authored-by: Juro Oravec <juraj.oravec.josefson@gmail.com>
2025-02-20 11:06:49 +01:00
Juro Oravec
588053803d
refactor: fix component recursion (#936) 2025-02-01 17:19:21 +01:00
Juro Oravec
81c02ddaa7
refactor: use HTML5 parser for BeautifulSoup (#891)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-07 21:27:17 +01:00
Juro Oravec
fe67d90547
refactor: Backbone for passing JS and CSS variables (#861)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-28 19:27:19 +01:00
Juro Oravec
5fd45ab424
chore: Push dev to master to release v0.110 (#767)
* feat: skeleton of dependency manager backend (#688)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: selectolax update and tests cleanup (#702)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: move release notes to own file (#704)

* chore: merge changes from master (#705)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yassin Rakha <yaso2go@gmail.com>
Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
fix for nested slots (#698) (#699)

* refactor: remove joint {% component_dependencies %} tag (#706)

Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: split up utils file and move utils to util dir (#707)

* docs: Move docs inside src/ to allow imports in python scripts (#708)

* refactor: Docs prep 1 (#715)

* refactor: Document template tags (#716)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: pass slot fills in template via slots param (#719)

* chore: Merge master to dev (#729)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yassin Rakha <yaso2go@gmail.com>
Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
Co-authored-by: Tom Larsen <larsent@gmail.com>
fix for nested slots (#698) (#699)

* fix: Do not raise error if multiple slots with same name are flagged as default (#727)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: tag formatter - allow fwd slash in end tag (#730)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* refactor: Use lowercase names for registry settings (#731)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: add docstrings (#732)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: define settings as a data class for type hints, intellisense, and docs (#733)

* refactor: fix reload-on-change logic, expose autodiscover's dirs-getting logic, rename settings (#734)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: document settings (#743)

* docs: document settings

* refactor: fix linter errors

* feat: passthrough slots and more (#758)

* feat: passthrough slots and more

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: remove ComponentSlotContext.slots

* refactor: update comment

* docs: update changelog

* refactor: update docstrings

* refactor: document and test-cover more changes

* refactor: revert fill without name

* docs: update README

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix: apostrophes in tags (#765)

* refactor: fix merge error - duplicate code

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
2024-11-25 09:41:57 +01:00
Juro Oravec
e712800f5e
feat: add self context var and make is_filled into attribute (#632)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-04 21:41:20 +02:00
Juro Oravec
71d8679e8d
feat: TagFormatter - Allow users to customize component template tags (#572)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-18 16:58:56 +02:00
Juro Oravec
d6dec450ed
refactor: prepare registry for custom template tags and docs (#566)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-05 22:31:49 +02:00
Juro Oravec
e771a0aaaf
refactor: Use top-level exports as public API (#562)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-03 08:30:39 +02:00
Juro Oravec
8cb88558f0
refactor: Prepare autodiscover and template loader for v1 (#533) 2024-07-29 20:27:35 +02:00
Juro Oravec
95f6554f4c
tests: Split test files and run template tests under both context behavior modes (#509)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-28 08:23:32 +02:00
pre-commit-ci[bot]
04d968ace9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-05-02 20:34:46 +00:00
Juro Oravec
8c4a55901c tests: add inline syntax highlight, inline template files 2024-05-02 22:33:02 +02:00
Juro Oravec
3fc90e4956
feat: merge context settings, replace if_filled tag with var
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-01 20:55:09 +02:00
Juro Oravec
091da26da5
refactor: Tests cleanup and better test isolation (#452)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-25 14:20:33 +02:00
Juro Oravec
eb40afba7b refactor: remove Django30CompatibleTestCase 2024-04-18 13:33:58 +02:00
Juro Oravec
1dd492314a refactor: use component_id instead of Template as slot fill cache key 2024-04-16 23:25:13 +02:00
Juro Oravec
37fd901908
Resolve media and template files relative to component class dir (#395), thanks @JuroOravec
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Emil Stenström <emil@emilstenstrom.se>
2024-03-23 19:01:39 +01:00
Juro Oravec
b14dec9777
Add mypy support (#396), thanks @JuroOravec 2024-03-15 23:31:15 +01:00
Emil Stenström
edf3885632 Replace all instances of component_block with component. Remove duplicate tests. 2024-02-21 22:38:06 +01:00
Emil Stenström
48fe8171b4 Reformat lines that became too long. And enforce 119 line length. 2024-02-21 22:38:06 +01:00
Emil Stenström
ef6a082238 Remove component tag in favour of component_block. 2024-02-21 22:38:06 +01:00
Dylan Castillo
560b721523 Change context behavior setting to enum 2024-01-15 21:58:42 +01:00
Dylan Castillo
4da76c178b Add setting to isolate components' context by default 2024-01-15 21:58:42 +01:00
lemontheme
a8dfcce24e Introduce {% fill %} replacing 'fill' func of 'slot' tag
Partial implementation fill-tags plus update tests

Implement {% fill %} tags. Next: update tests.

Bring back support for {%slot%} blocks for bckwrd-compat and implement ambig. resolution policy

Update tests to use fill blocks. Add extra checks that raise errors

Add new tests for fill-slot nesting

Update README. Editing still required

remove unused var ctxt after flake8 complaint

fix flake8 warning about slotless f-string

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Add new slot aliases in fill context. Clean up rendering logic in Component. Update docs.

fix flake8, isort, black errors

Refactor duplicated name validation

Add if_filled tag + elif_filled...else_filled...endif_filled for cond. slots

Fix mistake in do_if_filled() docstring

Upload templates for tests! D'oh

Incorporate PR feedback

Drop Literal type hint; Use isort off-on instead of skip in tests

Treat all fill,slot,if_filled,component names as variables

Reset sampleproject components

Add test for variable filled name

Update examples in docs
2023-03-14 23:40:21 +01:00
pre-commit-ci[bot]
0648ad9a93 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-09-10 11:12:26 +00:00
Real-Gecko
5fcabaa5ba Renamed get_context to get_context_data 2021-09-10 11:27:55 +02:00
Emil Stenström
5b9188cc9c Refactored Component class
# Conflicts:
#	README.md
#	pyproject.toml
2021-09-10 11:27:28 +02:00
Emil Stenström
57a5aa0f4b
Only render dependencies that are used of a specific page (#52)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-03-24 22:47:48 +01:00
Emil Stenström
26f39c73f3 This is a difference between Django 3.0 and 3.1. 2021-02-15 21:22:07 +01:00
Emil Stenström
07986c5216
Caching templates to allow for dynamic template generation
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-02-15 21:07:14 +01:00
rbeard0330
2633c3f08f
Pass context into component tags by default, and let components disable with "only" (#20)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2021-01-25 12:31:54 +01:00
rbeard0330
93b8a7404a
Rework of context handling (#18)
Co-authored-by: rbeard0330 <@dul2k3BKW6m>
2020-12-28 10:40:35 +01:00