Commit graph

99 commits

Author SHA1 Message Date
Juro Oravec
04f79a6e6b
refactor: deprecate Component.input and add raw_args, raw_kwargs, raw_slots (#1233)
* refactor: deprecate Component.input and add raw_args, raw_kwargs, raw_slots

* docs: update changelog
2025-06-04 23:38:50 +02:00
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
46e524e37d
refactor: Add Node metadata (#1229)
* refactor: `Slot.source` replaced with `Slot.fill_node`, new `Component.node` property, and `slot_node` available in `on_slot_rendered()` hook.

* refactor: fix windows path error in tests
2025-06-03 12:58:48 +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
f069255b64
refactor: simplify slot API (#1202)
Closes #1096
2025-05-20 09:48:45 +02:00
Juro Oravec
0d05ef4cb2
feat: Expose slot input as Slot.contents (#1180)
* feat: expose slot input as Slot.contents

* refactor: fix linter errors
2025-05-14 11:17:09 +02:00
Juro Oravec
6253042e9e
refactor: remove middleware, add strategy "raw", and call render_deps() from within Template.render() (#1166)
* refactor: remove middleware, add strategy "raw", and call render_deps() from within Template.render()

* refactor: fix formatting

* refactor: fix benchmark tests

* refactor: avoid processing deps if rendered HTML contains no components

* refactor: remove comments

* refactor: rename "raw" to "ignore"
2025-05-06 21:36:41 +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
c69980493d
feat: allow to set query and fragment on get_component_url (#1160) 2025-05-03 10:29:38 +02:00
Juro Oravec
b49002b545
refactor: change component typing from generics to class attributes (#1138) 2025-04-20 22:05:29 +02:00
Juro Oravec
c650e7f3a5
refactor: prefix component ID with c (#1127) 2025-04-14 12:01:16 +02:00
Juro Oravec
06cad2ec64
refactor: use typevar defaults + raise on conflicting extensions (#1125)
* refactor: use typevar defaults + raise on conflicting extensions

* refactor: fix linter errors
2025-04-14 10:00:18 +02:00
Juro Oravec
613dfea379
refactor: cleanup docs, add docs on Render API, allow get_context_data return None (#1110)
* refactor: cleanup docs, add docs on Render API, allow get_context_data return None

* refactor: fix linter and tests
2025-04-09 15:06:14 +02:00
Juro Oravec
bb5de86b69
feat: expose _class_hash as class_id (#1094)
* feat: expose _class_hash as class_id

* refactor: fix linting
2025-04-07 11:08:02 +02:00
Juro Oravec
a49f5e51dd
feat: component URL (#1088)
* feat: allow to set defaults

* refactor: remove input validation and link to it

* feat: component URL

* refactor: fix linter errors

* refactor: fix linter errors + update examples to use Component.View..get

* docs: update comment

* refactor: revert change to hash_comp_cls

* docs: update comment
2025-04-07 10:44:41 +02:00
Juro Oravec
7e74831599
refactor: remove input validation and link to it (#1082)
* feat: allow to set defaults

* refactor: remove input validation and link to it

* docs: update changelog

* Update typing_and_validation.md

* Update typing_and_validation.md
2025-04-05 08:19:19 +02:00
Juro Oravec
f07818fc7d
feat: allow to set defaults (#1072)
* feat: allow to set defaults

* docs: update changelog

* refactor: fix new linter errors
2025-03-31 10:38:41 +02:00
Juro Oravec
107284f474
feat: registry.has(); helpers to get all components and registries; access component from ext class (#1030)
* feat: registry.has(); helpers to get all components and registries; access component from ext class

* refactor: add missing import
2025-03-18 11:30:53 +01: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
Juro Oravec
f36581ed86
feat: benchmarking (#999)
* feat: add benchmarking dashboard, CI hook on PR, and store lifetime results

* refactor: change python env to 3.13 in benchmarks

* refactor: add verbosity, use 3.11 for benchmarking

* fix: OSError: [Errno 7] Argument list too long

* refactor: add debug statements

* refactor: remove extraneous -e

* refactor: fix tests and linter errors

* fix: track main package in coverage

* refactor: fix test coverage testing

* refactor: fix repo owner name in benchmark on pushing comment

* refactor: add asv monkeypatch to docs workflow

* refactor: temporarily allow building docs in forks

* refactor: use py 3.13 for benchmarking

* refactor: run only a single benchmark for PRs to speed them up

* refactor: install asv in the docs build workflow

* refactor: use hatch docs env to generate benhcmarks in docs CI

* refactor: more trying

* refactor: move tests

* Add benchmark results for 0.137

* Trigger Build

* Add benchmark results for 0.138

* refactor: set constant machine name when benchmarking

* Add benchmark results for 0.139

* refactor: fix issue with paths too long

* Add benchmark results for 0.140

* docs: update comment

* refactor: remove test benchmarking data

* refactor: fix comment

* refactor: allow the benchmark workflow to write to PRs

* refactor: use personal access token to set up the PR benchmark bot

* refactor: split the benchmark PR flow into two to make it work with PRs from forks

* refactor: update deprecated actions/upload-artifact@v3 to v4

* refactor: fix missing directory in benchmarking workflow

* refactor: fix triggering of second workflow

* refactor: fix workflow finally?

* docs: add comments to cut-offs and direct people to benchmarks PR

---------

Co-authored-by: github-actions <github-actions@github.com>
2025-02-23 16:18:57 +01:00
Juro Oravec
96f48bc013
refactor: fix on_render_after hook (#941) 2025-02-01 17:39:56 +01:00
Juro Oravec
588053803d
refactor: fix component recursion (#936) 2025-02-01 17:19:21 +01:00
Juro Oravec
92f5497c74
refactor: change repo name and URL after org migration (#924) 2025-01-22 16:02:46 +01:00
Juro Oravec
d94a459c8d
refactor: rename template_name to template_file (#878)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-01 17:06:14 +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
Laurence Hole
dfd4187192
Adding request arg to render (#817)
Co-authored-by: Laurence Hole <laurence@safi.co>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-10 13:28:34 +01:00
Juro Oravec
dd6d668b5e
fix: do not render slot tag when extracting fill tags (#786)
* fix: do not render slot tag when extracting fill tags

* refactor: show component path in error message

* docs: update changelog

* refactor: fix tests
2024-11-27 17:19:41 +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
841dd77e91
refactor: Fix template caching, expose cached_template, Component.template API changes (#647)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-06 22:40:39 +02: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
2d0f270df4
fix: populate RequestContext with context processors (#643) 2024-09-04 21:31:44 +02:00
Juro Oravec
0cfc40231b
feat: add component hooks (#631) 2024-08-31 13:38:28 +02:00
Juro Oravec
4a9cf7e26d
feat: validate component inputs if types are given (#629)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-29 23:09:36 +02:00
Juro Oravec
efd05d6150
feat: Typing for component inputs and access inputs during render (#585) 2024-08-22 23:42:34 +02:00
Juro Oravec
b8e92dac37
fix: Set Context.template for components to work with include (#582) 2024-08-16 23:31:00 +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
pre-commit-ci[bot]
49c4e84f07 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-06-11 19:43:02 +00:00
Juro Oravec
36cd6e3f06 refactor: compat with comp as view by reusing comp instance 2024-06-11 21:41:56 +02:00
Juro Oravec
5c89d4dbeb refactor: pass slot data and slot default to slot render fn and rename LazySlot to SlotRef 2024-06-11 14:34:04 +02:00
Juro Oravec
40f4476993 refactor: add test for response_class 2024-06-02 16:37:22 +02:00
pre-commit-ci[bot]
a5a0c74d31 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-06-02 14:23:56 +00:00
Juro Oravec
5f07f3d4da refactor: update tests 2024-06-02 16:22:49 +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
Juro Oravec
610475353f
feat: Support for HTML attributes and html_attrs tag (#491) 2024-05-12 11:21:34 +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