@cawalch/porchlight 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +95 -9
  2. package/package.json +5 -2
package/README.md CHANGED
@@ -6,23 +6,109 @@ The Porchlight CSS framework package. See the root [README](../../README.md) and
6
6
 
7
7
  ```sh
8
8
  pnpm add @cawalch/porchlight
9
+ # or
10
+ npm install @cawalch/porchlight
9
11
  ```
10
12
 
11
- ## Use
13
+ ## Quick start
12
14
 
13
- Declare the framework in your app's layer order **before** importing it, so your
14
- application styles win over the framework:
15
+ The main export is the **prebuilt** stylesheet (single file, no `@import` to resolve):
15
16
 
16
17
  ```css
17
18
  /* app.css */
19
+ @import "@cawalch/porchlight";
20
+ ```
21
+
22
+ ## Layer ordering
23
+
24
+ Porchlight wraps every rule in `@layer porchlight.*`. Declare your layer order
25
+ **before** the import so your app styles win:
26
+
27
+ ```css
28
+ @layer porchlight, app;
29
+
30
+ @import "@cawalch/porchlight";
31
+ ```
32
+
33
+ Do **not** pass `layer(...)` to the `@import` — Porchlight already self-layers.
34
+
35
+ ## Bundler notes
36
+
37
+ ### Vite (recommended)
38
+
39
+ Works out of the box. Vite uses esbuild + Lightning CSS under the hood and
40
+ handles modern CSS syntax (`@property`, `@scope`, `@container scroll-state()`)
41
+ natively.
42
+
43
+ ```css
44
+ @layer porchlight, app;
45
+ @import "@cawalch/porchlight";
46
+ ```
47
+
48
+ ### esbuild / Bun
49
+
50
+ esbuild and Bun's built-in CSS parsers **do not understand** `@property`,
51
+ `@scope`, or `@container scroll-state()`. They throw a hard parse error on these
52
+ features even though the CSS is already prebuilt.
53
+
54
+ **Workaround — bypass the bundler's CSS pipeline:**
55
+
56
+ Copy the prebuilt file directly into your project's static/public assets folder
57
+ and load it via a `<link>` tag instead of a CSS `@import`:
58
+
59
+ ```sh
60
+ cp node_modules/@cawalch/porchlight/dist/porchlight.css ./static/porchlight.css
61
+ ```
62
+
63
+ ```html
64
+ <!-- index.html -->
65
+ <link rel="stylesheet" href="/porchlight.css" />
66
+ ```
67
+
68
+ Then declare your layer order in your app's own CSS:
69
+
70
+ ```css
71
+ /* app.css — loaded after porchlight.css */
18
72
  @layer porchlight, app;
73
+ ```
74
+
75
+ ### @layer + @import ordering caveat
19
76
 
20
- @import "@cawalch/porchlight/porchlight.css";
77
+ Some bundlers **hoist** `@import` statements to the top of the file during
78
+ processing, which can move them above your `@layer` declaration and reverse the
79
+ intended order. If you encounter this:
21
80
 
22
- @layer app {
23
- /* your overrides here */
24
- }
81
+ 1. Import Porchlight from your **entry JS/TS** file, not from CSS:
82
+
83
+ ```ts
84
+ // app.ts
85
+ import "@cawalch/porchlight";
86
+ import "./app.css";
25
87
  ```
26
88
 
27
- Do not pass `layer(...)` to the `@import` Porchlight already wraps every rule
28
- in `@layer porchlight.*` internally.
89
+ 2. Declare `@layer` only in your app's CSS (no `@import` there to hoist):
90
+
91
+ ```css
92
+ /* app.css */
93
+ @layer porchlight, app;
94
+
95
+ /* your styles */
96
+ ```
97
+
98
+ This guarantees the JS loader injects Porchlight first, then your CSS — and
99
+ your `@layer` declaration is never reordered.
100
+
101
+ ## Exports
102
+
103
+ | Import path | What you get |
104
+ |-------------|-------------|
105
+ | `@cawalch/porchlight` | Prebuilt single-file CSS (recommended) |
106
+ | `@cawalch/porchlight/min` | Minified prebuilt CSS |
107
+ | `@cawalch/porchlight/source` | Raw source with `@import` (needs Lightning CSS / Vite) |
108
+ | `@cawalch/porchlight/src/*` | Individual source layer files |
109
+
110
+ ## Browser support
111
+
112
+ Targets Chrome/Edge 149+, Safari 18+, Firefox 135+. Uses `@layer`, `@scope`,
113
+ `@property`, OKLCH, `light-dark()`, `color-mix()`, `:has()`, container queries,
114
+ Popover API, and anchor positioning — all Baseline 2025+ features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cawalch/porchlight",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A no-dependency, native-CSS framework for building accessible, themeable web applications.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,7 +33,10 @@
33
33
  "*.css"
34
34
  ],
35
35
  "exports": {
36
- ".": "./porchlight.css",
36
+ ".": "./dist/porchlight.css",
37
+ "./css": "./dist/porchlight.css",
38
+ "./min": "./dist/porchlight.min.css",
39
+ "./source": "./porchlight.css",
37
40
  "./porchlight.css": "./porchlight.css",
38
41
  "./dist": "./dist/porchlight.css",
39
42
  "./dist/porchlight.css": "./dist/porchlight.css",