create-prisma-php-app 5.1.0-alpha.1 → 5.1.0-alpha.3
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/.github/copilot-instructions.md +5 -3
- package/dist/AGENTS.md +14 -7
- package/dist/public/js/main.js +1 -0
- package/dist/ts/main.ts +23 -2
- package/package.json +1 -1
|
@@ -100,10 +100,12 @@
|
|
|
100
100
|
|
|
101
101
|
## Route File Conventions
|
|
102
102
|
|
|
103
|
-
- For PulsePoint-aware `index.php` and nested `layout.php`, keep file order as PHP first, then one parent HTML element
|
|
104
|
-
- `index.php` and nested `layout.php` must render a single parent HTML element. Treat that root like a
|
|
103
|
+
- For PulsePoint-aware `index.php` and nested `layout.php`, keep file order as PHP first, then one parent HTML element as the route boundary, then the visible route content inside that boundary, and keep the PulsePoint `<script>` as the last child of that boundary root.
|
|
104
|
+
- `index.php` and nested `layout.php` must render a single parent HTML element. Treat that root like a component boundary rather than loose sibling markup.
|
|
105
|
+
- If the visible page or layout content should stay inside a semantic element such as `<main>`, `<section>`, or `<article>`, wrap it in a neutral parent such as `<div>` so the route boundary can still own the `<script>`.
|
|
105
106
|
- For pages and nested layouts, author a plain single root element and let Prisma PHP inject the PulsePoint `pp-component` scope automatically.
|
|
106
|
-
- Author plain `<script>` tags inside that root when PulsePoint is needed. Put the PulsePoint code at the top level of that script. Do not manually add `type="text/pp"`, `DOMContentLoaded` wrappers, IIFEs, or manual bootstrap code; Prisma PHP normalizes the script contract for the runtime.
|
|
107
|
+
- Author plain `<script>` tags inside that boundary root when PulsePoint is needed, usually as a sibling of the visible content container instead of nesting the script inside the semantic content element by default. Put the PulsePoint code at the top level of that script. Do not manually add `type="text/pp"`, `DOMContentLoaded` wrappers, IIFEs, or manual bootstrap code; Prisma PHP normalizes the script contract for the runtime.
|
|
108
|
+
- Do not leave the route `<script>` outside the route boundary.
|
|
107
109
|
- Only the root `layout.php` should define `<html>`, `<head>`, and `<body>`. When PulsePoint is present, keep `MainLayout::$children;` and any `<script>` inside one clear wrapper.
|
|
108
110
|
|
|
109
111
|
## Component Boundary Rules
|
package/dist/AGENTS.md
CHANGED
|
@@ -354,15 +354,19 @@ There are two related structure rules, and AI must not mix their responsibilitie
|
|
|
354
354
|
Use this pattern:
|
|
355
355
|
|
|
356
356
|
1. PHP first
|
|
357
|
-
2. one parent HTML element
|
|
358
|
-
3.
|
|
359
|
-
4.
|
|
357
|
+
2. one parent HTML element as the route boundary
|
|
358
|
+
3. place the visible page or layout content inside that boundary
|
|
359
|
+
4. when PulsePoint is present, let Prisma PHP inject the route or layout `pp-component` scope on that root automatically
|
|
360
|
+
5. keep one `<script>` block as the last child of that boundary root
|
|
360
361
|
|
|
361
362
|
Also follow these route-file rules:
|
|
362
363
|
|
|
363
364
|
- `index.php` and nested `layout.php` must render a single parent HTML element
|
|
365
|
+
- use that single parent element as the route boundary; if the visible content should stay inside a semantic element such as `<main>`, `<section>`, or `<article>`, wrap it in a neutral parent such as `<div>`
|
|
364
366
|
- for normal pages and nested layouts, do **not** manually author `pp-component` on that root; Prisma PHP adds it automatically
|
|
365
367
|
- author a plain `<script>` tag inside that root when PulsePoint logic is needed and do **not** add `type="text/pp"` manually
|
|
368
|
+
- keep the `<script>` as the last child of the route boundary, usually as a sibling of the visible content container instead of nesting it inside the semantic content element by default
|
|
369
|
+
- do **not** leave the `<script>` outside the route boundary
|
|
366
370
|
- write PulsePoint state, derived values, and functions directly at the top level of that script; do **not** wrap them in `DOMContentLoaded`, an IIFE, manual `pp.mount()` calls, or custom scoping helpers
|
|
367
371
|
- only the root `layout.php` should define `<html>`, `<head>`, and `<body>`
|
|
368
372
|
- when PulsePoint is present in a root `layout.php`, keep `MainLayout::$children` and any `<script>` inside one clear wrapper
|
|
@@ -378,13 +382,16 @@ MainLayout::$title = 'Todos';
|
|
|
378
382
|
MainLayout::$description = 'Track tasks and view the current item count.';
|
|
379
383
|
?>
|
|
380
384
|
|
|
381
|
-
<
|
|
382
|
-
<
|
|
383
|
-
|
|
385
|
+
<div>
|
|
386
|
+
<section>
|
|
387
|
+
<h1>Todos</h1>
|
|
388
|
+
<p>Count: {count}</p>
|
|
389
|
+
</section>
|
|
390
|
+
|
|
384
391
|
<script>
|
|
385
392
|
const [count, setCount] = pp.state(0);
|
|
386
393
|
</script>
|
|
387
|
-
</
|
|
394
|
+
</div>
|
|
388
395
|
```
|
|
389
396
|
|
|
390
397
|
### Imported partials rendered with `ImportComponent::render(...)`
|
package/dist/public/js/main.js
CHANGED
package/dist/ts/main.ts
CHANGED
|
@@ -2,5 +2,26 @@ import "/js/pp-reactive-v2.js";
|
|
|
2
2
|
|
|
3
3
|
// The following global names have already been declared elsewhere in the project:
|
|
4
4
|
// - pp: Used for the Reactive Core functionality.
|
|
5
|
-
|
|
6
|
-
//
|
|
5
|
+
|
|
6
|
+
// Imports goes here --Start
|
|
7
|
+
|
|
8
|
+
// Uncomment the following line if you need to use the createGlobalSingleton function in this file.
|
|
9
|
+
// import { createGlobalSingleton } from "./global-functions.js";
|
|
10
|
+
// import { myCustomFunction } from "./money.js";
|
|
11
|
+
|
|
12
|
+
// createGlobalSingleton("myCustomFunction", myCustomFunction);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Imports goes here --End
|
|
16
|
+
|
|
17
|
+
const pp = (globalThis as any).pp;
|
|
18
|
+
|
|
19
|
+
if (document.readyState !== "loading") {
|
|
20
|
+
pp?.mount?.();
|
|
21
|
+
} else {
|
|
22
|
+
document.addEventListener(
|
|
23
|
+
"DOMContentLoaded",
|
|
24
|
+
() => pp?.mount?.(),
|
|
25
|
+
{ once: true },
|
|
26
|
+
);
|
|
27
|
+
}
|