@justai/cuts 0.1.0 → 0.3.0

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/package.json +20 -7
  2. package/src/Base.astro +35 -5
package/package.json CHANGED
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "@justai/cuts",
3
- "version": "0.1.0",
4
- "description": "A persona's named parts the page shell that holds them, and the cuts themselves.",
3
+ "version": "0.3.0",
4
+ "description": "A persona's named parts \u2014 the page shell that holds them, and the cuts themselves.",
5
5
  "license": "UNLICENSED",
6
- "repository": { "type": "git", "url": "git+https://github.com/justai-pro/web.git", "directory": "packages/cuts" },
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/justai-pro/web.git",
9
+ "directory": "packages/cuts"
10
+ },
7
11
  "type": "module",
8
- "files": ["src"],
9
- "exports": { "./Base.astro": "./src/Base.astro" },
10
- "peerDependencies": { "astro": ">=5", "@justai/ui": ">=0.2.0" },
11
- "publishConfig": { "access": "public" }
12
+ "files": [
13
+ "src"
14
+ ],
15
+ "exports": {
16
+ "./Base.astro": "./src/Base.astro"
17
+ },
18
+ "peerDependencies": {
19
+ "astro": ">=5",
20
+ "@justai/ui": ">=0.2.0"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
12
25
  }
package/src/Base.astro CHANGED
@@ -6,7 +6,13 @@
6
6
  * of which 132 were IDENTICAL. The 22 that differed were all identity — the host, the theme colour,
7
7
  * the favicon, the analytics property — plus two real ones, both preserved here as contract rather
8
8
  * than flattened: --on-accent (cleanmylink and howlong have light accents where white text fails
9
- * contrast) and a head slot (time self-hosts Geist).
9
+ * contrast) and the DEV service-worker kill, which came from the one persona that had it.
10
+ *
11
+ * NO head slot, and the docstring claimed one for a while before anyone checked. time self-hosts
12
+ * Geist through `import "@fontsource-variable/geist"` in its OWN layout frontmatter — a build-time
13
+ * CSS import that Astro bundles, not a tag that needs injecting here. The claim was removed rather
14
+ * than the slot added: building a feature to make a comment true is the wrong direction, and an
15
+ * unused extension point is the thing that rots.
10
16
  *
11
17
  * WHAT IT DELIBERATELY DOES NOT OWN.
12
18
  *
@@ -127,9 +133,26 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
127
133
  <!-- PWA: Workbox service worker (precache + offline) + installable manifest -->
128
134
  <link rel="manifest" href="/manifest.webmanifest" />
129
135
  <link rel="apple-touch-icon" href="/icon-192.png" />
130
- <script is:inline>
131
- if ("serviceWorker" in navigator) addEventListener("load", () => navigator.serviceWorker.register("/sw.js"));
132
- </script>
136
+ {import.meta.env.DEV ? (
137
+ <script is:inline>
138
+ {/* DEV: no service worker. Kill any stale one — from an earlier prod or preview build — and
139
+ purge its caches, so a local edit is never masked by something a previous build cached.
140
+ If a SW currently controls the page, reload once (guarded by sessionStorage so it cannot
141
+ loop) to get a clean, uncontrolled load.
142
+
143
+ This came from `time`, which was the only persona that had it. It is in the package
144
+ rather than behind a prop because a stale service worker hiding your own changes is not
145
+ a preference — the other ten had the bug and had simply not noticed it yet. Migration
146
+ found it; the fleet's best version wins over the fleet's most common one. */}
147
+ if ("serviceWorker" in navigator) navigator.serviceWorker.getRegistrations().then((rs) => rs.forEach((r) => r.unregister()));
148
+ if (window.caches) caches.keys().then((ks) => ks.forEach((k) => caches.delete(k)));
149
+ if (navigator.serviceWorker && navigator.serviceWorker.controller && !sessionStorage.getItem("__swkill")) { sessionStorage.setItem("__swkill", "1"); location.reload(); }
150
+ </script>
151
+ ) : (
152
+ <script is:inline>
153
+ if ("serviceWorker" in navigator) addEventListener("load", () => navigator.serviceWorker.register("/sw.js"));
154
+ </script>
155
+ )}
133
156
  <!-- Google Analytics 4 — anonymous (ad signals + personalization OFF), lazy-loaded after idle.
134
157
  analytics_storage granted: direct user counting (cookieless modeling needs high traffic to
135
158
  surface, so it shows nothing at low/launch volume).
@@ -178,7 +201,14 @@ const localePath = (l: string) => (l === defaultLocale ? "/" : `/${l}/`);
178
201
  .cc-row { display: flex; gap: 8px; justify-content: flex-end; }
179
202
  .cc-btn { font: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; transition: transform 0.2s var(--ease-spring); }
180
203
  .cc-btn:active { transform: scale(0.94); }
181
- .cc-ok { background: var(--accent-press); border-color: var(--accent-press); color: #fff; }
204
+ /* The consent button is the one place the fleet genuinely disagreed, and the disagreement is
205
+ about CONTRAST rather than taste. Seven personas have dark accents and take white text on
206
+ --accent-press. cleanmylink and howlong have bright ones — mint and amber — where white
207
+ fails, so they fill with --accent and set --on-accent to a dark tone that passes.
208
+ Two hooks with the majority as the default, so the seven say nothing and the two say
209
+ exactly what they already verified. This is the styling contract working as designed:
210
+ colour is the persona's, and a real difference gets a declared hook rather than a fork. */
211
+ .cc-ok { background: var(--consent-ok-bg, var(--accent-press)); border-color: var(--consent-ok-bg, var(--accent-press)); color: var(--on-accent, #fff); }
182
212
  @keyframes cc-up { from { transform: translateY(24px); opacity: 0; } }
183
213
  @media (prefers-reduced-motion: reduce) { .cc-card { animation: none; } }
184
214
  </style>