Repository navigation
feat(vue): pass Vue data to a fill with <c-slot :row> and <c-fill v-slot> - #445
Merged
Merged
Conversation
…lot>
A component can now pass browser data to the content a caller puts in its
slot. <c-slot name="item" :row="row" /> writes the prop on the Vue <slot>
Citry generates for the slot, and <c-fill name="item" v-slot="{ row }">
reads it in the fill's slot function, after the names extensions add.
Python slot data keeps working beside it.
The parser accepts :row and v-bind:row with a fixed name, and one object
pattern or one name in v-slot. It rejects every other form with a hint,
name clashes, the slot's own name and key, c- and reserved names, and, in
a pattern, comments, text around the parameter, '&', computed keys,
non-literal defaults and a top-level key, all of which Citry could not
merge or Vue would read from the wrong scope.
At render, Python data cannot add either form through c-bind, and c-bind
names that clash with them fail. A component that copies its slot content
in place refuses a scoped fill, as does a Python Slot that would call one
at an outlet with props. A fill holding Citry components now fails at
render when the <c-slot> it reaches, directly or through a middle
component, sits inside a Vue v-for; the page used to fail in the browser.
Vue's key for Citry's v-if is bound away from props objects and rests.
Cached renders store the props and pattern and parse them on read, and
citry check compiles them and reports scoped fills copied in place.
Part of #168.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 27, 2026
JuroOravec
added a commit
that referenced
this pull request
Nov 1, 2026
…556) Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
A component can now pass browser data to the content a caller puts in its slot (a Vue scoped slot):
Citry writes
:rowon the Vue<slot>element it generates for the slot in List's compiled template, and thev-slotpattern on the fill's slot function in the caller's template, after the names extensions add (for i18n,$citryI18nBinding, $i18n). Python slot data (c-item,data="...") keeps working beside it.This is the first of two PRs for #168; the Rust server renderer change follows. Until it lands, on a page that uses Vue the server leaves a
v-slotfill's place empty, and Vue builds the contents of the element around the component tag in the browser. With no element around the tag, Vue builds the whole page.Rules
citry_template_parser, no grammar, AST or compiler-output change). It accepts:rowandv-bind:row(v-bindin lowercase) with a fixed name and no modifiers, and one object pattern or one name inv-slot. It rejects:nameandkey, and names starting withc-,$,_orcitry;v-slotname and the fill'sdataorfallback;$,_orcitrynames inv-slot, and{{ ... }}in a prop or a pattern;&, computed keys, non-literal defaults, and a top-levelkey.c-bind, andc-bindnames that clash with them fail.<c-provide>,<c-cache>,<c-element>,transparent = True) fails on a scoped fill passed to it, and on:props on its own<c-slot>. So does a PythonSlotthat would call a scoped fill at an outlet with props.<c-slot>it reaches, directly or through a middle component, sits inside a Vuev-for. That page used to fail in the browser once the list held more than one item.CTabs) forwards the whole props object. ThekeyVue passes for Citry'sv-ifaround each slot is bound to a reserved name, so a props object or...restnever sees it.citry check. It compiles props and patterns, and reports a scoped fill passed to a component that copies it in place.Left for later, on purpose
v-slot.citry checkdoes not flag<c-slot :row>inside a component that is itselftransparent = True. Every render of it fails with a clear error.v-slotname equal to an enclosing<c-for>variable is not flagged: Vue expressions in the fill read the slot prop, and Python expressions read the loop variable.fallbackhandle compiles the receiving component's fallback into the caller's template, so Vue names in that fallback read the caller's data (oftenundefined).:rowandv-slotalone reach nothing, and any fill that reads av-slotname uses Vue syntax, which turns Vue on.Tests
test_vue_slot_props.pycovers outlets, patterns with and without context names, forwarding, cache round trips and tampered entries, the Events producer, each refusal above, and thev-forcheck including the middle-component case. There are also newcitry checktests intest_vue_compile_lint.py.test_vue_slot_props_e2e.py.Part of #168.
🤖 Generated with Claude Code