@wordpress/style-engine 0.13.0 → 0.14.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.
- package/CHANGELOG.md +2 -0
- package/README.md +162 -4
- package/class-wp-style-engine-css-declarations.php +27 -3
- package/class-wp-style-engine-css-rule.php +17 -3
- package/class-wp-style-engine-css-rules-store.php +49 -0
- package/class-wp-style-engine-processor.php +68 -26
- package/class-wp-style-engine.php +236 -107
- package/package.json +2 -2
- package/phpunit/class-wp-style-engine-css-declarations-test.php +85 -7
- package/phpunit/class-wp-style-engine-css-rule-test.php +38 -7
- package/phpunit/class-wp-style-engine-css-rules-store-test.php +44 -2
- package/phpunit/class-wp-style-engine-processor-test.php +170 -31
- package/phpunit/class-wp-style-engine-test.php +219 -22
- package/build-types/index.d.ts +0 -23
- package/build-types/index.d.ts.map +0 -1
- package/build-types/styles/border/index.d.ts +0 -10
- package/build-types/styles/border/index.d.ts.map +0 -1
- package/build-types/styles/color/background.d.ts +0 -14
- package/build-types/styles/color/background.d.ts.map +0 -1
- package/build-types/styles/color/gradient.d.ts +0 -14
- package/build-types/styles/color/gradient.d.ts.map +0 -1
- package/build-types/styles/color/index.d.ts +0 -10
- package/build-types/styles/color/index.d.ts.map +0 -1
- package/build-types/styles/color/text.d.ts +0 -14
- package/build-types/styles/color/text.d.ts.map +0 -1
- package/build-types/styles/constants.d.ts +0 -4
- package/build-types/styles/constants.d.ts.map +0 -1
- package/build-types/styles/index.d.ts +0 -5
- package/build-types/styles/index.d.ts.map +0 -1
- package/build-types/styles/spacing/index.d.ts +0 -6
- package/build-types/styles/spacing/index.d.ts.map +0 -1
- package/build-types/styles/spacing/margin.d.ts +0 -10
- package/build-types/styles/spacing/margin.d.ts.map +0 -1
- package/build-types/styles/spacing/padding.d.ts +0 -10
- package/build-types/styles/spacing/padding.d.ts.map +0 -1
- package/build-types/styles/typography/index.d.ts +0 -14
- package/build-types/styles/typography/index.d.ts.map +0 -1
- package/build-types/styles/utils.d.ts +0 -48
- package/build-types/styles/utils.d.ts.map +0 -1
- package/build-types/types.d.ts +0 -86
- package/build-types/types.d.ts.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -6,44 +6,55 @@
|
|
|
6
6
|
* @subpackage style-engine
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
require __DIR__ . '/../class-wp-style-engine-processor.php';
|
|
9
10
|
require __DIR__ . '/../class-wp-style-engine-css-declarations.php';
|
|
11
|
+
require __DIR__ . '/../class-wp-style-engine-css-rule.php';
|
|
12
|
+
require __DIR__ . '/../class-wp-style-engine-css-rules-store.php';
|
|
10
13
|
require __DIR__ . '/../class-wp-style-engine.php';
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Tests for registering, storing and generating styles.
|
|
14
17
|
*/
|
|
15
18
|
class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
19
|
+
/**
|
|
20
|
+
* Tear down after each test.
|
|
21
|
+
*/
|
|
22
|
+
public function tear_down() {
|
|
23
|
+
parent::tear_down();
|
|
24
|
+
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
/**
|
|
17
28
|
* Tests generating block styles and classnames based on various manifestations of the $block_styles argument.
|
|
18
29
|
*
|
|
19
|
-
* @dataProvider
|
|
30
|
+
* @dataProvider data_get_styles_fixtures
|
|
20
31
|
*
|
|
21
|
-
* @param array $block_styles
|
|
22
|
-
* @param array $options
|
|
32
|
+
* @param array $block_styles The incoming block styles object.
|
|
33
|
+
* @param array $options Style engine options.
|
|
23
34
|
* @param string $expected_output The expected output.
|
|
24
35
|
*/
|
|
25
|
-
public function
|
|
26
|
-
$generated_styles =
|
|
36
|
+
public function test_generate_get_styles( $block_styles, $options, $expected_output ) {
|
|
37
|
+
$generated_styles = wp_style_engine_get_styles( $block_styles, $options );
|
|
27
38
|
$this->assertSame( $expected_output, $generated_styles );
|
|
28
39
|
}
|
|
29
40
|
|
|
30
41
|
/**
|
|
31
|
-
* Data provider.
|
|
42
|
+
* Data provider for test_generate_get_styles().
|
|
32
43
|
*
|
|
33
44
|
* @return array
|
|
34
45
|
*/
|
|
35
|
-
public function
|
|
46
|
+
public function data_get_styles_fixtures() {
|
|
36
47
|
return array(
|
|
37
48
|
'default_return_value' => array(
|
|
38
49
|
'block_styles' => array(),
|
|
39
50
|
'options' => null,
|
|
40
|
-
'expected_output' =>
|
|
51
|
+
'expected_output' => array(),
|
|
41
52
|
),
|
|
42
53
|
|
|
43
54
|
'inline_invalid_block_styles_empty' => array(
|
|
44
55
|
'block_styles' => 'hello world!',
|
|
45
56
|
'options' => null,
|
|
46
|
-
'expected_output' =>
|
|
57
|
+
'expected_output' => array(),
|
|
47
58
|
),
|
|
48
59
|
|
|
49
60
|
'inline_invalid_block_styles_unknown_style' => array(
|
|
@@ -72,7 +83,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
72
83
|
'expected_output' => array(),
|
|
73
84
|
),
|
|
74
85
|
|
|
75
|
-
'
|
|
86
|
+
'valid_inline_css_and_classnames_as_default_context' => array(
|
|
76
87
|
'block_styles' => array(
|
|
77
88
|
'color' => array(
|
|
78
89
|
'text' => 'var:preset|color|texas-flood',
|
|
@@ -89,7 +100,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
89
100
|
),
|
|
90
101
|
'options' => array( 'convert_vars_to_classnames' => true ),
|
|
91
102
|
'expected_output' => array(
|
|
92
|
-
'css' => 'border-style:
|
|
103
|
+
'css' => 'border-style:dotted;border-width:2rem;padding:0;margin:111px;',
|
|
93
104
|
'declarations' => array(
|
|
94
105
|
'border-style' => 'dotted',
|
|
95
106
|
'border-width' => '2rem',
|
|
@@ -100,6 +111,44 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
100
111
|
),
|
|
101
112
|
),
|
|
102
113
|
|
|
114
|
+
'valid_inline_css_and_classnames_with_context' => array(
|
|
115
|
+
'block_styles' => array(
|
|
116
|
+
'color' => array(
|
|
117
|
+
'text' => 'var:preset|color|little-lamb',
|
|
118
|
+
),
|
|
119
|
+
'spacing' => array(
|
|
120
|
+
'margin' => '20px',
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
'options' => array(
|
|
124
|
+
'convert_vars_to_classnames' => true,
|
|
125
|
+
'context' => 'block-supports',
|
|
126
|
+
),
|
|
127
|
+
'expected_output' => array(
|
|
128
|
+
'css' => 'margin:20px;',
|
|
129
|
+
'declarations' => array(
|
|
130
|
+
'margin' => '20px',
|
|
131
|
+
),
|
|
132
|
+
'classnames' => 'has-text-color has-little-lamb-color',
|
|
133
|
+
),
|
|
134
|
+
),
|
|
135
|
+
|
|
136
|
+
'invalid_context' => array(
|
|
137
|
+
'block_styles' => array(
|
|
138
|
+
'color' => array(
|
|
139
|
+
'text' => 'var:preset|color|sugar',
|
|
140
|
+
),
|
|
141
|
+
'spacing' => array(
|
|
142
|
+
'padding' => '20000px',
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
'options' => array(
|
|
146
|
+
'convert_vars_to_classnames' => true,
|
|
147
|
+
'context' => 'i-love-doughnuts',
|
|
148
|
+
),
|
|
149
|
+
'expected_output' => array(),
|
|
150
|
+
),
|
|
151
|
+
|
|
103
152
|
'inline_valid_box_model_style' => array(
|
|
104
153
|
'block_styles' => array(
|
|
105
154
|
'spacing' => array(
|
|
@@ -127,7 +176,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
127
176
|
),
|
|
128
177
|
'options' => null,
|
|
129
178
|
'expected_output' => array(
|
|
130
|
-
'css' => 'border-top-left-radius:
|
|
179
|
+
'css' => 'border-top-left-radius:99px;border-top-right-radius:98px;border-bottom-left-radius:97px;border-bottom-right-radius:96px;padding-top:42px;padding-left:2%;padding-bottom:44px;padding-right:5rem;margin-top:12rem;margin-left:2vh;margin-bottom:2px;margin-right:10em;',
|
|
131
180
|
'declarations' => array(
|
|
132
181
|
'border-top-left-radius' => '99px',
|
|
133
182
|
'border-top-right-radius' => '98px',
|
|
@@ -160,7 +209,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
160
209
|
),
|
|
161
210
|
'options' => null,
|
|
162
211
|
'expected_output' => array(
|
|
163
|
-
'css' => 'font-family:
|
|
212
|
+
'css' => 'font-size:clamp(2em, 2vw, 4em);font-family:Roboto,Oxygen-Sans,Ubuntu,sans-serif;font-style:italic;font-weight:800;line-height:1.3;text-decoration:underline;text-transform:uppercase;letter-spacing:2;',
|
|
164
213
|
'declarations' => array(
|
|
165
214
|
'font-size' => 'clamp(2em, 2vw, 4em)',
|
|
166
215
|
'font-family' => 'Roboto,Oxygen-Sans,Ubuntu,sans-serif',
|
|
@@ -187,7 +236,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
187
236
|
),
|
|
188
237
|
'options' => array( 'selector' => '.wp-selector > p' ),
|
|
189
238
|
'expected_output' => array(
|
|
190
|
-
'css' => '.wp-selector > p
|
|
239
|
+
'css' => '.wp-selector > p{padding-top:42px;padding-left:2%;padding-bottom:44px;padding-right:5rem;}',
|
|
191
240
|
'declarations' => array(
|
|
192
241
|
'padding-top' => '42px',
|
|
193
242
|
'padding-left' => '2%',
|
|
@@ -207,7 +256,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
207
256
|
'selector' => '.wp-selector',
|
|
208
257
|
),
|
|
209
258
|
'expected_output' => array(
|
|
210
|
-
'css' => '.wp-selector
|
|
259
|
+
'css' => '.wp-selector{color:var(--wp--preset--color--my-little-pony);}',
|
|
211
260
|
'declarations' => array(
|
|
212
261
|
'color' => 'var(--wp--preset--color--my-little-pony)',
|
|
213
262
|
),
|
|
@@ -253,7 +302,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
253
302
|
),
|
|
254
303
|
'options' => array(),
|
|
255
304
|
'expected_output' => array(
|
|
256
|
-
'css' => 'color:
|
|
305
|
+
'css' => 'color:var(--wp--preset--color--teal-independents);',
|
|
257
306
|
'declarations' => array(
|
|
258
307
|
'color' => 'var(--wp--preset--color--teal-independents)',
|
|
259
308
|
),
|
|
@@ -270,7 +319,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
270
319
|
),
|
|
271
320
|
'options' => array(),
|
|
272
321
|
'expected_output' => array(
|
|
273
|
-
'css' => 'color
|
|
322
|
+
'css' => 'color:#fff;',
|
|
274
323
|
'declarations' => array(
|
|
275
324
|
'color' => '#fff',
|
|
276
325
|
),
|
|
@@ -304,7 +353,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
304
353
|
),
|
|
305
354
|
'options' => array(),
|
|
306
355
|
'expected_output' => array(
|
|
307
|
-
'css' => 'padding:
|
|
356
|
+
'css' => 'padding:var(--wp--preset--spacing--20);margin:var(--wp--preset--spacing--10);',
|
|
308
357
|
'declarations' => array(
|
|
309
358
|
'padding' => 'var(--wp--preset--spacing--20)',
|
|
310
359
|
'margin' => 'var(--wp--preset--spacing--10)',
|
|
@@ -331,7 +380,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
331
380
|
),
|
|
332
381
|
'options' => array(),
|
|
333
382
|
'expected_output' => array(
|
|
334
|
-
'css' => 'padding-left:
|
|
383
|
+
'css' => 'padding-left:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--40);padding-top:14px;padding-bottom:14px;margin-left:var(--wp--preset--spacing--10);margin-right:var(--wp--preset--spacing--20);margin-top:1rem;margin-bottom:1rem;',
|
|
335
384
|
'declarations' => array(
|
|
336
385
|
'padding-left' => 'var(--wp--preset--spacing--30)',
|
|
337
386
|
'padding-right' => 'var(--wp--preset--spacing--40)',
|
|
@@ -358,7 +407,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
358
407
|
),
|
|
359
408
|
'options' => array(),
|
|
360
409
|
'expected_output' => array(
|
|
361
|
-
'css' => 'margin-top:
|
|
410
|
+
'css' => 'margin-top:1rem;margin-bottom:0;',
|
|
362
411
|
'declarations' => array(
|
|
363
412
|
'margin-top' => '1rem',
|
|
364
413
|
'margin-bottom' => '0',
|
|
@@ -407,7 +456,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
407
456
|
),
|
|
408
457
|
'options' => array(),
|
|
409
458
|
'expected_output' => array(
|
|
410
|
-
'css' => 'border-top-color
|
|
459
|
+
'css' => 'border-top-color:#fe1;border-top-width:1.5rem;border-top-style:dashed;border-right-color:#fe2;border-right-width:1.4rem;border-right-style:solid;border-bottom-color:#fe3;border-bottom-width:1.3rem;border-left-color:var(--wp--preset--color--swampy-yellow);border-left-width:0.5rem;border-left-style:dotted;',
|
|
411
460
|
'declarations' => array(
|
|
412
461
|
'border-top-color' => '#fe1',
|
|
413
462
|
'border-top-width' => '1.5rem',
|
|
@@ -450,7 +499,7 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
450
499
|
),
|
|
451
500
|
'options' => array(),
|
|
452
501
|
'expected_output' => array(
|
|
453
|
-
'css' => 'border-bottom-color:
|
|
502
|
+
'css' => 'border-bottom-color:var(--wp--preset--color--terrible-lizard);',
|
|
454
503
|
'declarations' => array(
|
|
455
504
|
'border-bottom-color' => 'var(--wp--preset--color--terrible-lizard)',
|
|
456
505
|
),
|
|
@@ -458,4 +507,152 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
|
|
|
458
507
|
),
|
|
459
508
|
);
|
|
460
509
|
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Tests adding rules to a store and retrieving a generated stylesheet.
|
|
513
|
+
*/
|
|
514
|
+
public function test_enqueue_block_styles_store() {
|
|
515
|
+
$block_styles = array(
|
|
516
|
+
'spacing' => array(
|
|
517
|
+
'padding' => array(
|
|
518
|
+
'top' => '42px',
|
|
519
|
+
'left' => '2%',
|
|
520
|
+
'bottom' => '44px',
|
|
521
|
+
'right' => '5rem',
|
|
522
|
+
),
|
|
523
|
+
),
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
$generated_styles = wp_style_engine_get_styles(
|
|
527
|
+
$block_styles,
|
|
528
|
+
array(
|
|
529
|
+
'enqueue' => true,
|
|
530
|
+
'context' => 'block-supports',
|
|
531
|
+
'selector' => 'article',
|
|
532
|
+
)
|
|
533
|
+
);
|
|
534
|
+
$store = WP_Style_Engine::get_store( 'block-supports' );
|
|
535
|
+
$rule = $store->get_all_rules()['article'];
|
|
536
|
+
$this->assertSame( $generated_styles['css'], $rule->get_css() );
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Tests adding rules to a store and retrieving a generated stylesheet.
|
|
541
|
+
*/
|
|
542
|
+
public function test_add_to_store() {
|
|
543
|
+
$css_rules = array(
|
|
544
|
+
array(
|
|
545
|
+
'selector' => '.frodo',
|
|
546
|
+
'declarations' => array(
|
|
547
|
+
'color' => 'brown',
|
|
548
|
+
'height' => '10px',
|
|
549
|
+
'width' => '30px',
|
|
550
|
+
'border-style' => 'dotted',
|
|
551
|
+
),
|
|
552
|
+
),
|
|
553
|
+
array(
|
|
554
|
+
'selector' => '.samwise',
|
|
555
|
+
'declarations' => array(
|
|
556
|
+
'color' => 'brown',
|
|
557
|
+
'height' => '20px',
|
|
558
|
+
'width' => '50px',
|
|
559
|
+
'border-style' => 'solid',
|
|
560
|
+
),
|
|
561
|
+
),
|
|
562
|
+
);
|
|
563
|
+
$compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules(
|
|
564
|
+
$css_rules,
|
|
565
|
+
array(
|
|
566
|
+
'context' => 'test-store',
|
|
567
|
+
'enqueue' => true,
|
|
568
|
+
)
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
// Check that the style engine knows about the store.
|
|
572
|
+
$stored_store = WP_Style_Engine::get_store( 'test-store' );
|
|
573
|
+
$this->assertInstanceOf( 'WP_Style_Engine_CSS_Rules_Store', $stored_store );
|
|
574
|
+
$this->assertSame( $compiled_stylesheet, WP_Style_Engine::compile_stylesheet_from_css_rules( $stored_store->get_all_rules() ) );
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Tests retrieving a generated stylesheet from any rules.
|
|
579
|
+
*/
|
|
580
|
+
public function test_get_stylesheet_from_css_rules() {
|
|
581
|
+
$css_rules = array(
|
|
582
|
+
array(
|
|
583
|
+
'selector' => '.saruman',
|
|
584
|
+
'declarations' => array(
|
|
585
|
+
'color' => 'white',
|
|
586
|
+
'height' => '100px',
|
|
587
|
+
'border-style' => 'solid',
|
|
588
|
+
'align-self' => 'unset',
|
|
589
|
+
),
|
|
590
|
+
),
|
|
591
|
+
array(
|
|
592
|
+
'selector' => '.gandalf',
|
|
593
|
+
'declarations' => array(
|
|
594
|
+
'color' => 'grey',
|
|
595
|
+
'height' => '90px',
|
|
596
|
+
'border-style' => 'dotted',
|
|
597
|
+
'align-self' => 'safe center',
|
|
598
|
+
),
|
|
599
|
+
),
|
|
600
|
+
array(
|
|
601
|
+
'selector' => '.radagast',
|
|
602
|
+
'declarations' => array(
|
|
603
|
+
'color' => 'brown',
|
|
604
|
+
'height' => '60px',
|
|
605
|
+
'border-style' => 'dashed',
|
|
606
|
+
'align-self' => 'stretch',
|
|
607
|
+
),
|
|
608
|
+
),
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
$compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
|
|
612
|
+
$this->assertSame( '.saruman{color:white;height:100px;border-style:solid;align-self:unset;}.gandalf{color:grey;height:90px;border-style:dotted;align-self:safe center;}.radagast{color:brown;height:60px;border-style:dashed;align-self:stretch;}', $compiled_stylesheet );
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Tests that incoming styles are deduped and merged.
|
|
617
|
+
*/
|
|
618
|
+
public function test_get_deduped_and_merged_stylesheet() {
|
|
619
|
+
$css_rules = array(
|
|
620
|
+
array(
|
|
621
|
+
'selector' => '.gandalf',
|
|
622
|
+
'declarations' => array(
|
|
623
|
+
'color' => 'grey',
|
|
624
|
+
'height' => '90px',
|
|
625
|
+
'border-style' => 'dotted',
|
|
626
|
+
),
|
|
627
|
+
),
|
|
628
|
+
array(
|
|
629
|
+
'selector' => '.gandalf',
|
|
630
|
+
'declarations' => array(
|
|
631
|
+
'color' => 'white',
|
|
632
|
+
'height' => '190px',
|
|
633
|
+
'padding' => '10px',
|
|
634
|
+
'margin-bottom' => '100px',
|
|
635
|
+
),
|
|
636
|
+
),
|
|
637
|
+
array(
|
|
638
|
+
'selector' => '.dumbledore',
|
|
639
|
+
'declarations' => array(
|
|
640
|
+
'color' => 'grey',
|
|
641
|
+
'height' => '90px',
|
|
642
|
+
'border-style' => 'dotted',
|
|
643
|
+
),
|
|
644
|
+
),
|
|
645
|
+
array(
|
|
646
|
+
'selector' => '.rincewind',
|
|
647
|
+
'declarations' => array(
|
|
648
|
+
'color' => 'grey',
|
|
649
|
+
'height' => '90px',
|
|
650
|
+
'border-style' => 'dotted',
|
|
651
|
+
),
|
|
652
|
+
),
|
|
653
|
+
);
|
|
654
|
+
|
|
655
|
+
$compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
|
|
656
|
+
$this->assertSame( '.gandalf{color:white;height:190px;border-style:dotted;padding:10px;margin-bottom:100px;}.dumbledore,.rincewind{color:grey;height:90px;border-style:dotted;}', $compiled_stylesheet );
|
|
657
|
+
}
|
|
461
658
|
}
|
package/build-types/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions, GeneratedCSSRule } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Generates a stylesheet for a given style object and selector.
|
|
7
|
-
*
|
|
8
|
-
* @param style Style object.
|
|
9
|
-
* @param options Options object with settings to adjust how the styles are generated.
|
|
10
|
-
*
|
|
11
|
-
* @return generated stylesheet.
|
|
12
|
-
*/
|
|
13
|
-
export declare function generate(style: Style, options: StyleOptions): string;
|
|
14
|
-
/**
|
|
15
|
-
* Returns a JSON representation of the generated CSS rules.
|
|
16
|
-
*
|
|
17
|
-
* @param style Style object.
|
|
18
|
-
* @param options Options object with settings to adjust how the styles are generated.
|
|
19
|
-
*
|
|
20
|
-
* @return generated styles.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getCSSRules(style: Style, options: StyleOptions): GeneratedCSSRule[];
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EACX,KAAK,EACL,YAAY,EACZ,gBAAgB,EAEhB,MAAM,SAAS,CAAC;AAGjB;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,GAAI,MAAM,CA6BtE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,YAAY,GACnB,gBAAgB,EAAE,CASpB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { GeneratedCSSRule, Style, StyleDefinition, StyleOptions } from '../../types';
|
|
5
|
-
declare const _default: (StyleDefinition | {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => GeneratedCSSRule[];
|
|
8
|
-
})[];
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/border/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAGX,gBAAgB,EAChB,KAAK,EACL,eAAe,EACf,YAAY,EACZ,MAAM,aAAa,CAAC;;;;;AA+HrB,wBAOE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions } from '../../types';
|
|
5
|
-
declare const background: {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => {
|
|
8
|
-
selector: string;
|
|
9
|
-
key: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
export default background;
|
|
14
|
-
//# sourceMappingURL=background.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../src/styles/color/background.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,QAAA,MAAM,UAAU;;sBAEI,KAAK,WAAW,YAAY;;;;;CAQ/C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions } from '../../types';
|
|
5
|
-
declare const gradient: {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => {
|
|
8
|
-
selector: string;
|
|
9
|
-
key: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
export default gradient;
|
|
14
|
-
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../../src/styles/color/gradient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,QAAA,MAAM,QAAQ;;sBAEM,KAAK,WAAW,YAAY;;;;;CAQ/C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
name: string;
|
|
3
|
-
generate: (style: import("../../types").Style, options: import("../../types").StyleOptions) => {
|
|
4
|
-
selector: string;
|
|
5
|
-
key: string;
|
|
6
|
-
value: string;
|
|
7
|
-
}[];
|
|
8
|
-
}[];
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/color/index.ts"],"names":[],"mappings":";;;;;;;;AAOA,wBAA8C"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions } from '../../types';
|
|
5
|
-
declare const text: {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => {
|
|
8
|
-
selector: string;
|
|
9
|
-
key: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
export default text;
|
|
14
|
-
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/styles/color/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,QAAA,MAAM,IAAI;;sBAEU,KAAK,WAAW,YAAY;;;;;CAG/C,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/styles/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,uCAAuC,MAAM,CAAC;AAC3D,eAAO,MAAM,mCAAmC,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB;;;IAK5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/spacing/index.ts"],"names":[],"mappings":";;;;AAMA,wBAAmC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions } from '../../types';
|
|
5
|
-
declare const margin: {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("../../types").GeneratedCSSRule[];
|
|
8
|
-
};
|
|
9
|
-
export default margin;
|
|
10
|
-
//# sourceMappingURL=margin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"margin.d.ts","sourceRoot":"","sources":["../../../src/styles/spacing/margin.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,QAAA,MAAM,MAAM;;sBAEQ,KAAK,WAAW,YAAY;CAM/C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions } from '../../types';
|
|
5
|
-
declare const padding: {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("../../types").GeneratedCSSRule[];
|
|
8
|
-
};
|
|
9
|
-
export default padding;
|
|
10
|
-
//# sourceMappingURL=padding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"padding.d.ts","sourceRoot":"","sources":["../../../src/styles/spacing/padding.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,QAAA,MAAM,OAAO;;sBAEO,KAAK,WAAW,YAAY;CAM/C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Style, StyleOptions } from '../../types';
|
|
5
|
-
declare const _default: {
|
|
6
|
-
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => {
|
|
8
|
-
selector: string;
|
|
9
|
-
key: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}[];
|
|
12
|
-
}[];
|
|
13
|
-
export default _default;
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styles/typography/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;;;;;;;;;AAuFvD,wBAQE"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { CssRulesKeys, GeneratedCSSRule, Style, StyleOptions } from '../types';
|
|
5
|
-
/**
|
|
6
|
-
* Returns a JSON representation of the generated CSS rules.
|
|
7
|
-
*
|
|
8
|
-
* @param style Style object.
|
|
9
|
-
* @param options Options object with settings to adjust how the styles are generated.
|
|
10
|
-
* @param path An array of strings representing the path to the style value in the style object.
|
|
11
|
-
* @param ruleKey A CSS property key.
|
|
12
|
-
*
|
|
13
|
-
* @return GeneratedCSSRule[] CSS rules.
|
|
14
|
-
*/
|
|
15
|
-
export declare function generateRule(style: Style, options: StyleOptions, path: string[], ruleKey: string): {
|
|
16
|
-
selector: string;
|
|
17
|
-
key: string;
|
|
18
|
-
value: string;
|
|
19
|
-
}[];
|
|
20
|
-
/**
|
|
21
|
-
* Returns a JSON representation of the generated CSS rules taking into account box model properties, top, right, bottom, left.
|
|
22
|
-
*
|
|
23
|
-
* @param style Style object.
|
|
24
|
-
* @param options Options object with settings to adjust how the styles are generated.
|
|
25
|
-
* @param path An array of strings representing the path to the style value in the style object.
|
|
26
|
-
* @param ruleKeys An array of CSS property keys and patterns.
|
|
27
|
-
* @param individualProperties The "sides" or individual properties for which to generate rules.
|
|
28
|
-
*
|
|
29
|
-
* @return GeneratedCSSRule[] CSS rules.
|
|
30
|
-
*/
|
|
31
|
-
export declare function generateBoxRules(style: Style, options: StyleOptions, path: string[], ruleKeys: CssRulesKeys, individualProperties?: string[]): GeneratedCSSRule[];
|
|
32
|
-
/**
|
|
33
|
-
* Returns a CSS var value from incoming style value following the pattern `var:description|context|slug`.
|
|
34
|
-
*
|
|
35
|
-
* @param styleValue A raw style value.
|
|
36
|
-
*
|
|
37
|
-
* @return string A CSS var value.
|
|
38
|
-
*/
|
|
39
|
-
export declare function getCSSVarFromStyleValue(styleValue: string): string;
|
|
40
|
-
/**
|
|
41
|
-
* Capitalizes the first letter in a string.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} str The string whose first letter the function will capitalize.
|
|
44
|
-
*
|
|
45
|
-
* @return string A CSS var value.
|
|
46
|
-
*/
|
|
47
|
-
export declare function upperFirst([firstLetter, ...rest]: string): string;
|
|
48
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/styles/utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,KAAK,EAEL,YAAY,EACZ,MAAM,UAAU,CAAC;AAOlB;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,MAAM;;;;IAaf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,YAAY,EACtB,oBAAoB,GAAE,MAAM,EAAyC,GACnE,gBAAgB,EAAE,CAqCpB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAE,UAAU,EAAE,MAAM,GAAI,MAAM,CAYpE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAE,CAAE,WAAW,EAAE,GAAG,IAAI,CAAE,EAAE,MAAM,UAE3D"}
|