@pyreon/elements 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,31 +23,25 @@ const parentFixCSS = `
23
23
  flex-direction: column;
24
24
  `
25
25
 
26
- const fullHeightCSS = `
27
- height: 100%;
28
- `
29
-
30
- const blockCSS = `
31
- align-self: stretch;
32
- flex: 1;
33
- min-width: 0;
34
- `
35
-
36
- const childFixPosition = (isBlock?: boolean) => `display: ${isBlock ? 'flex' : 'inline-flex'};`
37
-
38
- const styles: ResponsiveStylesCallback = ({ theme: t, css: cssFn }) => cssFn`
39
- ${t.alignY === 'block' && fullHeightCSS};
40
-
26
+ export const styles: ResponsiveStylesCallback = ({ theme: t, css: cssFn }) => cssFn`
41
27
  ${alignContent({
42
28
  direction: t.direction,
43
29
  alignX: t.alignX,
44
30
  alignY: t.alignY,
45
31
  })};
46
32
 
47
- ${t.block && blockCSS};
48
- ${t.alignY === 'block' && t.block && fullHeightCSS};
33
+ /*
34
+ * Always emit a value for the block-related properties so a responsive
35
+ * theme that flips from \`block: true\` at one breakpoint to \`block: false\`
36
+ * at another resets cleanly. Previously \`align-self\` / \`width\` / \`height\`
37
+ * were only set when the truthy branch matched, which left the prior
38
+ * breakpoint's values cascading through.
39
+ */
40
+ ${`align-self: ${t.block ? 'stretch' : 'auto'};
41
+ width: ${t.block ? '100%' : 'auto'};
42
+ height: ${t.alignY === 'block' ? '100%' : 'auto'};`};
49
43
 
50
- ${!t.childFix && childFixPosition(t.block)};
44
+ ${!t.childFix && `display: ${t.block ? 'flex' : 'inline-flex'};`};
51
45
  ${t.parentFix && parentFixCSS};
52
46
 
53
47
  ${t.extraStyles && extendCss(t.extraStyles as Parameters<typeof extendCss>[0])};
package/src/index.ts CHANGED
@@ -3,12 +3,16 @@ import { Provider } from '@pyreon/unistyle'
3
3
  export type { ElementProps, PyreonElement } from './Element'
4
4
  export { Element } from './Element'
5
5
  export type {
6
+ ChildrenProps as IteratorChildrenProps,
6
7
  ElementType,
7
8
  ExtendedProps,
9
+ LooseProps as IteratorLooseProps,
8
10
  MaybeNull,
11
+ ObjectProps as IteratorObjectProps,
9
12
  ObjectValue,
10
13
  Props as IteratorProps,
11
14
  PropsCallback,
15
+ SimpleProps as IteratorSimpleProps,
12
16
  SimpleValue,
13
17
  } from './helpers/Iterator'
14
18
  export { default as Iterator } from './helpers/Iterator'
package/src/types.ts CHANGED
@@ -69,8 +69,39 @@ export type Responsive =
69
69
 
70
70
  export type ExtendCss = Css | Css[] | Partial<Record<BreakpointKeys, Css>>
71
71
 
72
- export type ExtractProps<TComponentOrTProps> =
73
- TComponentOrTProps extends ComponentFn<infer TProps> ? TProps : TComponentOrTProps
72
+ /**
73
+ * Extracts the props type from a Pyreon component function — multi-overload
74
+ * aware. Matches up to 4 call signatures and produces the UNION of their
75
+ * first-argument types. Iterator / List ship 3-overload primitives whose
76
+ * LAST overload is `ChildrenProps` (the loosest); without overload-aware
77
+ * extraction, `ExtractProps<Iterator>` returned just `ChildrenProps` and
78
+ * lost `SimpleProps<T>` / `ObjectProps<T>` shapes. Mirrors vitus-labs
79
+ * PR #222.
80
+ *
81
+ * Kept in sync with the copies in `@pyreon/core` / `@pyreon/attrs` /
82
+ * `@pyreon/rocketstyle`.
83
+ */
84
+ export type ExtractProps<TComponentOrTProps> = TComponentOrTProps extends {
85
+ (props: infer P1, ...args: any): any
86
+ (props: infer P2, ...args: any): any
87
+ (props: infer P3, ...args: any): any
88
+ (props: infer P4, ...args: any): any
89
+ }
90
+ ? P1 | P2 | P3 | P4
91
+ : TComponentOrTProps extends {
92
+ (props: infer P1, ...args: any): any
93
+ (props: infer P2, ...args: any): any
94
+ (props: infer P3, ...args: any): any
95
+ }
96
+ ? P1 | P2 | P3
97
+ : TComponentOrTProps extends {
98
+ (props: infer P1, ...args: any): any
99
+ (props: infer P2, ...args: any): any
100
+ }
101
+ ? P1 | P2
102
+ : TComponentOrTProps extends ComponentFn<infer TProps>
103
+ ? TProps
104
+ : TComponentOrTProps
74
105
 
75
106
  export type PyreonComponent<P extends Record<string, any> = {}> = ComponentFn<P> & PyreonStatic
76
107