@karni/ui 0.0.0-stage → 0.4.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.
- package/LICENSE +201 -0
- package/README.md +928 -2
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +8699 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +102 -0
- package/dist/mockServiceWorker.js +361 -0
- package/dist/script-BVJ9BbPm.cjs +2 -0
- package/dist/script-BVJ9BbPm.cjs.map +1 -0
- package/dist/script-D1fn4Dm4.js +6 -0
- package/dist/script-D1fn4Dm4.js.map +1 -0
- package/dist/src/auth/AuthGuard.d.ts +77 -0
- package/dist/src/auth/LoginForm.d.ts +63 -0
- package/dist/src/auth/engine.d.ts +101 -0
- package/dist/src/auth/provider.d.ts +43 -0
- package/dist/src/auth/storage.d.ts +26 -0
- package/dist/src/auth/types.d.ts +32 -0
- package/dist/src/auth/usePermission.d.ts +7 -0
- package/dist/src/components/brand/karni-mark.d.ts +21 -0
- package/dist/src/components/brand/mark-paths.d.ts +8 -0
- package/dist/src/components/chart/data-chart.d.ts +129 -0
- package/dist/src/components/empty-state/empty-state.d.ts +40 -0
- package/dist/src/components/file-upload/FileUpload.d.ts +108 -0
- package/dist/src/components/layout/layout.d.ts +150 -0
- package/dist/src/components/layout/route-focus.d.ts +43 -0
- package/dist/src/components/modal/modal.d.ts +86 -0
- package/dist/src/components/page/page.d.ts +60 -0
- package/dist/src/components/primitives/button.d.ts +45 -0
- package/dist/src/components/primitives/checkbox.d.ts +8 -0
- package/dist/src/components/primitives/dropdown-menu.d.ts +24 -0
- package/dist/src/components/primitives/icons.d.ts +19 -0
- package/dist/src/components/primitives/input.d.ts +7 -0
- package/dist/src/components/primitives/label.d.ts +8 -0
- package/dist/src/components/primitives/select.d.ts +94 -0
- package/dist/src/components/primitives/skeleton.d.ts +7 -0
- package/dist/src/components/primitives/switch.d.ts +8 -0
- package/dist/src/components/primitives/tabs.d.ts +10 -0
- package/dist/src/components/primitives/textarea.d.ts +7 -0
- package/dist/src/components/resource/ResourceDetail.d.ts +7 -0
- package/dist/src/components/resource/ResourceForm.d.ts +8 -0
- package/dist/src/components/resource/ResourceSelect.d.ts +9 -0
- package/dist/src/components/resource/ResourceTable.d.ts +17 -0
- package/dist/src/components/resource/audit-fields.d.ts +17 -0
- package/dist/src/components/resource/detail/ResourceDetail.d.ts +128 -0
- package/dist/src/components/resource/displayLabel.d.ts +12 -0
- package/dist/src/components/resource/empty-value.d.ts +17 -0
- package/dist/src/components/resource/form/ResourceForm.d.ts +109 -0
- package/dist/src/components/resource/form/field-inputs.d.ts +34 -0
- package/dist/src/components/resource/form/fixtures.d.ts +24 -0
- package/dist/src/components/resource/form/form-states.d.ts +87 -0
- package/dist/src/components/resource/form/prepare.d.ts +54 -0
- package/dist/src/components/resource/form/server-errors.d.ts +14 -0
- package/dist/src/components/resource/history/ChangeHistory.d.ts +60 -0
- package/dist/src/components/resource/import/ResourceImport.d.ts +84 -0
- package/dist/src/components/resource/nouns.d.ts +12 -0
- package/dist/src/components/resource/query-state.d.ts +20 -0
- package/dist/src/components/resource/resource-names.d.ts +23 -0
- package/dist/src/components/resource/select/ResourceSelect.d.ts +67 -0
- package/dist/src/components/resource/select/select-states.d.ts +68 -0
- package/dist/src/components/resource/select/use-debounced-value.d.ts +2 -0
- package/dist/src/components/resource/select/use-option-pages.d.ts +37 -0
- package/dist/src/components/resource/select/venue-backend.d.ts +144 -0
- package/dist/src/components/resource/table/BulkActionsBar.d.ts +77 -0
- package/dist/src/components/resource/table/CardList.d.ts +31 -0
- package/dist/src/components/resource/table/ConfirmDialog.d.ts +28 -0
- package/dist/src/components/resource/table/ExportButtons.d.ts +17 -0
- package/dist/src/components/resource/table/FilterBar.d.ts +29 -0
- package/dist/src/components/resource/table/PaginationControls.d.ts +31 -0
- package/dist/src/components/resource/table/ResourceTable.d.ts +137 -0
- package/dist/src/components/resource/table/RowCard.d.ts +31 -0
- package/dist/src/components/resource/table/TableView.d.ts +29 -0
- package/dist/src/components/resource/table/ViewOptions.d.ts +19 -0
- package/dist/src/components/resource/table/access.d.ts +12 -0
- package/dist/src/components/resource/table/demo-fixtures.d.ts +25 -0
- package/dist/src/components/resource/table/derive-columns.d.ts +33 -0
- package/dist/src/components/resource/table/grid-navigation.d.ts +23 -0
- package/dist/src/components/resource/table/layout.d.ts +37 -0
- package/dist/src/components/resource/table/preferences.d.ts +12 -0
- package/dist/src/components/resource/table/slots.d.ts +41 -0
- package/dist/src/components/resource/table/states.d.ts +91 -0
- package/dist/src/components/resource/table/story-fixtures.d.ts +25 -0
- package/dist/src/components/resource/table/structural-columns.d.ts +25 -0
- package/dist/src/components/resource/table/table-icons.d.ts +16 -0
- package/dist/src/components/resource/table/table-utils.d.ts +48 -0
- package/dist/src/components/resource/table/url-state.d.ts +67 -0
- package/dist/src/components/resource/table/use-container-width.d.ts +10 -0
- package/dist/src/components/resource/table/use-debounced-value.d.ts +1 -0
- package/dist/src/components/resource/testapp-fixtures.d.ts +78 -0
- package/dist/src/components/stat/stat.d.ts +54 -0
- package/dist/src/components/toast/toast-store.d.ts +36 -0
- package/dist/src/components/toast/toaster.d.ts +66 -0
- package/dist/src/components/toast/use-toast.d.ts +24 -0
- package/dist/src/hooks/keys.d.ts +24 -0
- package/dist/src/hooks/multipart.d.ts +44 -0
- package/dist/src/hooks/params.d.ts +25 -0
- package/dist/src/hooks/types.d.ts +41 -0
- package/dist/src/hooks/useChangeHistory.d.ts +30 -0
- package/dist/src/hooks/useResourceImport.d.ts +107 -0
- package/dist/src/hooks/useResourceItem.d.ts +4 -0
- package/dist/src/hooks/useResourceList.d.ts +4 -0
- package/dist/src/hooks/useResourceMutations.d.ts +13 -0
- package/dist/src/hooks/useUnsavedChangesGuard.d.ts +31 -0
- package/dist/src/index.d.ts +113 -0
- package/dist/src/lib/cn.d.ts +8 -0
- package/dist/src/lib/roles.d.ts +45 -0
- package/dist/src/lib/variants.d.ts +33 -0
- package/dist/src/primitives/registry.d.ts +81 -0
- package/dist/src/schema/client.d.ts +90 -0
- package/dist/src/schema/parse.d.ts +101 -0
- package/dist/src/schema/provider.d.ts +20 -0
- package/dist/src/schema/types.d.ts +93 -0
- package/dist/src/schema/useSchema.d.ts +21 -0
- package/dist/src/schema/zod.d.ts +4 -0
- package/dist/src/states/ErrorState.d.ts +43 -0
- package/dist/src/states/PendingButton.d.ts +16 -0
- package/dist/src/states/describe-error.d.ts +25 -0
- package/dist/src/states/hooks.d.ts +10 -0
- package/dist/src/theme/script.d.ts +12 -0
- package/dist/src/theme/theme.d.ts +45 -0
- package/dist/styles.css +248 -0
- package/dist/tailwind-preset.cjs +2 -0
- package/dist/tailwind-preset.cjs.map +1 -0
- package/dist/tailwind-preset.d.ts +140 -0
- package/dist/tailwind-preset.js +183 -0
- package/dist/tailwind-preset.js.map +1 -0
- package/dist/tailwind-v4.css +31 -0
- package/dist/vite-plugin.cjs +2 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.ts +19 -0
- package/dist/vite-plugin.js +16 -0
- package/dist/vite-plugin.js.map +1 -0
- package/eslint-plugin/index.js +76 -0
- package/eslint-plugin/lib/docs.js +11 -0
- package/eslint-plugin/lib/glob.js +51 -0
- package/eslint-plugin/rules/max-page-lines.js +65 -0
- package/eslint-plugin/rules/no-deep-imports.js +61 -0
- package/eslint-plugin/rules/no-direct-http.js +128 -0
- package/eslint-plugin/rules/no-raw-elements.js +65 -0
- package/eslint-plugin/rules/no-style-literals.js +222 -0
- package/eslint-plugin/rules.json +32 -0
- package/package.json +156 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ZodObject, ZodRawShape } from 'zod';
|
|
2
|
+
import { ResourceSchema } from './types';
|
|
3
|
+
/** Builds a Zod validator for a resource's create or update payload from its schema. */
|
|
4
|
+
export declare function zodFor(schema: ResourceSchema, mode: "create" | "update"): ZodObject<ZodRawShape>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { KarniErrorContext } from './describe-error';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface ErrorStateProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
4
|
+
/** What failed: a KarniApiError, a fetch failure, anything. */
|
|
5
|
+
error: unknown;
|
|
6
|
+
/** What the user was doing, so the message names it ("You can't delete events"). */
|
|
7
|
+
context?: KarniErrorContext;
|
|
8
|
+
/** Offered when trying again can succeed. */
|
|
9
|
+
onRetry?: () => void;
|
|
10
|
+
/** True while the retry runs: the button shows progress after ~500ms. */
|
|
11
|
+
retrying?: boolean;
|
|
12
|
+
/** More actions next to Retry (a sign-in link, "Back to the list"). */
|
|
13
|
+
actions?: React.ReactNode;
|
|
14
|
+
/** "panel" (a bordered block, the default) or "inline" (one compact row). */
|
|
15
|
+
variant?: "panel" | "inline";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What a component's `Error` slot receives: every Karni component that loads
|
|
19
|
+
* data takes `slots={{ Error: YourPanel }}` with these props.
|
|
20
|
+
*/
|
|
21
|
+
export type ErrorSlotProps = Pick<ErrorStateProps, "error" | "context" | "onRetry" | "retrying">;
|
|
22
|
+
/**
|
|
23
|
+
* What failed and what to do, in plain words (see describeError). Never shows
|
|
24
|
+
* a raw status code, but shows the server's own explanation when it gave one.
|
|
25
|
+
* Announced to screen readers when it appears.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ErrorState: React.ForwardRefExoticComponent<ErrorStateProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export interface PermissionDeniedProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
29
|
+
/** The action that is not allowed: "create", "delete", "export". */
|
|
30
|
+
action?: string;
|
|
31
|
+
/** What it applies to: "events", "this booking". */
|
|
32
|
+
resource?: string;
|
|
33
|
+
/** Replaces the default "Ask an administrator" sentence. */
|
|
34
|
+
description?: React.ReactNode;
|
|
35
|
+
/** A way forward ("Back to the list"). */
|
|
36
|
+
actions?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Says, in plain words, which action the user's role does not allow, both
|
|
40
|
+
* on screens that know before asking the server (a role check) and after
|
|
41
|
+
* a 403.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PermissionDenied: React.ForwardRefExoticComponent<PermissionDeniedProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtonProps } from '../components/primitives/button';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface PendingButtonProps extends ButtonProps {
|
|
4
|
+
/** True while the action runs: the button is disabled and, after ~500ms, shows progress. */
|
|
5
|
+
pending?: boolean;
|
|
6
|
+
/** Announced to screen readers while pending ("Saving…"). */
|
|
7
|
+
pendingLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A button for work that takes time. While `pending` it is disabled and
|
|
11
|
+
* `aria-busy`. Once the work is slow (500ms), a spinner covers the label,
|
|
12
|
+
* which stays in the layout, so the button never changes width or freezes
|
|
13
|
+
* silently. Renders the registered `button` primitive, so it follows the
|
|
14
|
+
* project's design system.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PendingButton: React.ForwardRefExoticComponent<PendingButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type KarniErrorKind = "offline" | "network" | "unauthenticated" | "forbidden" | "not-found" | "validation" | "conflict" | "rate-limited" | "timeout" | "server" | "unknown";
|
|
2
|
+
/** What the user was doing, so the message can name it ("You can't delete events."). */
|
|
3
|
+
export interface KarniErrorContext {
|
|
4
|
+
/** A verb: "view", "create", "edit", "delete", "export", "import", or your own. */
|
|
5
|
+
action?: string;
|
|
6
|
+
/** What it was done to, as the sentence needs it: "events", "this event". */
|
|
7
|
+
resource?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface KarniErrorDescription {
|
|
10
|
+
kind: KarniErrorKind;
|
|
11
|
+
/** A short headline in plain words. */
|
|
12
|
+
title: string;
|
|
13
|
+
/** What to do next. */
|
|
14
|
+
description: string;
|
|
15
|
+
/** Whether the same request can succeed if tried again. */
|
|
16
|
+
retryable: boolean;
|
|
17
|
+
/** The server's own explanation, when it gave one worth showing (never for 5xx). */
|
|
18
|
+
detail?: string;
|
|
19
|
+
/** The HTTP status, for logs and project code. Never shown to the user. */
|
|
20
|
+
status?: number;
|
|
21
|
+
}
|
|
22
|
+
/** Classifies `error` and words it for the person using the app. */
|
|
23
|
+
export declare function describeError(error: unknown, context?: KarniErrorContext): KarniErrorDescription;
|
|
24
|
+
/** `describeError(...).title`, capitalised, for one-line contexts (toasts, inline text). */
|
|
25
|
+
export declare function errorSummary(error: unknown, context?: KarniErrorContext): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** How long a request may run before Karni shows progress (ms). */
|
|
2
|
+
export declare const SLOW_AFTER_MS = 500;
|
|
3
|
+
/**
|
|
4
|
+
* True once `active` has stayed true for `delayMs` (default 500ms), false as
|
|
5
|
+
* soon as it turns false. Show progress only for slow work, so a fast request
|
|
6
|
+
* never flashes a spinner.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDelayedFlag(active: boolean, delayMs?: number): boolean;
|
|
9
|
+
/** Returns whether the browser reports a network connection and re-renders when it changes. */
|
|
10
|
+
export declare function useOnlineStatus(): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The theme's pre-paint script, with no React: shared by ThemeProvider and
|
|
3
|
+
* the `@karni/ui/vite` plugin, which runs in Node at build time.
|
|
4
|
+
*/
|
|
5
|
+
/** The localStorage key ThemeProvider keeps the user's choice under. */
|
|
6
|
+
export declare const THEME_STORAGE_KEY = "karni-theme";
|
|
7
|
+
/**
|
|
8
|
+
* Inline script for index.html's `<head>`: applies the stored (or system) theme
|
|
9
|
+
* before the first paint. Uses the default storage key. In a Vite app,
|
|
10
|
+
* `karniTheme()` from `@karni/ui/vite` puts it there.
|
|
11
|
+
*/
|
|
12
|
+
export declare const KARNI_THEME_SCRIPT = "(function(){try{var t=localStorage.getItem(\"karni-theme\");var d=t===\"dark\"||((t===null||t===\"system\")&&matchMedia(\"(prefers-color-scheme: dark)\").matches);document.documentElement.classList.toggle(\"dark\",d);document.documentElement.style.colorScheme=d?\"dark\":\"light\"}catch(e){}})();";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light, dark or the system's choice, for the whole app.
|
|
3
|
+
*
|
|
4
|
+
* <ThemeProvider> // follows the system until the user picks
|
|
5
|
+
* <App /> // <ThemeToggle /> anywhere lets them pick
|
|
6
|
+
* </ThemeProvider>
|
|
7
|
+
*
|
|
8
|
+
* The choice is kept per browser (localStorage) and applied as the `dark`
|
|
9
|
+
* class on <html>, which is what @karni/ui's tokens switch on. Put
|
|
10
|
+
* KARNI_THEME_SCRIPT in index.html's <head> (in a Vite app, `karniTheme()`
|
|
11
|
+
* from `@karni/ui/vite` does) so the first paint already has the right
|
|
12
|
+
* theme (no light flash before React starts).
|
|
13
|
+
*/
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
export type ThemePreference = "light" | "dark" | "system";
|
|
16
|
+
export type ResolvedTheme = "light" | "dark";
|
|
17
|
+
export { KARNI_THEME_SCRIPT, THEME_STORAGE_KEY } from './script';
|
|
18
|
+
interface ThemeContextValue {
|
|
19
|
+
/** What the user chose ("system" follows the operating system). */
|
|
20
|
+
theme: ThemePreference;
|
|
21
|
+
/** What is applied right now. */
|
|
22
|
+
resolvedTheme: ResolvedTheme;
|
|
23
|
+
setTheme: (theme: ThemePreference) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface ThemeProviderProps {
|
|
26
|
+
/** Used until the user chooses, "system" by default. */
|
|
27
|
+
defaultTheme?: ThemePreference;
|
|
28
|
+
/** localStorage key for the user's choice. Change it to keep apps on one origin apart. */
|
|
29
|
+
storageKey?: string;
|
|
30
|
+
/** The element that gets the `dark` class, <html> by default. */
|
|
31
|
+
target?: () => HTMLElement;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/** Rendered once around the app, it applies the user's theme choice and keeps it. */
|
|
35
|
+
export declare function ThemeProvider({ defaultTheme, storageKey, target, children, }: ThemeProviderProps): React.ReactElement;
|
|
36
|
+
/** Returns the theme choice and a setter, and throws a descriptive error outside ThemeProvider. */
|
|
37
|
+
export declare function useTheme(): ThemeContextValue;
|
|
38
|
+
export interface ThemeToggleProps {
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* One button that cycles Light → Dark → System. Its accessible name says the
|
|
43
|
+
* current choice and the next one ("Theme: Dark. Switch to System").
|
|
44
|
+
*/
|
|
45
|
+
export declare function ThemeToggle({ className }: ThemeToggleProps): React.ReactElement;
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @karni/ui design tokens.
|
|
3
|
+
*
|
|
4
|
+
* Every visual value a component uses resolves from a custom property in one
|
|
5
|
+
* of these families:
|
|
6
|
+
*
|
|
7
|
+
* --karni-color-* colours (any CSS colour: hsl(), oklch(), hex, var())
|
|
8
|
+
* --karni-space-* the spacing scale: --karni-space-unit (0.25rem), and any
|
|
9
|
+
* step --karni-space-<n> (4 = 1rem) to override that step
|
|
10
|
+
* --karni-radius-* corner radii (sm, md, lg, xl, full)
|
|
11
|
+
* --karni-font-* families, sizes, line heights, weights, letter spacing
|
|
12
|
+
* --karni-shadow-* elevation (sm, DEFAULT, md, lg)
|
|
13
|
+
* --karni-z-*, --karni-opacity-*, --karni-duration, --karni-ease,
|
|
14
|
+
* --karni-border-width*, --karni-ring-* stacking, opacity, motion, lines
|
|
15
|
+
*
|
|
16
|
+
* The Tailwind preset maps its classes to these properties, so `bg-primary`
|
|
17
|
+
* or `p-4` in a component (or in your own code) reads them. Override any of
|
|
18
|
+
* them in your own stylesheet to retheme every component; `karni ui detect`
|
|
19
|
+
* writes karni-theme.css for you from the project's shadcn/ui, Tailwind,
|
|
20
|
+
* Material UI, Chakra UI or Mantine theme.
|
|
21
|
+
* Add the `dark` class to <html> (or any ancestor) for the dark palette.
|
|
22
|
+
*
|
|
23
|
+
* Both palettes meet WCAG 2.2 AA for every pair the components use (4.5:1
|
|
24
|
+
* text, 3:1 field boundaries, focus rings, icons and chart series);
|
|
25
|
+
* tests/contrast.test.ts computes the ratios from the values below. Check
|
|
26
|
+
* your own overrides against the same pairs.
|
|
27
|
+
*
|
|
28
|
+
* The 0.3 HSL-triplet names (--karni-primary, --karni-border, ...) still
|
|
29
|
+
* work as inputs: each --karni-color-* defaults to its triplet. They are
|
|
30
|
+
* deprecated in 0.4 and removed in 1.0; set --karni-color-* instead.
|
|
31
|
+
*
|
|
32
|
+
* The Django side (the admin, the welcome page) uses this same file: the
|
|
33
|
+
* karni package ships a byte-for-byte copy as the static file
|
|
34
|
+
* karni/tokens.css, and a karni test fails until a change here is copied.
|
|
35
|
+
*/
|
|
36
|
+
:root {
|
|
37
|
+
color-scheme: light;
|
|
38
|
+
|
|
39
|
+
--karni-background: 0 0% 100%;
|
|
40
|
+
--karni-foreground: 224 71.4% 4.1%;
|
|
41
|
+
|
|
42
|
+
--karni-card: 0 0% 100%;
|
|
43
|
+
--karni-card-foreground: 224 71.4% 4.1%;
|
|
44
|
+
|
|
45
|
+
--karni-popover: 0 0% 100%;
|
|
46
|
+
--karni-popover-foreground: 224 71.4% 4.1%;
|
|
47
|
+
|
|
48
|
+
--karni-primary: 220.9 39.3% 11%;
|
|
49
|
+
--karni-primary-foreground: 210 20% 98%;
|
|
50
|
+
|
|
51
|
+
--karni-secondary: 220 14.3% 95.9%;
|
|
52
|
+
--karni-secondary-foreground: 220.9 39.3% 11%;
|
|
53
|
+
|
|
54
|
+
--karni-muted: 220 14.3% 95.9%;
|
|
55
|
+
--karni-muted-foreground: 220 8.9% 43%;
|
|
56
|
+
|
|
57
|
+
--karni-accent: 220 14.3% 95.9%;
|
|
58
|
+
--karni-accent-foreground: 220.9 39.3% 11%;
|
|
59
|
+
|
|
60
|
+
--karni-destructive: 0 72% 46%;
|
|
61
|
+
--karni-destructive-foreground: 210 20% 98%;
|
|
62
|
+
|
|
63
|
+
--karni-border: 220 13% 91%;
|
|
64
|
+
--karni-input: 220 9% 56%;
|
|
65
|
+
--karni-ring: 224 71.4% 4.1%;
|
|
66
|
+
|
|
67
|
+
--karni-radius: 0.5rem;
|
|
68
|
+
|
|
69
|
+
/* DataChart series colors (chart-1 .. chart-5). */
|
|
70
|
+
--karni-chart-1: 220 70% 50%;
|
|
71
|
+
--karni-chart-2: 160 60% 36%;
|
|
72
|
+
--karni-chart-3: 30 80% 42%;
|
|
73
|
+
--karni-chart-4: 280 65% 60%;
|
|
74
|
+
--karni-chart-5: 340 75% 55%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.dark {
|
|
78
|
+
color-scheme: dark;
|
|
79
|
+
|
|
80
|
+
--karni-background: 224 71.4% 4.1%;
|
|
81
|
+
--karni-foreground: 210 20% 98%;
|
|
82
|
+
|
|
83
|
+
--karni-card: 224 71.4% 4.1%;
|
|
84
|
+
--karni-card-foreground: 210 20% 98%;
|
|
85
|
+
|
|
86
|
+
--karni-popover: 224 71.4% 4.1%;
|
|
87
|
+
--karni-popover-foreground: 210 20% 98%;
|
|
88
|
+
|
|
89
|
+
--karni-primary: 210 20% 98%;
|
|
90
|
+
--karni-primary-foreground: 220.9 39.3% 11%;
|
|
91
|
+
|
|
92
|
+
--karni-secondary: 215 27.9% 16.9%;
|
|
93
|
+
--karni-secondary-foreground: 210 20% 98%;
|
|
94
|
+
|
|
95
|
+
--karni-muted: 215 27.9% 16.9%;
|
|
96
|
+
--karni-muted-foreground: 217.9 10.6% 64.9%;
|
|
97
|
+
|
|
98
|
+
--karni-accent: 215 27.9% 16.9%;
|
|
99
|
+
--karni-accent-foreground: 210 20% 98%;
|
|
100
|
+
|
|
101
|
+
--karni-destructive: 0 84% 67%;
|
|
102
|
+
--karni-destructive-foreground: 224 71.4% 4.1%;
|
|
103
|
+
|
|
104
|
+
--karni-border: 215 27.9% 16.9%;
|
|
105
|
+
--karni-input: 215 14% 42%;
|
|
106
|
+
--karni-ring: 216 12.2% 83.9%;
|
|
107
|
+
|
|
108
|
+
--karni-chart-1: 217 91% 60%;
|
|
109
|
+
--karni-chart-2: 160 60% 45%;
|
|
110
|
+
--karni-chart-3: 30 80% 55%;
|
|
111
|
+
--karni-chart-4: 280 65% 60%;
|
|
112
|
+
--karni-chart-5: 340 75% 55%;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* The colour layer components read. Declared on .dark as well so a dark
|
|
116
|
+
subtree recomputes them from its own values. */
|
|
117
|
+
:root,
|
|
118
|
+
.dark {
|
|
119
|
+
--karni-color-background: hsl(var(--karni-background));
|
|
120
|
+
--karni-color-foreground: hsl(var(--karni-foreground));
|
|
121
|
+
--karni-color-card: hsl(var(--karni-card));
|
|
122
|
+
--karni-color-card-foreground: hsl(var(--karni-card-foreground));
|
|
123
|
+
--karni-color-popover: hsl(var(--karni-popover));
|
|
124
|
+
--karni-color-popover-foreground: hsl(var(--karni-popover-foreground));
|
|
125
|
+
--karni-color-primary: hsl(var(--karni-primary));
|
|
126
|
+
--karni-color-primary-foreground: hsl(var(--karni-primary-foreground));
|
|
127
|
+
--karni-color-primary-hover: color-mix(in srgb, var(--karni-color-primary) 90%, transparent);
|
|
128
|
+
--karni-color-secondary: hsl(var(--karni-secondary));
|
|
129
|
+
--karni-color-secondary-foreground: hsl(var(--karni-secondary-foreground));
|
|
130
|
+
--karni-color-secondary-hover: color-mix(in srgb, var(--karni-color-secondary) 80%, transparent);
|
|
131
|
+
--karni-color-muted: hsl(var(--karni-muted));
|
|
132
|
+
--karni-color-muted-foreground: hsl(var(--karni-muted-foreground));
|
|
133
|
+
--karni-color-muted-subtle: color-mix(in srgb, var(--karni-color-muted) 50%, transparent);
|
|
134
|
+
--karni-color-accent: hsl(var(--karni-accent));
|
|
135
|
+
--karni-color-accent-foreground: hsl(var(--karni-accent-foreground));
|
|
136
|
+
--karni-color-destructive: hsl(var(--karni-destructive));
|
|
137
|
+
--karni-color-destructive-foreground: hsl(var(--karni-destructive-foreground));
|
|
138
|
+
--karni-color-destructive-hover: color-mix(
|
|
139
|
+
in srgb,
|
|
140
|
+
var(--karni-color-destructive) 90%,
|
|
141
|
+
transparent
|
|
142
|
+
);
|
|
143
|
+
--karni-color-destructive-subtle: color-mix(
|
|
144
|
+
in srgb,
|
|
145
|
+
var(--karni-color-destructive) 10%,
|
|
146
|
+
transparent
|
|
147
|
+
);
|
|
148
|
+
--karni-color-destructive-border: color-mix(
|
|
149
|
+
in srgb,
|
|
150
|
+
var(--karni-color-destructive) 50%,
|
|
151
|
+
transparent
|
|
152
|
+
);
|
|
153
|
+
--karni-color-border: hsl(var(--karni-border));
|
|
154
|
+
--karni-color-input: hsl(var(--karni-input));
|
|
155
|
+
--karni-color-ring: hsl(var(--karni-ring));
|
|
156
|
+
--karni-color-overlay: color-mix(in srgb, var(--karni-color-foreground) 40%, transparent);
|
|
157
|
+
--karni-color-chart-1: hsl(var(--karni-chart-1));
|
|
158
|
+
--karni-color-chart-2: hsl(var(--karni-chart-2));
|
|
159
|
+
--karni-color-chart-3: hsl(var(--karni-chart-3));
|
|
160
|
+
--karni-color-chart-4: hsl(var(--karni-chart-4));
|
|
161
|
+
--karni-color-chart-5: hsl(var(--karni-chart-5));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* The scrim behind a modal or the mobile drawer dims the page in both
|
|
165
|
+
themes: the dark theme's foreground is light, so its scrim is the
|
|
166
|
+
background colour instead. */
|
|
167
|
+
.dark {
|
|
168
|
+
--karni-color-overlay: color-mix(in srgb, var(--karni-color-background) 80%, transparent);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Size, type, elevation, stacking and motion. The preset falls back to the
|
|
172
|
+
same values when a property is unset. */
|
|
173
|
+
:root {
|
|
174
|
+
--karni-space-unit: 0.25rem;
|
|
175
|
+
|
|
176
|
+
--karni-radius-sm: calc(var(--karni-radius) - 4px);
|
|
177
|
+
--karni-radius-md: calc(var(--karni-radius) - 2px);
|
|
178
|
+
--karni-radius-lg: var(--karni-radius);
|
|
179
|
+
--karni-radius-xl: calc(var(--karni-radius) + 4px);
|
|
180
|
+
--karni-radius-full: 9999px;
|
|
181
|
+
|
|
182
|
+
--karni-font-sans:
|
|
183
|
+
ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
|
|
184
|
+
"Noto Color Emoji";
|
|
185
|
+
--karni-font-mono:
|
|
186
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
|
|
187
|
+
monospace;
|
|
188
|
+
--karni-font-size-xs: 0.75rem;
|
|
189
|
+
--karni-font-size-sm: 0.875rem;
|
|
190
|
+
--karni-font-size-base: 1rem;
|
|
191
|
+
--karni-font-size-lg: 1.125rem;
|
|
192
|
+
--karni-font-size-xl: 1.25rem;
|
|
193
|
+
--karni-font-size-2xl: 1.5rem;
|
|
194
|
+
--karni-font-leading-xs: 1rem;
|
|
195
|
+
--karni-font-leading-sm: 1.25rem;
|
|
196
|
+
--karni-font-leading-base: 1.5rem;
|
|
197
|
+
--karni-font-leading-lg: 1.75rem;
|
|
198
|
+
--karni-font-leading-xl: 1.75rem;
|
|
199
|
+
--karni-font-leading-2xl: 2rem;
|
|
200
|
+
--karni-font-leading-none: 1;
|
|
201
|
+
--karni-font-weight-normal: 400;
|
|
202
|
+
--karni-font-weight-medium: 500;
|
|
203
|
+
--karni-font-weight-semibold: 600;
|
|
204
|
+
--karni-font-weight-bold: 700;
|
|
205
|
+
--karni-font-tracking-tight: -0.025em;
|
|
206
|
+
--karni-font-tracking-wide: 0.025em;
|
|
207
|
+
--karni-font-underline-offset: 4px;
|
|
208
|
+
|
|
209
|
+
/* Tailwind 4's scale (its shadow-sm is Tailwind 3's bare shadow). */
|
|
210
|
+
--karni-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
211
|
+
--karni-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
212
|
+
--karni-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
213
|
+
--karni-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
214
|
+
|
|
215
|
+
--karni-border-width: 1px;
|
|
216
|
+
--karni-border-width-2: 2px;
|
|
217
|
+
--karni-ring-width: 2px;
|
|
218
|
+
--karni-ring-width-1: 1px;
|
|
219
|
+
--karni-ring-offset-width: 2px;
|
|
220
|
+
|
|
221
|
+
/* ResourceTable scrolls inside a box this tall (its header sticks); `none`
|
|
222
|
+
lets the page scroll instead. */
|
|
223
|
+
--karni-table-max-height: 70vh;
|
|
224
|
+
|
|
225
|
+
--karni-z-raised: 10;
|
|
226
|
+
--karni-z-drawer: 40;
|
|
227
|
+
--karni-z-popover: 50;
|
|
228
|
+
--karni-z-modal: 50;
|
|
229
|
+
--karni-z-toast: 100;
|
|
230
|
+
|
|
231
|
+
--karni-opacity-50: 0.5;
|
|
232
|
+
--karni-opacity-60: 0.6;
|
|
233
|
+
--karni-opacity-70: 0.7;
|
|
234
|
+
--karni-opacity-90: 0.9;
|
|
235
|
+
|
|
236
|
+
--karni-duration: 150ms;
|
|
237
|
+
--karni-duration-pulse: 2s;
|
|
238
|
+
--karni-duration-spin: 1s;
|
|
239
|
+
--karni-ease: cubic-bezier(0.4, 0, 0.2, 1);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (prefers-reduced-motion: reduce) {
|
|
243
|
+
:root {
|
|
244
|
+
--karni-duration: 0ms;
|
|
245
|
+
--karni-duration-pulse: 0s;
|
|
246
|
+
--karni-duration-spin: 0s;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function e(e){return`color-mix(in srgb, var(--karni-color-${e}) calc(<alpha-value> * 100%), transparent)`}var t=[.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,128];function n(){let e={0:`0px`,px:`var(--karni-space-px, 1px)`};for(let n of t){let t=String(n).replace(`.`,`-`);e[String(n)]=`var(--karni-space-${t}, calc(var(--karni-space-unit, 0.25rem) * ${n}))`}return e}var r={xs:[`0.75rem`,`1rem`],sm:[`0.875rem`,`1.25rem`],base:[`1rem`,`1.5rem`],lg:[`1.125rem`,`1.75rem`],xl:[`1.25rem`,`1.75rem`],"2xl":[`1.5rem`,`2rem`]};function i(){return Object.fromEntries(Object.entries(r).map(([e,[t,n]])=>[e,[`var(--karni-font-size-${e}, ${t})`,{lineHeight:`var(--karni-font-leading-${e}, ${n})`}]]))}var a={darkMode:`class`,theme:{extend:{colors:{background:e(`background`),foreground:e(`foreground`),card:{DEFAULT:e(`card`),foreground:e(`card-foreground`)},popover:{DEFAULT:e(`popover`),foreground:e(`popover-foreground`)},primary:{DEFAULT:e(`primary`),foreground:e(`primary-foreground`),hover:e(`primary-hover`)},secondary:{DEFAULT:e(`secondary`),foreground:e(`secondary-foreground`),hover:e(`secondary-hover`)},muted:{DEFAULT:e(`muted`),foreground:e(`muted-foreground`),subtle:e(`muted-subtle`)},accent:{DEFAULT:e(`accent`),foreground:e(`accent-foreground`)},destructive:{DEFAULT:e(`destructive`),foreground:e(`destructive-foreground`),hover:e(`destructive-hover`),subtle:e(`destructive-subtle`),border:e(`destructive-border`)},border:e(`border`),input:e(`input`),ring:e(`ring`),overlay:e(`overlay`),chart:{1:e(`chart-1`),2:e(`chart-2`),3:e(`chart-3`),4:e(`chart-4`),5:e(`chart-5`)}},borderColor:{DEFAULT:e(`border`)},spacing:n(),borderRadius:{DEFAULT:`var(--karni-radius-sm, 0.25rem)`,sm:`var(--karni-radius-sm, 0.25rem)`,md:`var(--karni-radius-md, 0.375rem)`,lg:`var(--karni-radius-lg, 0.5rem)`,xl:`var(--karni-radius-xl, 0.75rem)`,full:`var(--karni-radius-full, 9999px)`},fontFamily:{sans:`var(--karni-font-sans, ui-sans-serif, system-ui, sans-serif)`,mono:`var(--karni-font-mono, ui-monospace, monospace)`},fontSize:i(),fontWeight:{normal:`var(--karni-font-weight-normal, 400)`,medium:`var(--karni-font-weight-medium, 500)`,semibold:`var(--karni-font-weight-semibold, 600)`,bold:`var(--karni-font-weight-bold, 700)`},lineHeight:{none:`var(--karni-font-leading-none, 1)`},textUnderlineOffset:{4:`var(--karni-font-underline-offset, 4px)`},letterSpacing:{tight:`var(--karni-font-tracking-tight, -0.025em)`,wide:`var(--karni-font-tracking-wide, 0.025em)`},boxShadow:{sm:`var(--karni-shadow-sm, 0 1px 3px 0 rgb(0 0 0 / 0.1))`,DEFAULT:`var(--karni-shadow, 0 1px 3px 0 rgb(0 0 0 / 0.1))`,md:`var(--karni-shadow-md, 0 4px 6px -1px rgb(0 0 0 / 0.1))`,lg:`var(--karni-shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.1))`},borderWidth:{DEFAULT:`var(--karni-border-width, 1px)`,2:`var(--karni-border-width-2, 2px)`},divideWidth:{DEFAULT:`var(--karni-border-width, 1px)`},outlineWidth:{DEFAULT:`var(--karni-border-width, 1px)`},ringWidth:{1:`var(--karni-ring-width-1, 1px)`,2:`var(--karni-ring-width, 2px)`},ringOffsetWidth:{2:`var(--karni-ring-offset-width, 2px)`},zIndex:{raised:`var(--karni-z-raised, 10)`,drawer:`var(--karni-z-drawer, 40)`,popover:`var(--karni-z-popover, 50)`,modal:`var(--karni-z-modal, 50)`,toast:`var(--karni-z-toast, 100)`},opacity:{50:`var(--karni-opacity-50, 0.5)`,60:`var(--karni-opacity-60, 0.6)`,70:`var(--karni-opacity-70, 0.7)`,90:`var(--karni-opacity-90, 0.9)`},transitionDuration:{DEFAULT:`var(--karni-duration, 150ms)`},transitionTimingFunction:{DEFAULT:`var(--karni-ease, cubic-bezier(0.4, 0, 0.2, 1))`},animation:{pulse:`pulse var(--karni-duration-pulse, 2s) cubic-bezier(0.4, 0, 0.6, 1) infinite`,spin:`spin var(--karni-duration-spin, 1s) linear infinite`}}}};exports.SPACE_STEPS=t,exports.default=a;
|
|
2
|
+
//# sourceMappingURL=tailwind-preset.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-preset.cjs","names":["color","name","SPACE_STEPS","spacing","scale","step","FONT_SIZES","fontSize","size","leading","karniPreset"],"sources":["../tailwind-preset.ts"],"sourcesContent":["/**\n * Tailwind preset for @karni/ui consumers (Tailwind 3, and 4 through @config).\n *\n * Usage (tailwind.config.ts of the consuming app):\n *\n * ```ts\n * import karniPreset from \"@karni/ui/tailwind-preset\";\n *\n * export default {\n * presets: [karniPreset],\n * content: [\n * \"./src/**\\/*.{ts,tsx}\",\n * \"./node_modules/@karni/ui/dist/**\\/*.js\",\n * ],\n * };\n * ```\n *\n * Also import \"@karni/ui/styles.css\" once (it defines the --karni-* tokens).\n * Tailwind v4 loads the same config through `@config` in CSS, next to\n * `@import \"@karni/ui/tailwind-v4.css\"` (see the README).\n */\nimport type { Config } from \"tailwindcss\";\n\n/**\n * A colour token as a Tailwind colour. Wrapping it in color-mix with\n * `<alpha-value>` keeps opacity modifiers (`bg-primary/50`) working in\n * Tailwind 3 as well as 4, for any colour format the token holds.\n */\nfunction color(name: string): string {\n return `color-mix(in srgb, var(--karni-color-${name}) calc(<alpha-value> * 100%), transparent)`;\n}\n\n/** The spacing scale: each step reads --karni-space-<n>, else n × --karni-space-unit. */\nexport const SPACE_STEPS = [\n 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48,\n 52, 56, 60, 64, 72, 80, 96, 128,\n] as const;\n\nfunction spacing(): Record<string, string> {\n const scale: Record<string, string> = {\n 0: \"0px\",\n px: \"var(--karni-space-px, 1px)\",\n };\n for (const step of SPACE_STEPS) {\n const name = String(step).replace(\".\", \"-\");\n scale[String(step)] =\n `var(--karni-space-${name}, calc(var(--karni-space-unit, 0.25rem) * ${step}))`;\n }\n return scale;\n}\n\nconst FONT_SIZES = {\n xs: [\"0.75rem\", \"1rem\"],\n sm: [\"0.875rem\", \"1.25rem\"],\n base: [\"1rem\", \"1.5rem\"],\n lg: [\"1.125rem\", \"1.75rem\"],\n xl: [\"1.25rem\", \"1.75rem\"],\n \"2xl\": [\"1.5rem\", \"2rem\"],\n} as const;\n\nfunction fontSize(): Record<string, [string, { lineHeight: string }]> {\n return Object.fromEntries(\n Object.entries(FONT_SIZES).map(([name, [size, leading]]) => [\n name,\n [\n `var(--karni-font-size-${name}, ${size})`,\n { lineHeight: `var(--karni-font-leading-${name}, ${leading})` },\n ],\n ]),\n );\n}\n\nconst karniPreset = {\n // `as const` keeps the literal type so the preset stays assignable to\n // Config[\"presets\"] when consumers spread it into their own config.\n darkMode: \"class\" as const,\n theme: {\n extend: {\n colors: {\n background: color(\"background\"),\n foreground: color(\"foreground\"),\n card: { DEFAULT: color(\"card\"), foreground: color(\"card-foreground\") },\n popover: { DEFAULT: color(\"popover\"), foreground: color(\"popover-foreground\") },\n primary: {\n DEFAULT: color(\"primary\"),\n foreground: color(\"primary-foreground\"),\n hover: color(\"primary-hover\"),\n },\n secondary: {\n DEFAULT: color(\"secondary\"),\n foreground: color(\"secondary-foreground\"),\n hover: color(\"secondary-hover\"),\n },\n muted: {\n DEFAULT: color(\"muted\"),\n foreground: color(\"muted-foreground\"),\n subtle: color(\"muted-subtle\"),\n },\n accent: { DEFAULT: color(\"accent\"), foreground: color(\"accent-foreground\") },\n destructive: {\n DEFAULT: color(\"destructive\"),\n foreground: color(\"destructive-foreground\"),\n hover: color(\"destructive-hover\"),\n subtle: color(\"destructive-subtle\"),\n border: color(\"destructive-border\"),\n },\n border: color(\"border\"),\n input: color(\"input\"),\n ring: color(\"ring\"),\n overlay: color(\"overlay\"),\n chart: {\n \"1\": color(\"chart-1\"),\n \"2\": color(\"chart-2\"),\n \"3\": color(\"chart-3\"),\n \"4\": color(\"chart-4\"),\n \"5\": color(\"chart-5\"),\n },\n },\n borderColor: {\n // A bare `border` class uses the token, never Tailwind's default gray.\n DEFAULT: color(\"border\"),\n },\n spacing: spacing(),\n borderRadius: {\n DEFAULT: \"var(--karni-radius-sm, 0.25rem)\",\n sm: \"var(--karni-radius-sm, 0.25rem)\",\n md: \"var(--karni-radius-md, 0.375rem)\",\n lg: \"var(--karni-radius-lg, 0.5rem)\",\n xl: \"var(--karni-radius-xl, 0.75rem)\",\n full: \"var(--karni-radius-full, 9999px)\",\n },\n fontFamily: {\n sans: \"var(--karni-font-sans, ui-sans-serif, system-ui, sans-serif)\",\n mono: \"var(--karni-font-mono, ui-monospace, monospace)\",\n },\n fontSize: fontSize(),\n fontWeight: {\n normal: \"var(--karni-font-weight-normal, 400)\",\n medium: \"var(--karni-font-weight-medium, 500)\",\n semibold: \"var(--karni-font-weight-semibold, 600)\",\n bold: \"var(--karni-font-weight-bold, 700)\",\n },\n lineHeight: { none: \"var(--karni-font-leading-none, 1)\" },\n textUnderlineOffset: { \"4\": \"var(--karni-font-underline-offset, 4px)\" },\n letterSpacing: {\n tight: \"var(--karni-font-tracking-tight, -0.025em)\",\n wide: \"var(--karni-font-tracking-wide, 0.025em)\",\n },\n boxShadow: {\n sm: \"var(--karni-shadow-sm, 0 1px 3px 0 rgb(0 0 0 / 0.1))\",\n DEFAULT: \"var(--karni-shadow, 0 1px 3px 0 rgb(0 0 0 / 0.1))\",\n md: \"var(--karni-shadow-md, 0 4px 6px -1px rgb(0 0 0 / 0.1))\",\n lg: \"var(--karni-shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.1))\",\n },\n borderWidth: {\n DEFAULT: \"var(--karni-border-width, 1px)\",\n \"2\": \"var(--karni-border-width-2, 2px)\",\n },\n divideWidth: { DEFAULT: \"var(--karni-border-width, 1px)\" },\n outlineWidth: { DEFAULT: \"var(--karni-border-width, 1px)\" },\n ringWidth: {\n \"1\": \"var(--karni-ring-width-1, 1px)\",\n \"2\": \"var(--karni-ring-width, 2px)\",\n },\n ringOffsetWidth: { \"2\": \"var(--karni-ring-offset-width, 2px)\" },\n zIndex: {\n raised: \"var(--karni-z-raised, 10)\",\n drawer: \"var(--karni-z-drawer, 40)\",\n popover: \"var(--karni-z-popover, 50)\",\n modal: \"var(--karni-z-modal, 50)\",\n toast: \"var(--karni-z-toast, 100)\",\n },\n opacity: {\n \"50\": \"var(--karni-opacity-50, 0.5)\",\n \"60\": \"var(--karni-opacity-60, 0.6)\",\n \"70\": \"var(--karni-opacity-70, 0.7)\",\n \"90\": \"var(--karni-opacity-90, 0.9)\",\n },\n transitionDuration: { DEFAULT: \"var(--karni-duration, 150ms)\" },\n transitionTimingFunction: { DEFAULT: \"var(--karni-ease, cubic-bezier(0.4, 0, 0.2, 1))\" },\n animation: {\n pulse: \"pulse var(--karni-duration-pulse, 2s) cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n spin: \"spin var(--karni-duration-spin, 1s) linear infinite\",\n },\n },\n },\n} satisfies Omit<Config, \"content\">;\n\nexport default karniPreset;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/** The spacing scale: each step reads --karni-space-<n>, else n × --karni-space-unit. */
|
|
2
|
+
export declare const SPACE_STEPS: readonly [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96, 128];
|
|
3
|
+
declare const karniPreset: {
|
|
4
|
+
darkMode: "class";
|
|
5
|
+
theme: {
|
|
6
|
+
extend: {
|
|
7
|
+
colors: {
|
|
8
|
+
background: string;
|
|
9
|
+
foreground: string;
|
|
10
|
+
card: {
|
|
11
|
+
DEFAULT: string;
|
|
12
|
+
foreground: string;
|
|
13
|
+
};
|
|
14
|
+
popover: {
|
|
15
|
+
DEFAULT: string;
|
|
16
|
+
foreground: string;
|
|
17
|
+
};
|
|
18
|
+
primary: {
|
|
19
|
+
DEFAULT: string;
|
|
20
|
+
foreground: string;
|
|
21
|
+
hover: string;
|
|
22
|
+
};
|
|
23
|
+
secondary: {
|
|
24
|
+
DEFAULT: string;
|
|
25
|
+
foreground: string;
|
|
26
|
+
hover: string;
|
|
27
|
+
};
|
|
28
|
+
muted: {
|
|
29
|
+
DEFAULT: string;
|
|
30
|
+
foreground: string;
|
|
31
|
+
subtle: string;
|
|
32
|
+
};
|
|
33
|
+
accent: {
|
|
34
|
+
DEFAULT: string;
|
|
35
|
+
foreground: string;
|
|
36
|
+
};
|
|
37
|
+
destructive: {
|
|
38
|
+
DEFAULT: string;
|
|
39
|
+
foreground: string;
|
|
40
|
+
hover: string;
|
|
41
|
+
subtle: string;
|
|
42
|
+
border: string;
|
|
43
|
+
};
|
|
44
|
+
border: string;
|
|
45
|
+
input: string;
|
|
46
|
+
ring: string;
|
|
47
|
+
overlay: string;
|
|
48
|
+
chart: {
|
|
49
|
+
"1": string;
|
|
50
|
+
"2": string;
|
|
51
|
+
"3": string;
|
|
52
|
+
"4": string;
|
|
53
|
+
"5": string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
borderColor: {
|
|
57
|
+
DEFAULT: string;
|
|
58
|
+
};
|
|
59
|
+
spacing: Record<string, string>;
|
|
60
|
+
borderRadius: {
|
|
61
|
+
DEFAULT: string;
|
|
62
|
+
sm: string;
|
|
63
|
+
md: string;
|
|
64
|
+
lg: string;
|
|
65
|
+
xl: string;
|
|
66
|
+
full: string;
|
|
67
|
+
};
|
|
68
|
+
fontFamily: {
|
|
69
|
+
sans: string;
|
|
70
|
+
mono: string;
|
|
71
|
+
};
|
|
72
|
+
fontSize: Record<string, [string, {
|
|
73
|
+
lineHeight: string;
|
|
74
|
+
}]>;
|
|
75
|
+
fontWeight: {
|
|
76
|
+
normal: string;
|
|
77
|
+
medium: string;
|
|
78
|
+
semibold: string;
|
|
79
|
+
bold: string;
|
|
80
|
+
};
|
|
81
|
+
lineHeight: {
|
|
82
|
+
none: string;
|
|
83
|
+
};
|
|
84
|
+
textUnderlineOffset: {
|
|
85
|
+
"4": string;
|
|
86
|
+
};
|
|
87
|
+
letterSpacing: {
|
|
88
|
+
tight: string;
|
|
89
|
+
wide: string;
|
|
90
|
+
};
|
|
91
|
+
boxShadow: {
|
|
92
|
+
sm: string;
|
|
93
|
+
DEFAULT: string;
|
|
94
|
+
md: string;
|
|
95
|
+
lg: string;
|
|
96
|
+
};
|
|
97
|
+
borderWidth: {
|
|
98
|
+
DEFAULT: string;
|
|
99
|
+
"2": string;
|
|
100
|
+
};
|
|
101
|
+
divideWidth: {
|
|
102
|
+
DEFAULT: string;
|
|
103
|
+
};
|
|
104
|
+
outlineWidth: {
|
|
105
|
+
DEFAULT: string;
|
|
106
|
+
};
|
|
107
|
+
ringWidth: {
|
|
108
|
+
"1": string;
|
|
109
|
+
"2": string;
|
|
110
|
+
};
|
|
111
|
+
ringOffsetWidth: {
|
|
112
|
+
"2": string;
|
|
113
|
+
};
|
|
114
|
+
zIndex: {
|
|
115
|
+
raised: string;
|
|
116
|
+
drawer: string;
|
|
117
|
+
popover: string;
|
|
118
|
+
modal: string;
|
|
119
|
+
toast: string;
|
|
120
|
+
};
|
|
121
|
+
opacity: {
|
|
122
|
+
"50": string;
|
|
123
|
+
"60": string;
|
|
124
|
+
"70": string;
|
|
125
|
+
"90": string;
|
|
126
|
+
};
|
|
127
|
+
transitionDuration: {
|
|
128
|
+
DEFAULT: string;
|
|
129
|
+
};
|
|
130
|
+
transitionTimingFunction: {
|
|
131
|
+
DEFAULT: string;
|
|
132
|
+
};
|
|
133
|
+
animation: {
|
|
134
|
+
pulse: string;
|
|
135
|
+
spin: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
export default karniPreset;
|