create-prisma-php-app 5.1.0-alpha.2 → 5.1.0-alpha.4
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.
|
@@ -94,16 +94,19 @@
|
|
|
94
94
|
- For page-local interactivity, prefer `index.php` or nested `layout.php` with a plain inline `<script>` that contains PulsePoint state and functions directly, and use `pp.fetchFunction(...)` for backend calls.
|
|
95
95
|
- Do not wrap inline PulsePoint code in `DOMContentLoaded`, IIFEs, manual `pp.mount()` calls, or custom scoping/bootstrap helpers. Prisma PHP scopes the component boundary and runs the script for you.
|
|
96
96
|
- Reserve plain browser JavaScript or TypeScript modules for reusable helpers in `ts/`, third-party libraries, low-level browser APIs, or behavior that does not belong inside a PulsePoint component boundary.
|
|
97
|
-
- Use `pp-style`
|
|
97
|
+
- Use `pp-style` whenever inline CSS contains `{...}` interpolation or any other template-driven/reactive value, reserve plain `style` for fully static inline CSS, use `pp-spread="{...attrs}"` for dynamic attribute objects, keep `pp-for` only on `<template>`, and use plain `key` for keyed diffing.
|
|
98
|
+
- Do not generate reactive inline CSS inside a plain `style` attribute such as `style="width: {progress}%";` use `pp-style="width: {progress}%";` instead so editor CSS validation does not flag the source markup as invalid.
|
|
98
99
|
- Use `pp.ref(...)`, `pp-ref`, `pp.portal(...)`, `pp.createContext(...)`, `Context.Provider`, and `pp.context(...)` according to `pulsepoint.md`.
|
|
99
100
|
- Use `value`, `defaultvalue`, and `defaultchecked` form bindings according to `pulsepoint.md`; do not author internal `data-pp-*` runtime attributes.
|
|
100
101
|
|
|
101
102
|
## Route File Conventions
|
|
102
103
|
|
|
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
|
|
104
|
+
- 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.
|
|
105
|
+
- `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.
|
|
106
|
+
- 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
107
|
- 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.
|
|
108
|
+
- 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.
|
|
109
|
+
- Do not leave the route `<script>` outside the route boundary.
|
|
107
110
|
- 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
111
|
|
|
109
112
|
## 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(...)`
|
|
@@ -705,7 +712,8 @@ Also follow these rules:
|
|
|
705
712
|
- do not write React, Vue, Alpine, or Livewire syntax and call it PulsePoint
|
|
706
713
|
- keep backend concerns separate from PulsePoint runtime concerns
|
|
707
714
|
- prefer simple documented runtime primitives over abstractions copied from other ecosystems
|
|
708
|
-
- use `pp-style`
|
|
715
|
+
- use `pp-style` whenever inline CSS contains `{...}` interpolation or any other template-driven/reactive value, and reserve plain `style` for fully static inline CSS
|
|
716
|
+
- do **not** generate reactive inline CSS inside a plain `style` attribute such as `style="width: {progress}%";` use `pp-style="width: {progress}%";` instead so source markup stays editor-friendly
|
|
709
717
|
- use `pp-spread="{...attrs}"` for dynamic attribute objects and omit nullish values from those objects
|
|
710
718
|
- use `pp-for` only on `<template>` with `item in items` or `(item, index) in items`
|
|
711
719
|
- use plain `key` for keyed diffing; do not invent `pp-key`
|