Skip to content

Commit cafd44e

Browse files
committed
feat(base-element): a page could hide a block on every component or on none, because the lever was a stylesheet
`hide-readings` has always been per element: the WordPress plugin resolves a site setting against a shortcode attribute and emits the answer on the tag, so one placement can disagree with the site. Hiding a whole BLOCK had no such lever. The only way to drop the chart patterns was a `::part()` rule in the page stylesheet, which by construction applies to every component on the site, so a teaching page and a public reading could not differ. `RoxyDataElement` now takes `hide-sections`, a comma-separated list of part names, and generates one rule per name into a per-instance style element inside its own shadow root. It is the sibling of `hide-readings` and deliberately a different tool: that one drops interpretive PROSE out of the markup so a page never ships words it is not showing, this one hides a block whatever the block contains, which is what a chart-pattern list needs because a T-square is a measurement rather than writing. Nothing was curated to make this work. The rule is generated from the name, so every one of the 100 published part names works on every component that carries it, and a name a component does not carry costs nothing and hides nothing. The selector is `[part~="name"]` rather than `[part="name"]` because `part` is a space-separated list: the natal chart grid carries `section aspects table aspect-grid`, so an exact match would reach it by none of its four names. Two things that look like shortcuts and are not. The rules go in a `<style>` in the template rather than in static `styles`, because static styles are shared across instances and two charts on one page have to be able to differ, which is the entire feature. And `display:none` carries `!important` because Lit puts static styles in `adoptedStyleSheets`, which the scoping spec applies AFTER an in-tree style element, so a component's own `display:flex` wins otherwise. Measured both ways: `patterns` is a bare section and hid without it, `legend` carries a flex rule and did not. One entry in `BASE_PROPS` carried it into all 61 React and 61 Vue wrappers, typed and documented, which is the maintenance-free half of the existing mechanism working as designed. The two non-data widgets are correctly excluded. Three e2e tests, the last of which is the one that matters: two components on one page hiding different blocks, which a stylesheet could not express. Sabotage-proven by swapping `~=` for `=`, which fails two of them.
1 parent 46f31e5 commit cafd44e

126 files changed

Lines changed: 1060 additions & 62 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ The full set: `RoxyNatalChart` `houseSystem`, `RoxyHoroscopeCard` `period`, `Rox
219219

220220
Every component takes `hide-readings` (`hideReadings` in React and Vue). It renders the chart and the data and leaves the interpretation out of the page: wheels, maps, tables, grids, legends, badges and every number stay, the interpretive prose goes. Off by default, so a component that does not set it is unchanged.
221221

222-
The line is drawn on the CONTENT, never on the block, so a block that reads like analysis still stays when it is made of measurements. `<roxy-natal-chart>` and `<roxy-aspects-table>` both render the `patterns` payload and both make the same cut: the figure name, element, modality, tightness and planet chips are geometry and survive, the paragraph under them is the reading and goes. To remove such a block entirely, hide its part instead: `roxy-natal-chart::part(patterns) { display: none }`.
222+
The line is drawn on the CONTENT, never on the block, so a block that reads like analysis still stays when it is made of measurements. `<roxy-natal-chart>` and `<roxy-aspects-table>` both render the `patterns` payload and both make the same cut: the figure name, element, modality, tightness and planet chips are geometry and survive, the paragraph under them is the reading and goes. To remove such a block entirely, use `hide-sections` below.
223223

224224
```html
225225
<roxy-natal-chart hide-readings></roxy-natal-chart>
@@ -241,6 +241,25 @@ One component is a documented no-op despite being mostly prose:
241241

242242
What survives, by family: charts keep the drawing, legend, glyphs, degrees and tab strip; tables keep every row and every calculated column (kaksha bindus, koota scores, significance bars, orbs, strengths); cards keep the header, badges, meters and fact grids, so a dosha keeps its verdict, phase and severity, a crystal keeps its Mohs hardness and attribute grid, and a horoscope keeps its energy meter, Moon placement, active transits and key dates; every Vedic response keeps its sidereal frame caption. What goes: interpretation paragraphs, reading accordions, keyword chips attached to a reading, remedies, action steps and strengths lists, and any section whose only content was one of those, heading included.
243243

244+
### 6e. Removing a whole block
245+
246+
Every component also takes `hide-sections` (`hideSections` in React and Vue): a comma-separated list of `part` names, and each one named is taken off that component.
247+
248+
```html
249+
<roxy-natal-chart hide-sections="patterns"></roxy-natal-chart>
250+
<roxy-natal-chart hide-sections="patterns, legend"></roxy-natal-chart>
251+
```
252+
253+
```tsx
254+
<RoxyNatalChart data={chart} hideSections="patterns" />
255+
```
256+
257+
**It is per element, which is the difference from a stylesheet.** A `::part()` rule in your CSS reaches every matching component on the site at once; this reaches the one you put it on, so the same chart can keep its patterns on one page and drop them on another with no CSS at all.
258+
259+
**Use `hide-readings` when the words must not ship, and `hide-sections` when a block should not show.** They are different tools rather than two spellings of one. `hide-readings` drops interpretive prose out of the markup entirely, so the page never ships text it is not displaying. `hide-sections` hides the block with CSS and leaves it in the DOM, because a block is a rendering concern and its content may be measurements you have no reason to strip.
260+
261+
Any name a component publishes works, and the names are in `components-catalog.json` under `parts`. A name the component does not carry hides nothing and is not an error, so one list can be applied across a page of mixed components. Names are case-insensitive and spaces around the commas are ignored.
262+
244263
### 6c. Vue and Nuxt
245264

