@inc2734/unitone-css 1.3.1 → 1.4.1

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.
Files changed (62) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/app.js +1 -1
  3. package/dist/behaviors/dividers.js +1 -1
  4. package/dist/behaviors/index.js +1 -1
  5. package/dist/behaviors/stairs.js +1 -1
  6. package/dist/layout-primitives/both-sides/react.js +1 -1
  7. package/dist/layout-primitives/center/react.js +1 -1
  8. package/dist/layout-primitives/cluster/react.js +1 -1
  9. package/dist/layout-primitives/container/react.js +1 -1
  10. package/dist/layout-primitives/decorator/react.js +1 -1
  11. package/dist/layout-primitives/frame/react.js +1 -1
  12. package/dist/layout-primitives/gutters/react.js +1 -1
  13. package/dist/layout-primitives/index.js +1 -1
  14. package/dist/layout-primitives/layers/react.js +1 -1
  15. package/dist/layout-primitives/marquee/behavior.js +1 -1
  16. package/dist/layout-primitives/marquee/react.js +1 -1
  17. package/dist/layout-primitives/reel/react.js +1 -1
  18. package/dist/layout-primitives/responsive-grid/react.js +1 -1
  19. package/dist/layout-primitives/stack/react.js +1 -1
  20. package/dist/layout-primitives/switcher/react.js +1 -1
  21. package/dist/layout-primitives/text/react.js +1 -1
  22. package/dist/layout-primitives/texture/react.js +1 -1
  23. package/dist/layout-primitives/vertical-ends/react.js +1 -1
  24. package/dist/layout-primitives/vertical-writing/behavior.js +1 -1
  25. package/dist/layout-primitives/vertical-writing/react.js +1 -1
  26. package/dist/layout-primitives/with-sidebar/react.js +1 -1
  27. package/dist/library.js +1 -1
  28. package/package.json +2 -2
  29. package/src/behaviors/_fluid-reference.scss +8 -21
  30. package/src/behaviors/_index.scss +3 -1
  31. package/src/behaviors/_responsive-context.scss +96 -0
  32. package/src/layout-primitives/both-sides/index.jsx +1 -12
  33. package/src/layout-primitives/center/index.jsx +1 -11
  34. package/src/layout-primitives/cluster/index.jsx +0 -4
  35. package/src/layout-primitives/container/_index.scss +2 -0
  36. package/src/layout-primitives/container/index.jsx +3 -1
  37. package/src/layout-primitives/decorator/index.jsx +3 -1
  38. package/src/layout-primitives/frame/_index.scss +4 -10
  39. package/src/layout-primitives/frame/index.jsx +1 -1
  40. package/src/layout-primitives/gutters/index.jsx +2 -7
  41. package/src/layout-primitives/layers/_index.scss +7 -12
  42. package/src/layout-primitives/layers/index.jsx +4 -2
  43. package/src/layout-primitives/marquee/_index.scss +2 -3
  44. package/src/layout-primitives/marquee/index.jsx +1 -13
  45. package/src/layout-primitives/reel/index.jsx +1 -12
  46. package/src/layout-primitives/responsive-grid/_index.scss +2 -0
  47. package/src/layout-primitives/responsive-grid/index.jsx +3 -1
  48. package/src/layout-primitives/stack/_index.scss +2 -0
  49. package/src/layout-primitives/stack/index.jsx +3 -1
  50. package/src/layout-primitives/switcher/_index.scss +2 -0
  51. package/src/layout-primitives/switcher/index.jsx +3 -1
  52. package/src/layout-primitives/text/_index.scss +2 -0
  53. package/src/layout-primitives/text/index.jsx +3 -1
  54. package/src/layout-primitives/texture/index.jsx +1 -8
  55. package/src/layout-primitives/vertical-ends/_index.scss +2 -0
  56. package/src/layout-primitives/vertical-ends/index.jsx +3 -1
  57. package/src/layout-primitives/vertical-writing/_index.scss +9 -21
  58. package/src/layout-primitives/vertical-writing/index.jsx +2 -2
  59. package/src/library.js +498 -425
  60. package/src/observer-scope.js +53 -0
  61. package/src/register-layout-initializer.js +35 -3
  62. package/src/variables/_index.scss +125 -75
