@vituum/vite-plugin-latte 1.2.0 → 1.3.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.
Files changed (61) hide show
  1. package/package.json +6 -6
  2. package/vendor/autoload.php +1 -1
  3. package/vendor/composer/autoload_classmap.php +49 -0
  4. package/vendor/composer/autoload_real.php +4 -4
  5. package/vendor/composer/autoload_static.php +51 -2
  6. package/vendor/composer/installed.json +102 -12
  7. package/vendor/composer/installed.php +14 -5
  8. package/vendor/latte/latte/composer.json +6 -5
  9. package/vendor/latte/latte/readme.md +27 -9
  10. package/vendor/latte/latte/src/Bridges/Tracy/templates/LattePanel.panel.phtml +4 -1
  11. package/vendor/latte/latte/src/Latte/Compiler/TagLexer.php +1 -1
  12. package/vendor/latte/latte/src/Latte/Compiler/TagParserData.php +129 -129
  13. package/vendor/latte/latte/src/Latte/Compiler/TemplateGenerator.php +1 -1
  14. package/vendor/latte/latte/src/Latte/Compiler/TemplateParser.php +1 -1
  15. package/vendor/latte/latte/src/Latte/Engine.php +22 -2
  16. package/vendor/latte/latte/src/Latte/Essential/CachingIterator.php +2 -3
  17. package/vendor/latte/latte/src/Latte/Essential/CoreExtension.php +9 -1
  18. package/vendor/latte/latte/src/Latte/Essential/Filters.php +110 -10
  19. package/vendor/latte/latte/src/Latte/Essential/Nodes/ImportNode.php +8 -2
  20. package/vendor/latte/latte/src/Latte/Essential/Nodes/VarNode.php +14 -18
  21. package/vendor/latte/latte/src/Latte/Essential/TranslatorExtension.php +1 -1
  22. package/vendor/latte/latte/src/Latte/Loaders/FileLoader.php +5 -4
  23. package/vendor/latte/latte/src/Latte/Runtime/Template.php +1 -1
  24. package/vendor/latte/latte/src/Latte/Sandbox/Nodes/FunctionCallNode.php +0 -1
  25. package/vendor/nette/utils/.phpstorm.meta.php +13 -0
  26. package/vendor/nette/utils/composer.json +51 -0
  27. package/vendor/nette/utils/license.md +60 -0
  28. package/vendor/nette/utils/readme.md +55 -0
  29. package/vendor/nette/utils/src/HtmlStringable.php +22 -0
  30. package/vendor/nette/utils/src/Iterators/CachingIterator.php +150 -0
  31. package/vendor/nette/utils/src/Iterators/Mapper.php +33 -0
  32. package/vendor/nette/utils/src/SmartObject.php +140 -0
  33. package/vendor/nette/utils/src/StaticClass.php +34 -0
  34. package/vendor/nette/utils/src/Translator.php +25 -0
  35. package/vendor/nette/utils/src/Utils/ArrayHash.php +106 -0
  36. package/vendor/nette/utils/src/Utils/ArrayList.php +136 -0
  37. package/vendor/nette/utils/src/Utils/Arrays.php +553 -0
  38. package/vendor/nette/utils/src/Utils/Callback.php +137 -0
  39. package/vendor/nette/utils/src/Utils/DateTime.php +140 -0
  40. package/vendor/nette/utils/src/Utils/FileInfo.php +69 -0
  41. package/vendor/nette/utils/src/Utils/FileSystem.php +326 -0
  42. package/vendor/nette/utils/src/Utils/Finder.php +510 -0
  43. package/vendor/nette/utils/src/Utils/Floats.php +107 -0
  44. package/vendor/nette/utils/src/Utils/Helpers.php +104 -0
  45. package/vendor/nette/utils/src/Utils/Html.php +839 -0
  46. package/vendor/nette/utils/src/Utils/Image.php +831 -0
  47. package/vendor/nette/utils/src/Utils/ImageColor.php +75 -0
  48. package/vendor/nette/utils/src/Utils/ImageType.php +25 -0
  49. package/vendor/nette/utils/src/Utils/Iterables.php +238 -0
  50. package/vendor/nette/utils/src/Utils/Json.php +84 -0
  51. package/vendor/nette/utils/src/Utils/ObjectHelpers.php +229 -0
  52. package/vendor/nette/utils/src/Utils/Paginator.php +245 -0
  53. package/vendor/nette/utils/src/Utils/Random.php +52 -0
  54. package/vendor/nette/utils/src/Utils/Reflection.php +322 -0
  55. package/vendor/nette/utils/src/Utils/ReflectionMethod.php +36 -0
  56. package/vendor/nette/utils/src/Utils/Strings.php +728 -0
  57. package/vendor/nette/utils/src/Utils/Type.php +267 -0
  58. package/vendor/nette/utils/src/Utils/Validators.php +416 -0
  59. package/vendor/nette/utils/src/Utils/exceptions.php +50 -0
  60. package/vendor/nette/utils/src/compatibility.php +32 -0
  61. package/vendor/nette/utils/src/exceptions.php +109 -0
