-
Notifications
You must be signed in to change notification settings - Fork 1
/
ext_sass.hhi
1910 lines (1705 loc) · 57.3 KB
/
ext_sass.hhi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?hh // decl
namespace Sass {
/**
* HHVM bindings to libsass - Fast, native Sass compiling in HHVM!
*
* For a more detailed descriptions of all methods see Sass.hhi
*
* https://github.com/derpapst/sasshhvm
* Based on https://github.com/sensational/sassphp/
*
* Copyright (c) 2015 - 2017 Alexander Papst
*/
class Sass
{
const int STYLE_NESTED = 0;
const int STYLE_EXPANDED = 0;
const int STYLE_COMPACT = 0;
const int STYLE_COMPRESSED = 0;
const int SYNTAX_SCSS = 0;
const int SYNTAX_SASS = 0;
const int SASS2SCSS_PRETTIFY_0 = 0;
const int SASS2SCSS_PRETTIFY_1 = 0;
const int SASS2SCSS_PRETTIFY_2 = 0;
const int SASS2SCSS_PRETTIFY_3 = 0;
const int SASS2SCSS_KEEP_COMMENT = 0;
const int SASS2SCSS_STRIP_COMMENT = 0;
const int SASS2SCSS_CONVERT_COMMENT = 0;
/**
* Complile a scss string to css.
*
* @param $source - String containing valid scss source code.
*
* @throws SassException - If the source contains errors.
*
* @return - The compiled css code.
*/
final public function compile(string $source): string;
/**
* Complile a scss string to css including the corresponding map
* file contents.
*
* @param $source - String containing valid scss source code.
*
* @throws SassException - If the source contains errors.
*
* @return - A shape containing the indexes 'css' which contains the
* compiled css and 'map' which contains the map contents.
*/
final public function compileWithMap(string $source, string $mapFileName): array;
/**
* Compile a file containing scss to css.
* Only local files without the use of a stream or wrapper are supported.
*
* @param $fileName - String containing the path to a scss source code
* file.
*
* @throws SassException - If the file can not be read or source contains
* errors.
*
* @return string - Compiled css code
*/
final public function compileFile(string $fileName): string;
/**
* Compile a file containing scss to css including the corresponding map
* file contents.
* Only local files without the use of a stream or wrapper are supported.
* The content for a matching map file will be returned as well.
*
* @param $fileName - String containing the path to a scss source code
* file.
*
* @throws SassException - If the file can not be read or source contains
* errors.
*
* @return - A shape containing the indexes 'css' which contains the
* compiled css and 'map' which contains the map contents.
*/
final public function compileFileWithMap(
string $fileName,
?string $mapFileName = null
): SassResonse;
/**
* Get the currently used formatting style. Default is Sass::STYLE_NESTED.
*
* @return int
*/
public function getStyle(): int;
/**
* Set the formatting style.
* Available styles are:
* - Sass::STYLE_NESTED (default)
* - Sass::STYLE_EXPANDED
* - Sass::STYLE_COMPACT
* - Sass::STYLE_COMPRESSED
*
* @param int $style
*
* @throws \InvalidArgumentException - If the style is not supported.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setStyle(int $style): this;
/**
* Get the currently used syntax type. Default is Sass::SYNTAX_SCSS.
*
* @return - The currently used syntax type.
*/
public function getSyntax(): int;
/**
* Set the syntax type for the input files/strings.
* Available syntaxes are:
* * Sass::SYNTAX_SCSS (default)
* * Sass::SYNTAX_SASS
*
* @param $syntax - The new syntax type.
*
* @throws \InvalidArgumentException - If the syntax is not supported.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setSyntax(int $syntax): this;
/**
* Gets the currently used include paths where the compiler will search
* for files to include.
*
* @return - A vector containing all additional include paths.
*/
public function getIncludePaths(): ImmVector<string>;
/**
* Add a path for searching for included files.
* Only local directories without the use of a stream or wrapper
* are supported.
*
* @param $includePath - The path to look for further scss files.
*
* @throws \RuntimeException - If the path does not exist or is not
* readable.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function addIncludePath(string $includePath): this;
/**
* Sets the include path list. Any previously set paths will be
* overwritten.
* Only local directories without the use of a stream or wrapper
* are supported.
*
* @param $includePaths - The paths to look for further scss files.
*
* @throws \RuntimeException - If one path does not exist or is not
* readable.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setIncludePaths(Traversable<string> $includePaths): this;
/**
* Get the currently used precision for decimal numbers.
*
* @return - Number of digits of the fractional part.
*/
public function getPrecision(): int;
/**
* Set the precision that will be used for decimal numbers.
*
* @param $precision - Number of digits for the fractional part.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setPrecision(int $precision): this;
/**
* Returns whether the compiled css files will contain comments indicating
* the corresponding source line.
*
* @return - `true` when source line comments will be emitted; `false`
* otherwise.
*/
public function getIncludesSourceComments(): bool;
/**
* Sets whether to enable emitting comments in the generated CSS indicating
* the corresponding source line or not.
*
* @param $sourceComments - Pass `true` to enable emmiting source line
* comments; `false` otherwise.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setIncludesSourceComments(bool $sourceComments): this;
/**
* Alias of self::getIncludesSourceComments()
*/
public function includesSourceComments(): bool;
/**
* Alias of self::includeSourceComments()
*/
final public function includeSourceComments(bool $sourceComments): this;
/**
* Get the string that will be used for line feeds in the compiled CSS.
* If null is returned `libsass`' default will be used.
*
* @return - The currently used line feed string.
*/
public function getLinefeed(): ?string;
/**
* Set the string to be used to for line feeds in the compiled CSS.
* Pass null if you want to use the default from `libsass`.
*
* @param $linefeed - The new line feed string.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setLinefeed(?string $linefeed): this;
/**
* Get the string that will be used for indentation in the compiled CSS.
* If null is returned `libsass`' default will be used.
*
* @return - The currently used indentation string.
*/
public function getIndent(): ?string;
/**
* Set the string to be used to for indentation in the compiled CSS.
* Pass null if you want to use the default from `libsass`.
*
* @param $indent - The new indentation string.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setIndent(?string $indent): this;
/**
* Gets the information whether the the source mapping is embedded in
* the compiled CSS as data uri.
*
* @return - `true` if the source mapping is embedded in the compiled CSS
* as data uri; `false` otherwise
*/
public function getEmbedMap(): bool;
/**
* Control if the source mapping is embedded in the compiled CSS as data
* uri.
*
* @param $embedMap - Whether the source mapping will be embedded or not.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setEmbedMap(bool $embedMap): this;
/**
* Alias of self::getEmbedMap()
*/
public function isMapEmbedded(): bool;
/**
* Alias of self::setEmbedMap()
*/
final public function embedMap(bool $embedMap): this;
/**
* Get the pass-through for the sourceRoot property in source maps.
* If null is returned the sourceRoot property is not populated.
*
* @return - The value for the sourceRoot property.
*/
public function getSourceRoot(): ?string;
/**
* Set the pass-through for the sourceRoot property in source maps.
* Pass null if you do not want to populate the sourceRoot property.
*
* @param - The new value for the sourceRoot property.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setSourceRoot(?string $sourceRoot): this;
/**
* Sass functions are used to define new custom functions callable by Sass
* code. They are also used to overload debug or error statements. You can
* also define a fallback function, which is called for every unknown
* function found in the Sass code. Functions get passed zero or more
* `SassValue`s in an immutable vector and they must also return a
* `SassValue`. Return a `SassError` if you want to signal an error.
*
* Special signatures
* - `*` - Fallback implementation
* - `@warn` - Overload warn statements
* - `@error` - Overload error statements
* - `@debug` - Overload debug statements
*
* Note: The fallback implementation will be given the name of the called
* function as the first argument, before all the original function
* arguments. These features are pretty new and should be considered
* experimental.
*
* @param $signature - The function signature (including required and
* optional parameters).
* @param $fnCallback - The custom function that will be called by
* `libsass`.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function addFunction(
string $signature,
(function (ImmVector<Types\SassValue>): ?Types\SassValue) $fnCallback
): this;
/**
* Remove a custom function based on its signature.
*
* @param $signature - The identifier of the importer to remove.
* If no importer exists with this identifier the
* list of importers remains unchanged.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function removeFunction(string $signature): this;
/**
* List all available custom functions.
*
* @return - The available custom functions.
*/
public function listFunctions(): ImmVector<string>;
/**
* By using custom importers, Sass stylesheets can be implemented in any
* possible way, such as by being loaded via a remote server.
* Imports must be relative to the parent import context and therefore
* this information is passed to the importer callback. This is currently
* done by passing the complete import string/path of the previous import
* context.
*
* You actually have to return a list of imports, since some importers may
* want to import multiple files from one import statement
* (ie. a glob/star importer).
*
* Every import will then be included in `libsass`. You are allowed to only
* return a file path without any loaded source. This way you can ie.
* implement rewrite rules for import paths and leave the loading part for
* `libsass`.
*
* You are also allowed to return `null` instead of a list of `SassImport`
* instances, which will tell `libsass` to pass the import instruction to
* another custom importer or to handle the import by itself (as if no
* custom importer was in use).
*
* @param $identifier - A identifier for the importer.
* @param $fnCallback - The custom importer.
* @param $priority - A priority for the importer (default: 0).
* The higher, the earlier it will be called by
* `libsass`.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function addImporter(
string $identifier,
(function (string, string): ?Traversable<?SassImport>) $fnCallback,
int $priority = 0
): this;
/**
* Remove an importer based on its identifier.
*
* @param $identifier - The identifier of the importer to remove.
* If no importer exists with this identifier the
* list of importers remains unchanged.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function removeImporter(string $identifier): this;
/**
* List all available custom importers and their priority.
* The keys are the identifier, the values their priority.
*
* @return - The available importers.
*/
final public function listImporters(): ImmMap<string, int>;
/**
* Update the priority of an available importer.
*
* @param $identifier - The identifier of the importer of which
* the priority is to be changed.
* @param $priority - The new priority.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setImporterPriority(
string $identifier,
int $priority
): this;
/**
* Add a header to each compile*() run that will be prepended to the sass
* source. As an example headers can be used to define different variables
* that influence the resulting css for different compile runs.
*
* @param $identifier - A identifier for the header.
* @param $content - The content (scss) of the header.
* @param $priority - A priority for the header (default: 0). The higher,
* the earlier it will be processed by `libsass`.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function addHeader(
string $identifier,
string $content,
int $priority = 0
): this;
/**
* Remove a header based on its identifier.
*
* @param $identifier - The identifier of the header to remove.
* If no header exists with this identifier the list
* of headers remains unchanged.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function removeHeader(string $identifier): this;
/**
* List all available headers and their priority.
* The keys are the identifier, the values their priority.
*
* @return - The available headers.
*/
final public function listHeaders(): ImmMap<string, int>;
/**
* Set the priority of an available header.
*
* @param $identifier - The identifier of the header of which
* the priority is to be changed.
* @param $priority - The new priority.
*
* @return - A shallow copy of the current `Sass` instance.
*/
final public function setHeaderPriority(string $identifier, int $priority): this;
/**
* A helper to convert sass to scss.
*
* @param $sass - The sass source code that shall be converted.
* @param $options - Options that influence the formatting of the resulting scss
* and the handling of comments.
* The options can be combined using the bitwise OR operator.
* Available options for formatting:
* - Sass::SASS2SCSS_PRETTIFY_0
* - Sass::SASS2SCSS_PRETTIFY_1
* - Sass::SASS2SCSS_PRETTIFY_2
* - Sass::SASS2SCSS_PRETTIFY_3
* Available options for comment handling:
* - Sass::SASS2SCSS_KEEP_COMMENT
* - Sass::SASS2SCSS_STRIP_COMMENT
* - Sass::SASS2SCSS_CONVERT_COMMENT
*
* @return - The converted scss source
*/
final public static function sass2scss(string $sass, int $options = 2): string;
/**
* Get the library version of `libsass`.
*
* @return - The library version of `libsass`.
*/
final public static function getLibraryVersion(): string;
/**
* Get the version of the sass specification `libsass` implements.
*
* @return - The language version that `libsass` implements.
*/
final public static function getLanguageVersion(): string;
/**
* Get the version of the `sass2scss` utility `libsass` ships with.
*
* @return - The version of `sass2scss`.
*/
final public static function getSass2ScssVersion(): string;
}
/**
* Return type for Sass::compile*WithMap();
*/
type SassResonse = shape('css' => string, 'map' => string);
/**
* Exception for Sass that includes additional information
* about the location that caused the compilation error.
*/
class SassException extends \Exception
{
/**
* Create a new instance of SassException.
*
* @param $message - The short version of the error message
* @param $code - The error code
* @param $sourceFile - The path to the scss file that caused the error.
* @param $sourceLine - The line in the scss source that caused the error.
* @param $sourceColumn - The column in the scss source that caused the error.
* @param $formattedMessage - The complete error message including a
* backtrace from `libsass` showing the exact
* position that caused the error.
* @param $previous - A previously thrown exception that caused the error.
*/
public function __construct(
?string $message = null,
int $code = 0,
?string $sourceFile = null,
?int $sourceLine = null,
?int $sourceColumn = null,
?string $formattedMessage = null,
?\Exception $previous = null
);
/**
* Get the path to the file that caused the compilation error.
*
* @return - The path to the source file.
*/
public function getSourceFile(): ?string;
/**
* Get the line in the file that caused the compilation error.
*
* @return - The number of the line that caused the error.
*/
public function getSourceLine(): ?int;
/**
* Get the column in the file that caused the compilation error.
*
* @return - The number of the column that caused the error.
*/
public function getSourceColumn(): ?int;
/**
* Get the complete formatted message that shows the exact position
* of the compilation error.
*
* @return - The complete formatted error message.
*/
public function getFormattedMessage(): ?string;
/**
* Format the exception as a string for display.
*
* @return - This exception as a string.
*/
public function __toString(): string;
}
/**
* Represents a container for a single custom import.
* It can hold the filename, the scss source string and a map definition.
*/
class SassImport {
/**
* Set the path of the file to import.
* If no scss source is provided libsass will load this file.
* Make sure the file exists and is readable. Relative paths are
* supported.
* If no path is provided but a scss source is a fake pathname
* will be generated.
*
* @param $path - The path to the scss file.
*
* @return - A shallow copy of the current `SassImport`.
*/
public function setPath(string $path): this;
/**
* Get the path of the file that will be imported.
*
* @return - The path of the scss file.
*/
public function getPath(): string;
/**
* Set the scss source.
* If an empty string is provided and a file path is
* specified the file will not be loaded. To make sure the
* file will be loaded set the source to `null`.
*
* @param $source - The scss source or `null` to make libsass
* load a file.
*
* @return - A shallow copy of the current `SassImport`.
*/
public function setSource(?string $source): this;
/**
* Get the scss source that will be imported and compiled.
*
* @return - The scss source.
*/
public function getSource(): ?string;
/**
* Set the source map for the import.
* It will be used to re-map the actual sourcemap with the provided ones.
* The map has to be a valid json string.
*
* NOTE: The source map will be passed to libsass, but libsass
* currently does not do anything with it yet.
*
* @param $map - The source map or `null`.
*
* @return - A shallow copy of the current `SassImport`.
*/
public function setSrcMap(?string $map): this;
/**
* Get the source map that will be imported and used to re-map
* the actual sourcemap.
*
* NOTE: See the note in the description of `setSrcMap()`.
*
* @return - The source map.
*/
public function getSrcMap(): ?string;
}
}
namespace Sass\Types {
/**
* The base class for all `SassValue`s.
*/
abstract class SassValue
{
const int OP_AND = 0;
const int OP_OR = 0;
const int OP_EQ = 0;
const int OP_NEQ = 0;
const int OP_GT = 0;
const int OP_GTE = 0;
const int OP_LT = 0;
const int OP_LTE = 0;
const int OP_ADD = 0;
const int OP_SUB = 0;
const int OP_MUL = 0;
const int OP_DIV = 0;
const int OP_MOD = 0;
/**
* Check if this `SassValue` equals another `SassValue`.
*
* @param $value - The `SassValue` to compare with.
*
* @return - `true` when it matches, `false` otherwise.
*/
abstract public function equals(SassValue $value): bool;
/**
* Execute sass operations with two `SassValue`s.
* Throws a `RuntimeException` if the operation fails.
*
* @param $operator - The operator. Use one of the `SassValue::OP_*` constants.
* @param $rh - The right hand `SassValue` to perform the operation with.
*
* @return - The new resulting `SassValue`.
*/
final public function operate(int $operator, SassValue $rh): SassValue;
/**
* Return a string representation of this `SassValue`.
*
* @return string
*/
abstract public function __toString(): string;
/**
* A helper method to convert the most common scalars
* to `SassValue` instances.
* If the conversion fails an exception is thrown.
*
* @param $value - The value to convert
*
* @return - The wrapped value as `SassValue` instance.
*/
final public static function cs(mixed $value): SassValue;
}
/**
* Defines methods needed for validating `SassValue`s.
*/
interface SassNeedsValidation
{
/**
* Check if the `SassValue` implementing this interface is valid.
*
* @param $seen - A list with all visited elements
*
* @return bool
*/
public function isValid(Vector<SassValue> $seen = Vector {}): bool;
}
/**
* A wrapper for null.
*/
class SassNull extends SassValue
{
/**
* Check if this `SassNull` equals another `SassNull`.
*
* @param $value - The `SassNull` to compare with.
*
* @return - `true` when it matches, `false` otherwise.
*/
final public function equals(SassValue $value): bool;
/**
* Return a string representation of this `SassNull`.
*
* @return string
*/
public function __toString(): string;
}
/**
* A wrapper for numeric values.
*/
class SassNumber extends SassValue
{
/**
* Get the value of the number.
*
* @return - The value.
*/
final public function getValue(): num;
/**
* Set the value of the number.
*
* @param $unit - The new unit.
* @param $unit - The new unit (optional).
*
* @return - A shallow copy of the current `SassNumber`.
*/
final public function setValue(num $value, ?string $unit = null): this;
/**
* Get the unit of the number.
*
* @return - The unit.
*/
final public function getUnit(): string;
/**
* Set the unit of the number.
*
* @param $unit - The new unit.
*
* @return - A shallow copy of the current `SassNumber`.
*/
final public function setUnit(string $unit): this;
/**
* Check if this `SassNumber` equals another `SassNumber`.
*
* @param $value - The `SassNumber` to compare with.
*
* @return - `true` when it matches, `false` otherwise.
*/
final public function equals(SassValue $value): bool;
/**
* Return a string representation of this `SassNumber`.
*
* @return string
*/
public function __toString(): string;
}
/**
* A wrapper for string values.
*/
class SassString extends SassValue
{
/**
* Get the wrapped string.
*
* @return - The wrapped string.
*/
final public function getValue(): string;
/**
* Set the wrapped string.
*
* @param $value - The new string.
*
* @return - A shallow copy of the current `SassString`.
*/
final public function setValue(string $value): this;
/**
* Returns whether the string is quoted or not.
*
* @return - `true` if the string is quoted,
* `false` otherwise.
*/
final public function isQuoted(): bool;
/**
* Unquote the string.
*
* @return - A shallow copy of the current `SassString`.
*/
public function quote(): this;
/**
* Quote the string.
*
* @return - A shallow copy of the current `SassString`.
*/
public function unquote(): this;
/**
* Check if this string needs quotes (eg. not starting with a letter or
* containing spaces).
*
* @return - `true` when spaces are needed; `false` otherwise.
*/
public function needsQuotes(): bool;
/**
* Quote the string only if it is necessary.
*
* @return - A shallow copy of the current `SassString`.
*/
public function autoQuote(): this;
/**
* Check if this `SassString` equals another `SassString`.
*
* @param $value - The `SassString` to compare with.
*
* @return - `true` when it matches, `false` otherwise.
*/
final public function equals(SassValue $value): bool;
/**
* Return a string representation of this `SassString`.
*
* @return string
*/
public function __toString(): string;
}
/**
* A wrapper for boolean values.
*/
class SassBoolean extends SassValue
{
/**
* Get the wrapped boolean.
*
* @return - The boolean value of this object.
*/
final public function getValue(): bool;
/**
* Set the wrapped boolean.
*
* @param $value - The new boolean value.
*
* @return - A shallow copy of the current `SassBoolean`.
*/
final public function setValue(bool $value): this;
/**
* Check if this `SassBoolean` equals another `SassBoolean`.
*
* @param $value - The `SassBoolean` to compare with.
*
* @return - `true` when it matches, `false` otherwise.
*/
final public function equals(SassValue $value): bool;
/**
* Return a string representation of this `SassBoolean`.
*
* @return string
*/
public function __toString(): string;
}
/**
* A shape to hold a RGB color representation
*/
type SassColorRGB = shape('r' => int, 'g' => int, 'b' => int);
/**
* A shape to hold a HSL color representation
*/
type SassColorHSL = shape('h' => float, 's' => float, 'l' => float);
/**
* A color representation. The color is handled in the RGB colorspace
* internally. Helper methods for working with the HSL colorspace
* are available.
*/
class SassColor extends SassValue
{
/**
* Set the alpha channel's value of this color
*
* @param $alpha - The value of the alpha channel
* (value in the range of 0 to 1, optional).
*
* @return - A shallow copy of the current `SassColor`.
*/
final public function setAlpha(float $a): this;
/**
* Get the alpha channel's value of this color.
*
* @return - The value of the alpha channel.
*/
final public function getAlpha(): float;
/**
* Set this colors properties by providing color information
* as RGB representation.
*
* @param $r - The red color value as int between 0 and 255.
* @param $g - The green color value as int between 0 and 255.
* @param $b - The blue color value as int between 0 and 255.
* @param $alpha - The value of the alpha channel
* (value in the range of 0 to 1, optional).
*
* @return - A shallow copy of the current `SassColor`.
*/
final public function setRGB(
int $r,
int $g,
int $b,
?float $alpha = null
): this;
/**
* Set this colors properties by providing a shape containing
* color information as RGB representation.
*
* @param $c - A RGB representation
* @param $alpha - The value of the alpha channel
* (value in the range of 0 to 1, optional).
*
* @return - A shallow copy of the current `SassColor`.
*/
final public function setRGBFromShape(
SassColorRGB $c,
?float $alpha = null
): this;
/**
* Returns the current color as RGB representation.
*
* @return - The RGB representation as shape.