create-prisma-php-app 1.26.531 → 1.26.533

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/dist/index.js CHANGED
@@ -126,6 +126,7 @@ async function main() {
126
126
  "npm-run-all",
127
127
  "browser-sync",
128
128
  "@types/browser-sync",
129
+ "@jridgewell/gen-mapping",
129
130
  ];
130
131
  if (answer.swaggerDocs) {
131
132
  dependencies.push("swagger-jsdoc", "@types/swagger-jsdoc");
@@ -22,6 +22,11 @@ class PHPX implements IPHPX
22
22
  */
23
23
  protected string $class;
24
24
 
25
+ /**
26
+ * @var array<string, mixed> The array representation of the HTML attributes.
27
+ */
28
+ protected array $attributesArray = [];
29
+
25
30
  /**
26
31
  * Constructor to initialize the component with the given properties.
27
32
  *
@@ -99,6 +104,7 @@ class PHPX implements IPHPX
99
104
  $attributeStrings[] = "$escapedKey='$escapedValue'";
100
105
  }
101
106
 
107
+ $this->attributesArray = $attributes;
102
108
  return implode(" ", $attributeStrings);
103
109
  }
104
110
 
@@ -37,6 +37,22 @@ class TemplateCompiler
37
37
  self::initializeClassMappings();
38
38
  }
39
39
 
40
+ // Convert template to valid XML
41
+ $dom = self::convertToXml($templateContent);
42
+
43
+ // Process the converted XML
44
+ $root = $dom->documentElement;
45
+ $output = "";
46
+
47
+ foreach ($root->childNodes as $child) {
48
+ $output .= self::processNode($child);
49
+ }
50
+
51
+ return $output;
52
+ }
53
+
54
+ public static function convertToXml(string $templateContent): DOMDocument
55
+ {
40
56
  // Escape `&` characters that are not part of valid XML entities
41
57
  $templateContent = preg_replace('/&(?![a-zA-Z0-9#]+;)/', '&amp;', $templateContent);
42
58
 
@@ -53,13 +69,7 @@ class TemplateCompiler
53
69
  }
54
70
  libxml_clear_errors();
55
71
 
56
- $root = $dom->documentElement;
57
- $output = "";
58
- foreach ($root->childNodes as $child) {
59
- $output .= self::processNode($child);
60
- }
61
-
62
- return $output;
72
+ return $dom;
63
73
  }
64
74
 
65
75
  protected static function getXmlErrors(): array
@@ -166,7 +176,18 @@ class TemplateCompiler
166
176
  $classPath = self::$classMappings[$componentName];
167
177
  // Instantiate the component
168
178
  $componentInstance = new $classPath($attributes);
169
- return $componentInstance->render();
179
+
180
+ // Render the component
181
+ $renderedContent = $componentInstance->render();
182
+
183
+ // Check if the rendered content contains other components
184
+ if (strpos($renderedContent, '<') !== false) {
185
+ // Re-parse the rendered content
186
+ return self::compile($renderedContent);
187
+ }
188
+
189
+ // Return the plain rendered content if no components are detected
190
+ return $renderedContent;
170
191
  } else {
171
192
  // Render as an HTML tag
172
193
  $attributesString = self::renderAttributes($attributes);
@@ -30,15 +30,15 @@ class TwMerge
30
30
  // **Background color classes**
31
31
  "bg" => "/^bg-/",
32
32
 
33
- // **Text size classes**
33
+ // **Text size classes
34
34
  "text-size" => '/^text-(xs|sm|base|lg|xl|[2-9]xl)$/',
35
35
 
36
- // **Text color classes**
37
- "text-color" => '/^text-(?!xs$|sm$|base$|lg$|xl$|[2-9]xl$).+$/',
38
-
39
36
  // **Text alignment classes**
40
37
  "text-alignment" => '/^text-(left|center|right|justify)$/',
41
38
 
39
+ // **Text color classes
40
+ "text-color" => '/^text-(?!xs$|sm$|base$|lg$|xl$|[2-9]xl$).+$/',
41
+
42
42
  // **Text transform classes**
43
43
  "text-transform" =>
44
44
  '/^text-(uppercase|lowercase|capitalize|normal-case)$/',
@@ -71,6 +71,9 @@ class TwMerge
71
71
  // **Opacity classes
72
72
  "opacity" => '/^opacity(-[0-9]+)?$/',
73
73
 
74
+ // **Flexbox alignment classes**
75
+ "justify" => "/^justify-(start|end|center|between|around|evenly)$/",
76
+
74
77
  // **Other utility classes can be added here**
75
78
  ];
76
79
 
@@ -117,6 +120,9 @@ class TwMerge
117
120
  // **Opacity conflict group
118
121
  "opacity" => ["opacity"],
119
122
 
123
+ // **Flexbox alignment conflict group**
124
+ "justify" => ["justify"],
125
+
120
126
  // **Add other conflict groups as needed**
121
127
  ];
122
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.26.531",
3
+ "version": "1.26.533",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",