astrimid - Is there some kind of context wrappe...
Is there some kind of context wrapper that would inject props to each component that supports them? E.g. using schSectionName for each component is frustrating. Would be much more ergonomic to use <schSection name="" {/ components /} <schSection As I understand, <schematicsection
Is there some kind of context wrapper that would inject props to each component that supports them? E.g. using `schSectionName` for each component is frustrating. Would be much more ergonomic to use <schSection name="">{/*components*/} <schSection>
As I understand, `<schematicsection name="" />` already exists. But it doesn't support children. So to put a component there, you need to find each component that supports `schSectionName` property and pass down it there. You could also put the whole subcircuit into schematic section as it support `schSectionName`. But you can't create a group of component using `children` property and put it into schSection without any side effects?
M
Mustafa7
yea i think we should support adding children to `schematicsection` just like `schematicsheet`, wdyt <@757706909351411845> ?
Ok. This works for schematic section, but not for shematic sheet. Apparently, you can't put schematic section into a schematic sheet?
A
astrimid
This doesn't work, because changing the section's sheet doesn't change the component's sheet. We end up with a sheet with empty sections, even though the components specify that they belong to sections.
So we can define `schSectionName` for components, and we can place schematic section to the sheet, but components will fall out of schematic section as soon as it is moved into a sheet, because they don't have `schSheetName` defined as prop.
A
astrimid
I guess what I'm still trying to do is to decouple model implementation from presentation, which `tscircuit` doesn't appear to be friendly to.
A
astrimid
It's just too good at reconciliation 😆
A
astrimid
Maybe I should just create my own `<TSCIRCUIT>` wrapper which would traverse the JSX tree and modify it programmatically to solve all the bugs I encounter. 😅
Seve
yea this is a pretty easy one to resolve, first we update the tscircuit/props spec, create a reproduction in tscircuit/core, then PR an implementation fix, should be out today
A
astrimid
What I need to ouput is this: a component which targets schematic sheet and schematic section, a schematic page and a schematic section, one nested in another.
I also need a workaround for `<schematicbox />` which doesn't currently support the `schSectionName`: probably just place it on a page, without a section?
Ideally, I'd like separate nesting of schematic page and sections, so that I could reuse and reorder sections in pages without touching components? But maybe sections have transparent coordinate system, so I wouldn't be able to reposition sections anyway? Or maybe I can go one level deeper and recalculate `schX` and `schY` while I'm at it? So many questions...
I guess something like this could work:
```
import React from "react"
import { SchSection, SchSheet } from "@tsci/astrimid.sch-section-wrapper"
export default () => (
<board width="10mm" height="10mm">
<SchSheet
name="power_delivery"
displayName="Power Delivery"
sheetIndex={0}
sections={[
{ name: "power" },
{ name: "filter" },
]}
/>
<SchSection name="power" sheet="power_delivery">
<capacitor name="C1" capacitance="100uF" footprint="0805" schX={-4} schY={3} />
<capacitor name="C2" capacitance="100nF" footprint="0402" schX={-2} schY={3} />
</SchSection>
<SchSection name="filter" sheet="power_delivery">
<resistor name="R1" resistance="10k" footprint="0402" schX={4} schY={3} />
<capacitor name="C3" capacitance="10nF" footprint="0402" schX={6} schY={3} />
</SchSection>
</board>
)
```
But this way I could only change the order in which schematic pages are placed on a sheet, which doesn't help at all, sinse, there's nothing like flexbox to recalculate `sch` coordinates of all components in a section as I place them in different order on a sheet?
A
astrimid
This could be sufficient, as it doesn't look like you can place same component in multiple sections or multiple sheets?
A
astrimid
You could arguable create multiple `<schematicbox` for the same component and place those "copies" on multiple sheets, but I'm not sure about `<schematicbox` capability as its quite new.
Want to add to the conversation?
Reply in Discord so your notes stay connected to the source.