@@ -16,7 +16,8 @@ export const Layers = ({
16
16
  rowTrackSize,
17
17
  queryContext,
18
18
  containerType,
19
- fluidReference,
19
+ responsiveContext,
20
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
20
21
  style,
21
22
  ...props
22
23
  }) => {
@@ -41,8 +42,9 @@ export const Layers = ({
41
42
  '' !== (gap ?? '') ? `-gap:${gap}` : undefined,
42
43
  '' !== (columnGap ?? '') ? `-column-gap:${columnGap}` : undefined,
43
44
  '' !== (rowGap ?? '') ? `-row-gap:${rowGap}` : undefined,
44
- queryContext ? `@${queryContext}` : undefined,
45
+ 'container' === queryContext ? '@container' : undefined,
45
46
  '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
47
+ 'container' === responsiveContext ? '-responsive-context:container' : undefined,
46
48
  '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
47
49
  ]
48
50
  .filter(Boolean)
@@ -36,7 +36,6 @@
36
36
  gap: inherit;
37
37
  align-items: center;
38
38
  justify-content: space-around;
39
- min-width: 100%;
40
39
 
41
40
  &[data-unitone-layout~="marquee:initialized"] {
42
41
  animation-name: marquee;
@@ -64,10 +63,10 @@
64
63
 
65
64
  @keyframes marquee {
66
65
  0% { translate: 0; }
67
- 100% { translate: calc(-100% - var(--unitone--gap)); }
66
+ 100% { translate: calc(-100% - var(--unitone--marquee-gap, var(--unitone--gap))); }
68
67
  }
69
68
 
70
69
  @keyframes marquee-reverse {
71
70
  0% { translate: 0; }
72
- 100% { translate: calc(100% + var(--unitone--gap)); }
71
+ 100% { translate: calc(100% + var(--unitone--marquee-gap, var(--unitone--gap))); }
73
72
  }
@@ -1,16 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- export const Marquee = ({
4
- duration,
5
- gap,
6
- itemWidth,
7
- reverse,
8
- pauseOnHover,
9
- containerType,
10
- fluidReference,
11
- style,
12
- ...props
13
- }) => {
3
+ export const Marquee = ({ duration, gap, itemWidth, reverse, pauseOnHover, style, ...props }) => {
14
4
  style = {
15
5
  ...style,
16
6
  '--unitone--animation-duration': '' !== duration ? duration : undefined,
@@ -23,8 +13,6 @@ export const Marquee = ({
23
13
  'marquee-wrapper',
24
14
  reverse ? '-reverse' : undefined,
25
15
  pauseOnHover ? '-pause-on-hover' : undefined,
26
- '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
27
- '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
28
16
  ]
29
17
  .filter(Boolean)
30
18
  .join(' ')}
@@ -1,15 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- export const Reel = ({
4
- gap,
5
- height,
6
- itemWidth,
7
- noBar,
8
- containerType,
9
- fluidReference,
10
- style,
11
- ...props
12
- }) => {
3
+ export const Reel = ({ gap, height, itemWidth, noBar, style, ...props }) => {
13
4
  style = {
14
5
  ...style,
15
6
  '--unitone--height': '' !== height ? height : undefined,
@@ -22,8 +13,6 @@ export const Reel = ({
22
13
  'reel',
23
14
  '' !== (gap ?? '') ? `-gap:${gap}` : undefined,
24
15
  noBar ? '-no-bar' : undefined,
25
- '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
26
- '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
27
16
  ]
28
17
  .filter(Boolean)
29
18
  .join(' ')}
@@ -4,7 +4,9 @@
4
4
  --unitone--gap: var(--unitone--global--gap);
5
5
  --unitone--column-gap: var(--unitone--gap);
6
6
  --unitone--row-gap: var(--unitone--gap);
7
+ --unitone--container-type: initial;
7
8
 
9
+ container-type: var(--unitone--container-type);
8
10
  display: grid;
9
11
  column-gap: var(--unitone--column-gap);
10
12
  row-gap: var(--unitone--row-gap);
@@ -11,7 +11,8 @@ export const ResponsiveGrid = ({
11
11
  stairs,
12
12
  stairsUp,
13
13
  containerType,
14
- fluidReference,
14
+ responsiveContext,
15
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
15
16
  style,
16
17
  ...props
17
18
  }) => {
@@ -33,6 +34,7 @@ export const ResponsiveGrid = ({
33
34
  '' !== (stairs ?? '') ? `-stairs:${stairs}` : undefined,
34
35
  '' !== (stairsUp ?? '') ? `-stairs-up:${stairsUp}` : undefined,
35
36
  '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
37
+ 'container' === responsiveContext ? '-responsive-context:container' : undefined,
36
38
  '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
37
39
  ]
38
40
  .filter(Boolean)
@@ -1,6 +1,8 @@
1
1
  @mixin abstract-stack() {
2
2
  --unitone--gap: var(--unitone--global--text-gap);
3
+ --unitone--container-type: initial;
3
4
 
5
+ container-type: var(--unitone--container-type);
4
6
  display: flex;
5
7
  flex-direction: column;
6
8
  gap: var(--unitone--gap);
@@ -9,7 +9,8 @@ export const Stack = ({
9
9
  dividerStyle,
10
10
  dividerColor,
11
11
  containerType,
12
- fluidReference,
12
+ responsiveContext,
13
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
13
14
  tagName = 'div',
14
15
  style,
15
16
  ...props
@@ -32,6 +33,7 @@ export const Stack = ({
32
33
  '' !== (gap ?? '') ? `-gap:${gap}` : undefined,
33
34
  negative ? '-negative' : undefined,
34
35
  '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
36
+ 'container' === responsiveContext ? '-responsive-context:container' : undefined,
35
37
  '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
36
38
  ]
37
39
  .filter(Boolean)
@@ -4,7 +4,9 @@
4
4
  --unitone--row-gap: var(--unitone--gap);
5
5
  --unitone--threshold: var(--unitone--measure);
6
6
  --unitone--align-items: stretch;
7
+ --unitone--container-type: initial;
7
8
 
9
+ container-type: var(--unitone--container-type);
8
10
  display: flex;
9
11
  flex-wrap: wrap;
10
12
  column-gap: var(--unitone--column-gap);
@@ -11,7 +11,8 @@ export const Switcher = ({
11
11
  stairs,
12
12
  stairsUp,
13
13
  containerType,
14
- fluidReference,
14
+ responsiveContext,
15
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
15
16
  style,
16
17
  ...props
17
18
  }) => {
@@ -32,6 +33,7 @@ export const Switcher = ({
32
33
  '' !== (stairs ?? '') ? `-stairs:${stairs}` : undefined,
33
34
  '' !== (stairsUp ?? '') ? `-stairs-up:${stairsUp}` : undefined,
34
35
  '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
36
+ 'container' === responsiveContext ? '-responsive-context:container' : undefined,
35
37
  '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
36
38
  ]
37
39
  .filter(Boolean)
@@ -2,7 +2,9 @@
2
2
  --unitone--gutters: 0px;
3
3
  --unitone--max-width: var(--unitone--measure);
4
4
  --unitone--text-gap: var(--unitone--global--text-gap);
5
+ --unitone--container-type: initial;
5
6
 
7
+ container-type: var(--unitone--container-type);
6
8
  box-sizing: content-box;
7
9
  padding-right: var(--unitone--gutters);
8
10
  padding-left: var(--unitone--gutters);
@@ -9,7 +9,8 @@ export const Text = ({
9
9
  maxWidth,
10
10
  columnWidth,
11
11
  containerType,
12
- fluidReference,
12
+ responsiveContext,
13
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
13
14
  style,
14
15
  ...props
15
16
  }) => {
@@ -29,6 +30,7 @@ export const Text = ({
29
30
  '' !== (gap ?? '') ? `-gap:${gap}` : undefined,
30
31
  '' !== (gutters ?? '') ? `-gutters:${gutters}` : undefined,
31
32
  '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
33
+ 'container' === responsiveContext ? '-responsive-context:container' : undefined,
32
34
  '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
33
35
  ]
34
36
  .filter(Boolean)
@@ -16,8 +16,6 @@ export const Texture = ({
16
16
  textureBorderBottomRightRadius,
17
17
  textureBandTopSize,
18
18
  textureBandBottomSize,
19
- containerType,
20
- fluidReference,
21
19
  style,
22
20
  ...props
23
21
  }) => {
@@ -47,12 +45,7 @@ export const Texture = ({
47
45
 
48
46
  return (
49
47
  <div
50
- data-unitone-layout={[
51
- 'texture',
52
- '' !== (texture ?? '') ? `-texture:${texture}` : undefined,
53
- '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
54
- '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
55
- ]
48
+ data-unitone-layout={['texture', '' !== (texture ?? '') ? `-texture:${texture}` : undefined]
56
49
  .filter(Boolean)
57
50
  .join(' ')}
58
51
  style={style}
@@ -1,7 +1,9 @@
1
1
  @mixin abstract-vertical-ends() {
2
2
  --unitone--gap: var(--unitone--global--text-gap);
3
3
  --unitone--align-items: stretch;
4
+ --unitone--container-type: initial;
4
5
 
6
+ container-type: var(--unitone--container-type);
5
7
  display: flex;
6
8
  gap: var(--unitone--gap);
7
9
  flex-direction: column;
@@ -4,7 +4,8 @@ export const VerticalEnds = ({
4
4
  gap,
5
5
  alignItems,
6
6
  containerType,
7
- fluidReference,
7
+ responsiveContext,
8
+ fluidReference, // @deprecated Kept for backward compatibility. Use responsiveContext on an ancestor instead.
8
9
  style,
9
10
  ...props
10
11
  }) => {
@@ -19,6 +20,7 @@ export const VerticalEnds = ({
19
20
  '' !== (gap ?? '') ? `-gap:${gap}` : undefined,
20
21
  '' !== (alignItems ?? '') ? `-align-items:${alignItems}` : undefined,
21
22
  '' !== (containerType ?? '') ? `-container-type:${containerType}` : undefined,
23
+ 'container' === responsiveContext ? '-responsive-context:container' : undefined,
22
24
  '' !== (fluidReference ?? '') ? `-fluid-reference:${fluidReference}` : undefined,
23
25
  ]
24
26
  .filter(Boolean)
@@ -1,3 +1,5 @@
1
+ @use '../../behaviors/responsive-context';
2
+
1
3
  @mixin abstract-vertical-writing() {
2
4
  --unitone--gap: var(--unitone--global--text-gap);
3
5
  --unitone--column-gap: var(--unitone--global--gap);
@@ -41,33 +43,19 @@
41
43
  writing-mode: horizontal-tb;
42
44
 
43
45
  > * {
44
- box-sizing: border-box;
45
46
  max-inline-size: none;
47
+ box-sizing: border-box;
46
48
  }
47
49
  }
48
50
 
49
51
  &[data-unitone-layout~="-switch"] {
50
- &:where(:not([data-unitone-layout~="@container"])) {
51
- @media (orientation: portrait) and (width < 600px) {
52
- column-count: auto;
53
- writing-mode: horizontal-tb;
54
-
55
- > * {
56
- box-sizing: border-box;
57
- max-inline-size: none;
58
- }
59
- }
60
- }
61
-
62
- &:where([data-unitone-layout~="@container"]) {
63
- @container (width < 600px) {
64
- column-count: auto;
65
- writing-mode: horizontal-tb;
52
+ @include responsive-context.responsive-query('(width < 600px)') {
53
+ column-count: auto;
54
+ writing-mode: horizontal-tb;
66
55
 
67
- > * {
68
- box-sizing: border-box;
69
- max-inline-size: none;
70
- }
56
+ > * {
57
+ max-inline-size: none;
58
+ box-sizing: border-box;
71
59
  }
72
60
  }
73
61
  }
@@ -6,8 +6,8 @@ export const VerticalWriting = ({
6
6
  maxHeight,
7
7
  switchWritingMode,
8
8
  threshold,
9
- style,
10
9
  queryContext,
10
+ style,
11
11
  ...props
12
12
  }) => {
13
13
  style = {
@@ -24,7 +24,7 @@ export const VerticalWriting = ({
24
24
  '' !== (textOrientation ?? '') ? `-text-orientation:${textOrientation}` : undefined,
25
25
  '' !== (gap ?? '') ? `-gap:${gap}` : undefined,
26
26
  switchWritingMode ? '-switch' : undefined,
27
- queryContext ? `@${queryContext}` : undefined,
27
+ 'container' === queryContext ? '@container' : undefined,
28
28
  ]
29
29
  .filter(Boolean)
30
30
  .join(' ')}