246265
`@roxyapi/ui-vue` exposes the same components with the same prop names. Bind `data` and the config props normally; the package sets them as DOM properties for you, so an object payload never gets stringified into an attribute. Listen to widget events with the usual `@` syntax.

packages/ui-react/src/components/angel-number-card.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyAngelNumberCardProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyAngelNumberCard = React.forwardRef<HTMLElement | null, RoxyAngelNumberCardProps>(
37-
function RoxyAngelNumberCard({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyAngelNumberCard({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyAngelNumberCard = React.forwardRef<HTMLElement | null, RoxyAnge
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/angel-number-lookup.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyAngelNumberLookupProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyAngelNumberLookup = React.forwardRef<HTMLElement | null, RoxyAngelNumberLookupProps>(
37-
function RoxyAngelNumberLookup({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyAngelNumberLookup({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyAngelNumberLookup = React.forwardRef<HTMLElement | null, RoxyAn
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/arudha-padas.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyArudhaPadasProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyArudhaPadas = React.forwardRef<HTMLElement | null, RoxyArudhaPadasProps>(
37-
function RoxyArudhaPadas({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyArudhaPadas({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyArudhaPadas = React.forwardRef<HTMLElement | null, RoxyArudhaPa
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/ashtakavarga-grid.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyAshtakavargaGridProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyAshtakavargaGrid = React.forwardRef<HTMLElement | null, RoxyAshtakavargaGridProps>(
37-
function RoxyAshtakavargaGrid({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyAshtakavargaGrid({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyAshtakavargaGrid = React.forwardRef<HTMLElement | null, RoxyAsh
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/aspects-table.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyAspectsTableProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyAspectsTable = React.forwardRef<HTMLElement | null, RoxyAspectsTableProps>(
37-
function RoxyAspectsTable({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyAspectsTable({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyAspectsTable = React.forwardRef<HTMLElement | null, RoxyAspects
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/astrocartography-map.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyAstrocartographyMapProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyAstrocartographyMap = React.forwardRef<HTMLElement | null, RoxyAstrocartographyMapProps>(
37-
function RoxyAstrocartographyMap({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyAstrocartographyMap({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyAstrocartographyMap = React.forwardRef<HTMLElement | null, Roxy
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/bhav-chalit-table.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyBhavChalitTableProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyBhavChalitTable = React.forwardRef<HTMLElement | null, RoxyBhavChalitTableProps>(
37-
function RoxyBhavChalitTable({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyBhavChalitTable({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyBhavChalitTable = React.forwardRef<HTMLElement | null, RoxyBhav
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

packages/ui-react/src/components/bhava-bala-table.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export interface RoxyBhavaBalaTableProps extends ElementAttrs {
3030
attribution?: string;
3131
/** Render the chart and the data and omit the written interpretation. Off by default. Use it when the page supplies its own words: the wheels, tables, grids, legends and numbers stay, and the interpretive prose is left out of the markup entirely. */
3232
hideReadings?: boolean;
33+
/** Comma-separated list of `part` names to take off this component, for example "patterns" or "patterns, legend". Per element rather than per site, so the same component can drop a block on one page and keep it on another with no CSS. Sibling of hideReadings and a different tool: this hides a whole block whatever it contains, where hideReadings drops interpretive prose out of the markup. Names come from the `parts` array in components-catalog.json; a name the component does not carry hides nothing and is not an error. */
34+
hideSections?: string;
3335

3436
}
3537

3638
export const RoxyBhavaBalaTable = React.forwardRef<HTMLElement | null, RoxyBhavaBalaTableProps>(
37-
function RoxyBhavaBalaTable({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, ...rest }, ref) {
39+
function RoxyBhavaBalaTable({ data, className, style, endpoint, method, publishableKey, baseUrl, specUrl, lang, submitLabel, attribution, hideReadings, hideSections, ...rest }, ref) {
3840
const internal = React.useRef<HTMLElement | null>(null);
3941
React.useImperativeHandle<HTMLElement | null, HTMLElement | null>(
4042
ref,
@@ -129,6 +131,13 @@ export const RoxyBhavaBalaTable = React.forwardRef<HTMLElement | null, RoxyBhava
129131
}
130132
}, [hideReadings, loaded]);
131133

134+
React.useEffect(() => {
135+
const el = internal.current;
136+
if (el && hideSections !== undefined) {
137+
(el as unknown as { hideSections: string }).hideSections = hideSections;
138+
}
139+
}, [hideSections, loaded]);
140+
132141
if (error) {
133142
return React.createElement(
134143
'div',

0 commit comments

Comments
 (0)