primitive-app 3.2.0-alpha.15 → 3.2.0-alpha.16

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.
@@ -0,0 +1,14 @@
1
+ import { type ComputedRef, type Ref } from "vue";
2
+ /**
3
+ * Render the portaled content of descendants (dialogs, dropdown menus,
4
+ * selects, popovers, sheets) into `target` instead of `document.body`.
5
+ *
6
+ * The dev tools provide their themed root, so what they open keeps their
7
+ * styling rather than the host app's.
8
+ */
9
+ export declare function providePortalTarget(target: Ref<HTMLElement | undefined>): void;
10
+ /**
11
+ * The element portaled content renders into: the nearest
12
+ * `providePortalTarget` element once it is mounted, otherwise `"body"`.
13
+ */
14
+ export declare function usePortalTarget(): ComputedRef<HTMLElement | "body">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primitive-app",
3
- "version": "3.2.0-alpha.15",
3
+ "version": "3.2.0-alpha.16",
4
4
  "license": "UNLICENSED",
5
5
  "author": "Primitive LLC",
6
6
  "type": "module",
@@ -42,6 +42,7 @@
42
42
  "dev": "vite",
43
43
  "build": "pnpm codegen && run-p type-check \"build-only {@}\" -- && pnpm build:dts",
44
44
  "preview": "vite preview",
45
+ "test": "vitest run",
45
46
  "clean": "rm -rf dist && pnpm clean-modules",
46
47
  "clean-modules": "rm -rf node_modules pnpm-lock.yaml",
47
48
  "build-only": "vite build",
package/src/style.css CHANGED
@@ -83,7 +83,13 @@
83
83
  }
84
84
  }
85
85
 
