create-coralite 0.37.2 → 0.38.1
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/package.json
CHANGED
|
@@ -137,7 +137,7 @@ img {
|
|
|
137
137
|
--card-border-color: #ffffff2e;
|
|
138
138
|
|
|
139
139
|
color: var(--light);
|
|
140
|
-
background-image:
|
|
140
|
+
background-image: var(--gradient-glass);
|
|
141
141
|
backdrop-filter: blur(10px);
|
|
142
142
|
border-color: var(--card-border-color);
|
|
143
143
|
border-style: solid;
|
|
@@ -4,7 +4,7 @@ $card-border-color: #ffffff2e;
|
|
|
4
4
|
|
|
5
5
|
.card {
|
|
6
6
|
color: $light;
|
|
7
|
-
background-image:
|
|
7
|
+
background-image: var(--gradient-glass);
|
|
8
8
|
backdrop-filter: blur(10px);
|
|
9
9
|
border-color: $card-border-color;
|
|
10
10
|
border-style: solid;
|
package/templates/css/llms.txt
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Coralite Framework - Project Guidelines
|
|
2
|
-
|
|
3
|
-
## CRITICAL DIRECTIVES
|
|
4
|
-
1. **NO VANILLA BOILERPLATE:** Do not write standard `customElements.define()` or `class extends HTMLElement`. Always use Coralite's `defineComponent` exported from `coralite`.
|
|
5
|
-
2. **COMPONENT NAMING:** Component names MUST contain at least one hyphen (e.g., `<my-component>`) to ensure Custom Element spec compliance and trigger lazy loading.
|
|
6
|
-
3. **AST SPLICING AWARENESS:** The server preserves the host tag and injects template contents as Light DOM with deterministic `data-cid` attributes.
|
|
7
|
-
4. **CSS SCOPING:** CSS scoping is achieved in the Light DOM using an AST compiler to inject unique identifiers and nest rules via PostCSS. Shadow DOM is NOT used.
|
|
8
|
-
5. **ZERO-CONFIG DEPENDENCIES:** Use standard dynamic imports (`await import('pkg')`) inside the `script` block for client-side JS.
|
|
9
|
-
6. **IMPERATIVE MOUNTING:** To mount a component imperatively, use `document.createElement('my-component')`. You must pass data via `setAttribute` to sync with component state. Do not directly assign properties or use a `data()` block for purely imperative components.
|
|
10
|
-
|
|
11
|
-
## 1. File Structure: Pages vs. Components
|
|
12
|
-
* **Pages**: Standard `.html` files in `src/pages` that consume components.
|
|
13
|
-
* **Components**: `.html` files in `src/components` consisting of `<template>`, `<style>`, and `<script type="module">`.
|
|
14
|
-
|
|
15
|
-
## 2. Dynamic Components (defineComponent)
|
|
16
|
-
Always export `defineComponent` from your component's script. Follow the "Flat Options" API strictly.
|
|
17
|
-
|
|
18
|
-
```javascript
|
|
19
|
-
import { defineComponent } from 'coralite'
|
|
20
|
-
export default defineComponent({
|
|
21
|
-
// Attributes STRICTLY prohibit Object/Array types. Primitives only (String, Number, Boolean).
|
|
22
|
-
// Standard HTML5 boolean attributes are handled specifically; bare attributes like `disabled` coerce to true.
|
|
23
|
-
attributes: { /* e.g., name: String, active: Boolean */ },
|
|
24
|
-
|
|
25
|
-
// Server-side logic. Executes during SSR. Used for data fetching and complex objects.
|
|
26
|
-
async data({ state, page }) { return {}; },
|
|
27
|
-
|
|
28
|
-
// Derived state. Getters are read-only proxies that strictly block mutations.
|
|
29
|
-
// Can be async/Promises; the framework handles resolution without race conditions.
|
|
30
|
-
getters: { /* Derived state logic */ },
|
|
31
|
-
|
|
32
|
-
// Client-side logic.
|
|
33
|
-
script({ state, root, instanceId, signal, refs }) { /* Client-side interactions */ }
|
|
34
|
-
})
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## 3. The "Smart State, Dumb Template" Paradigm
|
|
38
|
-
Templates are strictly declarative. No JavaScript logic or dot-notation is allowed in the HTML markup. Only render flat keys from the unified `state` (e.g., `{{ myKey }}`). Reactive logic must be strictly isolated in JavaScript `getters`.
|
|
39
|
-
|
|
40
|
-
## 4. Slots
|
|
41
|
-
The `slots` function can be provided to `defineComponent` to customize slot rendering:
|
|
42
|
-
* **Signature**: `(slotNodes, state) => HTMLString | NodeArray | void`
|
|
43
|
-
* Unnamed slots map to 'default'. The original nodes and internal state are preserved.
|
|
44
|
-
|
|
45
|
-
## 5. Non-Hydrated Components (`no-hydration`)
|
|
46
|
-
When the `no-hydration` boolean attribute is present on a component:
|
|
47
|
-
* The host element is stripped (unwrapped) from the final HTML during SSR.
|
|
48
|
-
* Its rendered children are promoted to the parent's level in the DOM.
|
|
49
|
-
* Any nested custom elements within a `no-hydration` subtree are recursively stripped and excluded from client-side hydration.
|
|
50
|
-
* Server-side `data()` and `getters` still execute during SSR to facilitate rendering, but no client-side instance is created.
|
|
51
|
-
|
|
52
|
-
## 6. Native Web APIs & Lifecycle
|
|
53
|
-
* **Communication**: Use standard `CustomEvent`.
|
|
54
|
-
* **Cleanup**: Always use the provided `AbortSignal` (`signal`) for event listeners and fetch requests. The `onDisconnected` hook fires synchronously when the element is removed, and event listeners attached with `signal` are automatically aborted.
|
|
55
|
-
* **Refs**: The standard context provides `refs`, an Array of `{name: string, element: Node}` containing DOM nodes mapped by `ref` attributes.
|
|
56
|
-
|
|
57
|
-
## 7. Plugins (definePlugin)
|
|
58
|
-
Plugins are critical for extending the framework and enforce a strict isomorphic boundary:
|
|
59
|
-
* **Structure**: Must use `definePlugin` with a `name`, `server: {}` (for Node.js/Build logic), and `client: {}` (for Browser/esbuild logic).
|
|
60
|
-
* **Server Block**: All SSR lifecycle hooks, plugin `exports`, and `components` arrays must reside within the `server` block.
|
|
61
|
-
* **Two-Phase Currying**: The API uses currying for extensibility. `server.exports` uses `(session) => (instanceContext) =>` and `client.context` uses `(globalContext) => (instanceContext) =>`.
|
|
62
|
-
* **Terminology**: `renderContext` is deprecated; always use `session` across the plugin API.
|
package/templates/scss/llms.txt
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Coralite Framework - Project Guidelines
|
|
2
|
-
|
|
3
|
-
## CRITICAL DIRECTIVES
|
|
4
|
-
1. **NO VANILLA BOILERPLATE:** Do not write standard `customElements.define()` or `class extends HTMLElement`. Always use Coralite's `defineComponent` exported from `coralite`.
|
|
5
|
-
2. **COMPONENT NAMING:** Component names MUST contain at least one hyphen (e.g., `<my-component>`) to ensure Custom Element spec compliance and trigger lazy loading.
|
|
6
|
-
3. **AST SPLICING AWARENESS:** The server preserves the host tag and injects template contents as Light DOM with deterministic `data-cid` attributes.
|
|
7
|
-
4. **CSS SCOPING:** CSS scoping is achieved in the Light DOM using an AST compiler to inject unique identifiers and nest rules via PostCSS. Shadow DOM is NOT used.
|
|
8
|
-
5. **ZERO-CONFIG DEPENDENCIES:** Use standard dynamic imports (`await import('pkg')`) inside the `script` block for client-side JS.
|
|
9
|
-
6. **IMPERATIVE MOUNTING:** To mount a component imperatively, use `document.createElement('my-component')`. You must pass data via `setAttribute` to sync with component state. Do not directly assign properties or use a `data()` block for purely imperative components.
|
|
10
|
-
|
|
11
|
-
## 1. File Structure: Pages vs. Components
|
|
12
|
-
* **Pages**: Standard `.html` files in `src/pages` that consume components.
|
|
13
|
-
* **Components**: `.html` files in `src/components` consisting of `<template>`, `<style>`, and `<script type="module">`.
|
|
14
|
-
|
|
15
|
-
## 2. Dynamic Components (defineComponent)
|
|
16
|
-
Always export `defineComponent` from your component's script. Follow the "Flat Options" API strictly.
|
|
17
|
-
|
|
18
|
-
```javascript
|
|
19
|
-
import { defineComponent } from 'coralite'
|
|
20
|
-
export default defineComponent({
|
|
21
|
-
// Attributes STRICTLY prohibit Object/Array types. Primitives only (String, Number, Boolean).
|
|
22
|
-
// Standard HTML5 boolean attributes are handled specifically; bare attributes like `disabled` coerce to true.
|
|
23
|
-
attributes: { /* e.g., name: String, active: Boolean */ },
|
|
24
|
-
|
|
25
|
-
// Server-side logic. Executes during SSR. Used for data fetching and complex objects.
|
|
26
|
-
async data({ state, page }) { return {}; },
|
|
27
|
-
|
|
28
|
-
// Derived state. Getters are read-only proxies that strictly block mutations.
|
|
29
|
-
// Can be async/Promises; the framework handles resolution without race conditions.
|
|
30
|
-
getters: { /* Derived state logic */ },
|
|
31
|
-
|
|
32
|
-
// Client-side logic.
|
|
33
|
-
script({ state, root, instanceId, signal, refs }) { /* Client-side interactions */ }
|
|
34
|
-
})
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## 3. The "Smart State, Dumb Template" Paradigm
|
|
38
|
-
Templates are strictly declarative. No JavaScript logic or dot-notation is allowed in the HTML markup. Only render flat keys from the unified `state` (e.g., `{{ myKey }}`). Reactive logic must be strictly isolated in JavaScript `getters`.
|
|
39
|
-
|
|
40
|
-
## 4. Slots
|
|
41
|
-
The `slots` function can be provided to `defineComponent` to customize slot rendering:
|
|
42
|
-
* **Signature**: `(slotNodes, state) => HTMLString | NodeArray | void`
|
|
43
|
-
* Unnamed slots map to 'default'. The original nodes and internal state are preserved.
|
|
44
|
-
|
|
45
|
-
## 5. Non-Hydrated Components (`no-hydration`)
|
|
46
|
-
When the `no-hydration` boolean attribute is present on a component:
|
|
47
|
-
* The host element is stripped (unwrapped) from the final HTML during SSR.
|
|
48
|
-
* Its rendered children are promoted to the parent's level in the DOM.
|
|
49
|
-
* Any nested custom elements within a `no-hydration` subtree are recursively stripped and excluded from client-side hydration.
|
|
50
|
-
* Server-side `data()` and `getters` still execute during SSR to facilitate rendering, but no client-side instance is created.
|
|
51
|
-
|
|
52
|
-
## 6. Native Web APIs & Lifecycle
|
|
53
|
-
* **Communication**: Use standard `CustomEvent`.
|
|
54
|
-
* **Cleanup**: Always use the provided `AbortSignal` (`signal`) for event listeners and fetch requests. The `onDisconnected` hook fires synchronously when the element is removed, and event listeners attached with `signal` are automatically aborted.
|
|
55
|
-
* **Refs**: The standard context provides `refs`, an Array of `{name: string, element: Node}` containing DOM nodes mapped by `ref` attributes.
|
|
56
|
-
|
|
57
|
-
## 7. Plugins (definePlugin)
|
|
58
|
-
Plugins are critical for extending the framework and enforce a strict isomorphic boundary:
|
|
59
|
-
* **Structure**: Must use `definePlugin` with a `name`, `server: {}` (for Node.js/Build logic), and `client: {}` (for Browser/esbuild logic).
|
|
60
|
-
* **Server Block**: All SSR lifecycle hooks, plugin `exports`, and `components` arrays must reside within the `server` block.
|
|
61
|
-
* **Two-Phase Currying**: The API uses currying for extensibility. `server.exports` uses `(session) => (instanceContext) =>` and `client.context` uses `(globalContext) => (instanceContext) =>`.
|
|
62
|
-
* **Terminology**: `renderContext` is deprecated; always use `session` across the plugin API.
|