@@ -0,0 +1,33 @@
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Nette Framework (https://nette.org)
5
+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace Nette\Iterators;
11
+
12
+
13
+ /**
14
+ * @deprecated use Nette\Utils\Iterables::map()
15
+ */
16
+ class Mapper extends \IteratorIterator
17
+ {
18
+ /** @var callable */
19
+ private $callback;
20
+
21
+
22
+ public function __construct(\Traversable $iterator, callable $callback)
23
+ {
24
+ parent::__construct($iterator);
25
+ $this->callback = $callback;
26
+ }
27
+
28
+
29
+ public function current(): mixed
30
+ {
31
+ return ($this->callback)(parent::current(), parent::key());
32
+ }
33
+ }
@@ -0,0 +1,140 @@
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Nette Framework (https://nette.org)
5
+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace Nette;
11
+
12
+ use Nette\Utils\ObjectHelpers;
13
+
14
+
15
+ /**
16
+ * Strict class for better experience.
17
+ * - 'did you mean' hints
18
+ * - access to undeclared members throws exceptions
19
+ * - support for @property annotations
20
+ * - support for calling event handlers stored in $onEvent via onEvent()
21
+ */
22
+ trait SmartObject
23
+ {
24
+ /**
25
+ * @return mixed
26
+ * @throws MemberAccessException
27
+ */
28
+ public function __call(string $name, array $args)
29
+ {
30
+ $class = static::class;
31
+
32
+ if (ObjectHelpers::hasProperty($class, $name) === 'event') { // calling event handlers
33
+ $handlers = $this->$name ?? null;
34
+ if (is_iterable($handlers)) {
35
+ foreach ($handlers as $handler) {
36
+ $handler(...$args);
37
+ }
38
+ } elseif ($handlers !== null) {
39
+ throw new UnexpectedValueException("Property $class::$$name must be iterable or null, " . get_debug_type($handlers) . ' given.');
40
+ }
41
+
42
+ return null;
43
+ }
44
+
45
+ ObjectHelpers::strictCall($class, $name);
46
+ }
47
+
48
+
49
+ /**
50
+ * @throws MemberAccessException
51
+ */
52
+ public static function __callStatic(string $name, array $args)
53
+ {
54
+ ObjectHelpers::strictStaticCall(static::class, $name);
55
+ }
56
+
57
+
58
+ /**
59
+ * @return mixed
60
+ * @throws MemberAccessException if the property is not defined.
61
+ */
62
+ public function &__get(string $name)
63
+ {
64
+ $class = static::class;
65
+
66
+ if ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property getter
67
+ if (!($prop & 0b0001)) {
68
+ throw new MemberAccessException("Cannot read a write-only property $class::\$$name.");
69
+ }
70
+
71
+ $m = ($prop & 0b0010 ? 'get' : 'is') . ucfirst($name);
72
+ if ($prop & 0b10000) {
73
+ $trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call()
74
+ $loc = isset($trace['file'], $trace['line'])
75
+ ? " in $trace[file] on line $trace[line]"
76
+ : '';
77
+ trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED);
78
+ }
79
+
80
+ if ($prop & 0b0100) { // return by reference
81
+ return $this->$m();
82
+ } else {
83
+ $val = $this->$m();
84
+ return $val;
85
+ }
86
+ } else {
87
+ ObjectHelpers::strictGet($class, $name);
88
+ }
89
+ }
90
+
91
+
92
+ /**
93
+ * @throws MemberAccessException if the property is not defined or is read-only
94
+ */
95
+ public function __set(string $name, mixed $value): void
96
+ {
97
+ $class = static::class;
98
+
99
+ if (ObjectHelpers::hasProperty($class, $name)) { // unsetted property
100
+ $this->$name = $value;
101
+
102
+ } elseif ($prop = ObjectHelpers::getMagicProperties($class)[$name] ?? null) { // property setter
103
+ if (!($prop & 0b1000)) {
104
+ throw new MemberAccessException("Cannot write to a read-only property $class::\$$name.");
105
+ }
106
+
107
+ $m = 'set' . ucfirst($name);
108
+ if ($prop & 0b10000) {
109
+ $trace = debug_backtrace(0, 1)[0]; // suppose this method is called from __call()
110
+ $loc = isset($trace['file'], $trace['line'])
111
+ ? " in $trace[file] on line $trace[line]"
112
+ : '';
113
+ trigger_error("Property $class::\$$name is deprecated, use $class::$m() method$loc.", E_USER_DEPRECATED);
114
+ }
115
+
116
+ $this->$m($value);
117
+
118
+ } else {
119
+ ObjectHelpers::strictSet($class, $name);
120
+ }
121
+ }
122
+
123
+
124
+ /**
125
+ * @throws MemberAccessException
126
+ */
127
+ public function __unset(string $name): void
128
+ {
129
+ $class = static::class;
130
+ if (!ObjectHelpers::hasProperty($class, $name)) {
131
+ throw new MemberAccessException("Cannot unset the property $class::\$$name.");
132
+ }
133
+ }
134
+
135
+
136
+ public function __isset(string $name): bool
137
+ {
138
+ return isset(ObjectHelpers::getMagicProperties(static::class)[$name]);
139
+ }
140
+ }
@@ -0,0 +1,34 @@
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Nette Framework (https://nette.org)
5
+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace Nette;
11
+
12
+
13
+ /**
14
+ * Static class.
15
+ */
16
+ trait StaticClass
17
+ {
18
+ /**
19
+ * Class is static and cannot be instantiated.
20
+ */
21
+ private function __construct()
22
+ {
23
+ }
24
+
25
+
26
+ /**
27
+ * Call to undefined static method.
28
+ * @throws MemberAccessException
29
+ */
30
+ public static function __callStatic(string $name, array $args): mixed
31
+ {
32
+ Utils\ObjectHelpers::strictStaticCall(static::class, $name);
33
+ }
34
+ }
@@ -0,0 +1,25 @@
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Nette Framework (https://nette.org)
5
+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace Nette\Localization;
11
+
12
+
13
+ /**
14
+ * Translator adapter.
15
+ */
16
+ interface Translator
17
+ {
18
+ /**
19
+ * Translates the given string.
20
+ */
21
+ function translate(string|\Stringable $message, mixed ...$parameters): string|\Stringable;
22
+ }
23
+
24
+
25
+ interface_exists(ITranslator::class);
@@ -0,0 +1,106 @@
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Nette Framework (https://nette.org)
5
+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace Nette\Utils;
11
+
12
+ use Nette;
13
+
14
+
15
+ /**
16
+ * Provides objects to work as array.
17
+ * @template T
18
+ * @implements \IteratorAggregate<array-key, T>
19
+ * @implements \ArrayAccess<array-key, T>
20
+ */
21
+ class ArrayHash extends \stdClass implements \ArrayAccess, \Countable, \IteratorAggregate
22
+ {
23
+ /**
24
+ * Transforms array to ArrayHash.
25
+ * @param array<T> $array
26
+ */
27
+ public static function from(array $array, bool $recursive = true): static
28
+ {
29
+ $obj = new static;
30
+ foreach ($array as $key => $value) {
31
+ $obj->$key = $recursive && is_array($value)
32
+ ? static::from($value)
33
+ : $value;
34
+ }
35
+
36
+ return $obj;
37
+ }
38
+
39
+
40
+ /**
41
+ * Returns an iterator over all items.
42
+ * @return \Iterator<array-key, T>
43
+ */
44
+ public function &getIterator(): \Iterator
45
+ {
46
+ foreach ((array) $this as $key => $foo) {
47
+ yield $key => $this->$key;
48
+ }
49
+ }
50
+
51
+
52
+ /**
53
+ * Returns items count.
54
+ */
55
+ public function count(): int
56
+ {
57
+ return count((array) $this);
58
+ }
59
+
60
+
61
+ /**
62
+ * Replaces or appends a item.
63
+ * @param array-key $key
64
+ * @param T $value
65
+ */
66
+ public function offsetSet($key, $value): void
67
+ {
68
+ if (!is_scalar($key)) { // prevents null
69
+ throw new Nette\InvalidArgumentException(sprintf('Key must be either a string or an integer, %s given.', get_debug_type($key)));
70
+ }
71
+
72
+ $this->$key = $value;
73
+ }
74
+
75
+
76
+ /**
77
+ * Returns a item.
78
+ * @param array-key $key
79
+ * @return T
80
+ */
81
+ #[\ReturnTypeWillChange]
82
+ public function offsetGet($key)
83
+ {
84
+ return $this->$key;
85
+ }
86
+
87
+
88
+ /**
89
+ * Determines whether a item exists.
90
+ * @param array-key $key
91
+ */
92
+ public function offsetExists($key): bool
93
+ {
94
+ return isset($this->$key);
95
+ }
96
+
97
+
98
+ /**
99
+ * Removes the element from this list.
100
+ * @param array-key $key
101
+ */
102
+ public function offsetUnset($key): void
103
+ {
104
+ unset($this->$key);
105
+ }
106
+ }
@@ -0,0 +1,136 @@
1
+ <?php
2
+
3
+ /**
4
+ * This file is part of the Nette Framework (https://nette.org)
5
+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
+ */
7
+
8
+ declare(strict_types=1);
9
+
10
+ namespace Nette\Utils;
11
+
12
+ use Nette;
13
+
14
+
15
+ /**
16
+ * Provides the base class for a generic list (items can be accessed by index).
17
+ * @template T
18
+ * @implements \IteratorAggregate<int, T>
19
+ * @implements \ArrayAccess<int, T>
20
+ */
21
+ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
22
+ {
23
+ use Nette\SmartObject;
24
+
25
+ private array $list = [];
26
+
27
+
28
+ /**
29
+ * Transforms array to ArrayList.
30
+ * @param list<T> $array
31
+ */
32
+ public static function from(array $array): static
33
+ {
34
+ if (!Arrays::isList($array)) {
35
+ throw new Nette\InvalidArgumentException('Array is not valid list.');
36
+ }
37
+
38
+ $obj = new static;
39
+ $obj->list = $array;
40
+ return $obj;
41
+ }
42
+
43
+
44
+ /**
45
+ * Returns an iterator over all items.
46
+ * @return \Iterator<int, T>
47
+ */
48
+ public function &getIterator(): \Iterator
49
+ {
50
+ foreach ($this->list as &$item) {
51
+ yield $item;
52
+ }
53
+ }
54
+
55
+
56
+ /**
57
+ * Returns items count.
58
+ */
59
+ public function count(): int
60
+ {
61
+ return count($this->list);
62
+ }
63
+
64
+
65
+ /**
66
+ * Replaces or appends a item.
67
+ * @param int|null $index
68
+ * @param T $value
69
+ * @throws Nette\OutOfRangeException
70
+ */
71
+ public function offsetSet($index, $value): void
72
+ {
73
+ if ($index === null) {
74
+ $this->list[] = $value;
75
+
76
+ } elseif (!is_int($index) || $index < 0 || $index >= count($this->list)) {
77
+ throw new Nette\OutOfRangeException('Offset invalid or out of range');
78
+
79
+ } else {
80
+ $this->list[$index] = $value;
81
+ }
82
+ }
83
+
84
+
85
+ /**
86
+ * Returns a item.
87
+ * @param int $index
88
+ * @return T
89
+ * @throws Nette\OutOfRangeException
90
+ */
91
+ public function offsetGet($index): mixed
92
+ {
93
+ if (!is_int($index) || $index < 0 || $index >= count($this->list)) {
94
+ throw new Nette\OutOfRangeException('Offset invalid or out of range');
95
+ }
96
+
97
+ return $this->list[$index];
98
+ }
99
+
100
+
101
+ /**
102
+ * Determines whether a item exists.
103
+ * @param int $index
104
+ */
105
+ public function offsetExists($index): bool
106
+ {
107
+ return is_int($index) && $index >= 0 && $index < count($this->list);
108
+ }
109
+
110
+
111
+ /**
112
+ * Removes the element at the specified position in this list.
113
+ * @param int $index
114
+ * @throws Nette\OutOfRangeException
115
+ */
116
+ public function offsetUnset($index): void
117
+ {
118
+ if (!is_int($index) || $index < 0 || $index >= count($this->list)) {
119
+ throw new Nette\OutOfRangeException('Offset invalid or out of range');
120
+ }
121
+
122
+ array_splice($this->list, $index, 1);
123
+ }
124
+
125
+
126
+ /**
127
+ * Prepends a item.
128
+ * @param T $value
129
+ */
130
+ public function prepend(mixed $value): void
131
+ {
132
+ $first = array_slice($this->list, 0, 1);
133
+ $this->offsetSet(0, $value);
134
+ array_splice($this->list, 1, 0, $first);
135
+ }
136
+ }