86
- :root {
86
+ /*
87
+ * The platform palette. The dev tools (`.primitive-devtools`) declare it on
88
+ * their own scope too, so a host that re-themes these tokens in `:root` keeps
89
+ * its theme out of the overlay.
90
+ */
91
+ :root,
92
+ .primitive-devtools {
87
93
  --radius: 0.625rem;
88
94
  --background: oklch(1 0 0);
89
95
  --foreground: oklch(0.129 0.042 264.695);
@@ -119,7 +125,8 @@
119
125
  --sidebar-ring: oklch(0.704 0.04 256.788);
120
126
  }
121
127
 
122
- .dark {
128
+ .dark,
129
+ .dark .primitive-devtools {
123
130
  --background: oklch(0.129 0.042 264.695);
124
131
  --foreground: oklch(0.984 0.003 247.858);
125
132
  --card: oklch(0.129 0.042 264.695);
@@ -154,6 +161,182 @@
154
161
  --sidebar-ring: oklch(0.446 0.043 257.281);
155
162
  }
156
163
 
164
+ /* The dev tools' own type: Tailwind's default stacks, whatever the host sets. */
165
+ .primitive-devtools {
166
+ --font-sans:
167
+ ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
168
+ "Segoe UI Symbol", "Noto Color Emoji";
169
+ --font-mono:
170
+ ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
171
+ "Courier New", monospace;
172
+ font-family: var(--font-sans);
173
+ line-height: 1.5;
174
+ color: var(--foreground);
175
+ }
176
+
177
+ /*
178
+ * The Tailwind theme the dev tools' utilities read. The host's Tailwind build
179
+ * compiles those utilities, so a host `@theme` that redefines a key
180
+ * (`--color-background`, `--spacing`, `--text-sm`) would otherwise restyle the
181
+ * overlay; inside the scope each key is primitive-app's value, or Tailwind's
182
+ * default, again. Tailwind writes some keys into the classes at build time
183
+ * (breakpoints, shadows, tw-animate's easing and duration, and any key a host
184
+ * declares `@theme inline`), out of a scope's reach.
185
+ * tests/devtools-theme-isolation-3938.test.ts (this package) fails when a
186
+ * dev-tools class starts reading a key missing here.
187
+ */
188
+ .primitive-devtools {
189
+ --color-background: var(--background);
190
+ --color-foreground: var(--foreground);
191
+ --color-card: var(--card);
192
+ --color-card-foreground: var(--card-foreground);
193
+ --color-popover: var(--popover);
194
+ --color-popover-foreground: var(--popover-foreground);
195
+ --color-primary: var(--primary);
196
+ --color-primary-foreground: var(--primary-foreground);
197
+ --color-secondary: var(--secondary);
198
+ --color-secondary-foreground: var(--secondary-foreground);
199
+ --color-muted: var(--muted);
200
+ --color-muted-foreground: var(--muted-foreground);
201
+ --color-accent: var(--accent);
202
+ --color-accent-foreground: var(--accent-foreground);
203
+ --color-destructive: var(--destructive);
204
+ --color-destructive-foreground: var(--destructive-foreground);
205
+ --color-border: var(--border);
206
+ --color-input: var(--input);
207
+ --color-ring: var(--ring);
208
+ --color-black: #000;
209
+ --color-white: #fff;
210
+ --color-red-100: oklch(93.6% 0.032 17.717);
211
+ --color-red-500: oklch(63.7% 0.237 25.331);
212
+ --color-red-600: oklch(57.7% 0.245 27.325);
213
+ --color-red-700: oklch(50.5% 0.213 27.518);
214
+ --color-orange-500: oklch(70.5% 0.213 47.604);
215
+ --color-amber-500: oklch(76.9% 0.188 70.08);
216
+ --color-amber-600: oklch(66.6% 0.179 58.318);
217
+ --color-green-100: oklch(96.2% 0.044 156.743);
218
+ --color-green-500: oklch(72.3% 0.219 149.579);
219
+ --color-green-600: oklch(62.7% 0.194 149.214);
220
+ --color-green-700: oklch(52.7% 0.154 150.069);
221
+ --color-teal-500: oklch(70.4% 0.14 182.503);
222
+ --color-blue-100: oklch(93.2% 0.032 255.585);
223
+ --color-blue-500: oklch(62.3% 0.214 259.815);
224
+ --color-blue-600: oklch(54.6% 0.245 262.881);
225
+ --color-blue-700: oklch(48.8% 0.243 264.376);
226
+ --color-indigo-500: oklch(58.5% 0.233 277.117);
227
+ --color-indigo-600: oklch(51.1% 0.262 276.966);
228
+ --color-purple-500: oklch(62.7% 0.265 303.9);
229
+ --color-pink-500: oklch(65.6% 0.241 354.308);
230
+ --radius-xs: 0.125rem;
231
+ --radius-sm: calc(var(--radius) - 4px);
232
+ --radius-md: calc(var(--radius) - 2px);
233
+ --radius-lg: var(--radius);
234
+ --radius-xl: calc(var(--radius) + 4px);
235
+ --spacing: 0.25rem;
236
+ /*
237
+ * A host `@theme` may add a step to the spacing scale (`--spacing-10`), and
238
+ * Tailwind then compiles `w-10`, `px-4`, `top-1/2`, `max-w-lg` and
239
+ * `leading-none` to read it. Each step the dev tools' classes use is held
240
+ * here at the value that class has without it. Decimal steps are looked up
241
+ * under both spellings (`--spacing-1\.5`, `--spacing-1_5`).
242
+ */
243
+ --spacing-0: 0;
244
+ --spacing-0\.5: calc(var(--spacing) * 0.5);
245
+ --spacing-0_5: calc(var(--spacing) * 0.5);
246
+ --spacing-1: calc(var(--spacing) * 1);
247
+ --spacing-1\.5: calc(var(--spacing) * 1.5);
248
+ --spacing-1_5: calc(var(--spacing) * 1.5);
249
+ --spacing-2: calc(var(--spacing) * 2);
250
+ --spacing-2\.5: calc(var(--spacing) * 2.5);
251
+ --spacing-2_5: calc(var(--spacing) * 2.5);
252
+ --spacing-3: calc(var(--spacing) * 3);
253
+ --spacing-3\.5: calc(var(--spacing) * 3.5);
254
+ --spacing-3_5: calc(var(--spacing) * 3.5);
255
+ --spacing-4: calc(var(--spacing) * 4);
256
+ --spacing-5: calc(var(--spacing) * 5);
257
+ --spacing-6: calc(var(--spacing) * 6);
258
+ --spacing-7: calc(var(--spacing) * 7);
259
+ --spacing-8: calc(var(--spacing) * 8);
260
+ --spacing-9: calc(var(--spacing) * 9);
261
+ --spacing-10: calc(var(--spacing) * 10);
262
+ --spacing-12: calc(var(--spacing) * 12);
263
+ --spacing-16: calc(var(--spacing) * 16);
264
+ --spacing-20: calc(var(--spacing) * 20);
265
+ --spacing-24: calc(var(--spacing) * 24);
266
+ --spacing-28: calc(var(--spacing) * 28);
267
+ --spacing-32: calc(var(--spacing) * 32);
268
+ --spacing-40: calc(var(--spacing) * 40);
269
+ --spacing-44: calc(var(--spacing) * 44);
270
+ --spacing-48: calc(var(--spacing) * 48);
271
+ --spacing-56: calc(var(--spacing) * 56);
272
+ --spacing-64: calc(var(--spacing) * 64);
273
+ --spacing-72: calc(var(--spacing) * 72);
274
+ --spacing-80: calc(var(--spacing) * 80);
275
+ --spacing-96: calc(var(--spacing) * 96);
276
+ --spacing-1\/2: calc(1 / 2 * 100%);
277
+ --spacing-3\/4: calc(3 / 4 * 100%);
278
+ --spacing-px: 1px;
279
+ --spacing-auto: auto;
280
+ --spacing-fit: fit-content;
281
+ --spacing-full: 100%;
282
+ --spacing-none: 1;
283
+ --spacing-xs: var(--container-xs);
284
+ --spacing-sm: var(--container-sm);
285
+ --spacing-md: var(--container-md);
286
+ --spacing-lg: var(--container-lg);
287
+ --spacing-4xl: var(--container-4xl);
288
+ --spacing-screen-lg: var(--breakpoint-lg);
289
+ --container-xs: 20rem;
290
+ --container-sm: 24rem;
291
+ --container-md: 28rem;
292
+ --container-lg: 32rem;
293
+ --container-4xl: 56rem;
294
+ --breakpoint-lg: 64rem;
295
+ --text-xs: 0.75rem;
296
+ --text-xs--line-height: calc(1 / 0.75);
297
+ --text-sm: 0.875rem;
298
+ --text-sm--line-height: calc(1.25 / 0.875);
299
+ --text-base: 1rem;
300
+ --text-base--line-height: calc(1.5 / 1);
301
+ --text-lg: 1.125rem;
302
+ --text-lg--line-height: calc(1.75 / 1.125);
303
+ --font-weight-normal: 400;
304
+ --font-weight-medium: 500;
305
+ --font-weight-semibold: 600;
306
+ --font-weight-bold: 700;
307
+ --tracking-wide: 0.025em;
308
+ --tracking-widest: 0.1em;
309
+ --leading-relaxed: 1.625;
310
+ --ease-out: cubic-bezier(0, 0, 0.2, 1);
311
+ --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
312
+ --animate-spin: spin 1s linear infinite;
313
+ --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
314
+ --blur: 8px;
315
+ --blur-sm: 8px;
316
+ --aspect-video: 16 / 9;
317
+ --default-transition-duration: 150ms;
318
+ --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
319
+ }
320
+
321
+ /*
322
+ * A host's base rules aimed at elements (`button { font-family: … }`) reach
323
+ * the dev tools' controls directly, not through the scope. Inside it every
324
+ * element takes its type from its parent instead (code stays monospace). This
325
+ * sits in the base layer, so utilities such as `font-mono` still apply.
326
+ */
327
+ @layer base {
328
+ .primitive-devtools * {
329
+ font-family: inherit;
330
+ letter-spacing: inherit;
331
+ }
332
+ .primitive-devtools code,
333
+ .primitive-devtools kbd,
334
+ .primitive-devtools samp,
335
+ .primitive-devtools pre {
336
+ font-family: var(--font-mono);
337
+ }
338
+ }
339
+
157
340
  @layer base {
158
341
  * {
159
342
  @apply border-border outline-ring/50;