@maykonpaulo/maestro-admin 0.4.0-next.0 → 0.4.0-next.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/README.md +20 -0
- package/dist/index.d.ts +36 -2
- package/dist/index.js +391 -301
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/styles.css +7 -7
package/README.md
CHANGED
|
@@ -636,6 +636,26 @@ The header carries a palette picker, a light/dark toggle (system → light → d
|
|
|
636
636
|
|
|
637
637
|
`tokens` is applied inline on the admin root, so it wins over the preset in both light and dark. The full token list is at the top of `src/styles.css`; the ones you will reach for most are `--maestro-brand`, `--maestro-shell`, `--maestro-bg`, `--maestro-surface`, `--maestro-border`, `--maestro-fg` and `--maestro-radius`.
|
|
638
638
|
|
|
639
|
+
### The mark
|
|
640
|
+
|
|
641
|
+
`MaestroMark` and `MaestroSeal` are exported, drawn inline in `currentColor`, and carry no colour of their own — set `color` on them and they follow whatever palette is active. That is why the sidebar logo changes with the theme without shipping one asset per palette:
|
|
642
|
+
|
|
643
|
+
```tsx
|
|
644
|
+
<MaestroMark size={30} style={{ color: 'var(--maestro-brand)' }} title="Maestro" />
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
Use `MaestroMark` where there is horizontal room and `MaestroSeal` where the shape is square by obligation or below 16px, where the mark's slices close up. The geometry, the spacing rules and the source SVGs live in [`brand/`](../../brand) at the repo root.
|
|
648
|
+
|
|
649
|
+
### Favicon
|
|
650
|
+
|
|
651
|
+
A favicon is a separate document: it cannot read the admin's theme attribute, so following the palette means swapping the file. That is the host page's asset, so it is opt-in:
|
|
652
|
+
|
|
653
|
+
```tsx
|
|
654
|
+
<MaestroAdmin theme={{ favicon: (name) => `/favicon-${name}.svg` }} />
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
The admin then updates an existing `<link rel="icon">` whenever the operator switches palette. It never injects one, and without the option the tab icon stays exactly as the host set it. `brand/` ships a ready favicon per palette, each already switching between light and dark via `prefers-color-scheme`.
|
|
658
|
+
|
|
639
659
|
### The admin never scrolls sideways
|
|
640
660
|
|
|
641
661
|
Every screen scrolls vertically only. The hub uses fluid card tracks, the sidebar collapses to icons under 900px, and list tables have fixed column widths with truncation — so an entity with thirty fields does not become thirty columns. Which columns are on screen is the operator's call, from **Columns** in the list toolbar, remembered per entity; the default selection comes from `primaryListFields()` and **Reset columns** hands the decision back to it.
|
package/dist/index.d.ts
CHANGED
|
@@ -275,6 +275,20 @@ interface MaestroThemeConfig {
|
|
|
275
275
|
picker?: boolean;
|
|
276
276
|
/** Remember the operator's choices in `localStorage`. Defaults to `true`. */
|
|
277
277
|
remember?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Keeps the page's `<link rel="icon">` in step with the active palette. Given the palette name,
|
|
280
|
+
* return the URL of the matching icon:
|
|
281
|
+
*
|
|
282
|
+
* ```ts
|
|
283
|
+
* favicon: (theme) => `/favicon-${theme}.svg`
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* Opt-in, and deliberately a function rather than a built-in path: a favicon is a document-level
|
|
287
|
+
* asset the host page owns, and an embedded admin has no business guessing that
|
|
288
|
+
* `/favicon-latao.svg` is served. Without it the tab icon simply stays as the host set it. Only an
|
|
289
|
+
* existing `<link rel="icon">` is updated — the admin never injects one.
|
|
290
|
+
*/
|
|
291
|
+
favicon?: (preset: MaestroThemeName) => string | undefined;
|
|
278
292
|
}
|
|
279
293
|
/** `theme="cobalto"` is shorthand for `theme={{ preset: 'cobalto' }}`. */
|
|
280
294
|
type MaestroThemeInput = MaestroThemeName | MaestroThemeConfig;
|
|
@@ -475,7 +489,6 @@ declare function Sidebar({ entities, activeId, onSelect, title, labels, recents,
|
|
|
475
489
|
*/
|
|
476
490
|
declare const PATHS: {
|
|
477
491
|
readonly hub: react.JSX.Element;
|
|
478
|
-
readonly baton: react.JSX.Element;
|
|
479
492
|
readonly search: react.JSX.Element;
|
|
480
493
|
readonly chevronRight: react.JSX.Element;
|
|
481
494
|
readonly chevronLeft: react.JSX.Element;
|
|
@@ -589,6 +602,27 @@ declare function CommandPalette({ sections, onClose }: {
|
|
|
589
602
|
onClose: () => void;
|
|
590
603
|
}): react.ReactPortal;
|
|
591
604
|
|
|
605
|
+
/**
|
|
606
|
+
* The mark: an M sliced into three horizontal bands — a stave and a table in the same shape. Use it
|
|
607
|
+
* wherever there is horizontal room (sidebar, header, docs). Below 16px of height the slices close
|
|
608
|
+
* up; use `<MaestroSeal>` there instead.
|
|
609
|
+
*/
|
|
610
|
+
declare function MaestroMark({ size, className, title, }: {
|
|
611
|
+
size?: number;
|
|
612
|
+
className?: string;
|
|
613
|
+
title?: string;
|
|
614
|
+
}): ReactElement;
|
|
615
|
+
/**
|
|
616
|
+
* The seal: the same M knocked out of a solid container, keeping only the first slice — the
|
|
617
|
+
* container holds the form at sizes where the mark's bands would close. Use it where the shape is
|
|
618
|
+
* square by obligation (app icon, avatar) or below 16px.
|
|
619
|
+
*/
|
|
620
|
+
declare function MaestroSeal({ size, className, title, }: {
|
|
621
|
+
size?: number;
|
|
622
|
+
className?: string;
|
|
623
|
+
title?: string;
|
|
624
|
+
}): ReactElement;
|
|
625
|
+
|
|
592
626
|
type Variant = 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
593
627
|
declare function Button({ variant, icon, className, children, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
594
628
|
variant?: Variant;
|
|
@@ -664,4 +698,4 @@ declare function JsonInput({ field, value, onChange, disabled, }: {
|
|
|
664
698
|
disabled?: boolean;
|
|
665
699
|
}): react.JSX.Element;
|
|
666
700
|
|
|
667
|
-
export { AdminClientProvider, type AdminLabels, type AdminLocale, type AdminStrings, type AsyncState, Badge, Button, type ColumnPrefs, CommandPalette, type Crumb, EmptyState, type EntityCapabilities, EntityDetail, EntityForm, type EntityLabelOverride, EntityList, type EntityMetadata, ErrorBanner, FieldInput, type FieldMetadata, FieldValue, type FilterInput, Header, Hub, I18nProvider, Icon, IconButton, type IconName, JsonInput, type ListQuery, type ListResult, MAESTRO_THEMES, MaestroAdmin, type MaestroAdminProps, MaestroApiError, MaestroClient, type MaestroClientConfig, type MaestroDensity, type MaestroMetadata, type MaestroScheme, type MaestroThemeConfig, type MaestroThemeInput, type MaestroThemeName, type MaestroThemeOption, MaestroThemeProvider, type MaestroThemeState, type MenuGroup, ObjectValue, type PaletteCommand, type PaletteSection, Sidebar, type SidebarMenu, Spinner, Toast, applyLabels, buildMenu, detailFields, entityCommands, entityIcon, formFields, listFields, primaryListFields, stringsFor, useAdminRoot, useAsync, useClient, useColumnPrefs, useEntities, useEntity, useEntityList, useEntityRecord, useMetadata, useRecents, useT, useTheme };
|
|
701
|
+
export { AdminClientProvider, type AdminLabels, type AdminLocale, type AdminStrings, type AsyncState, Badge, Button, type ColumnPrefs, CommandPalette, type Crumb, EmptyState, type EntityCapabilities, EntityDetail, EntityForm, type EntityLabelOverride, EntityList, type EntityMetadata, ErrorBanner, FieldInput, type FieldMetadata, FieldValue, type FilterInput, Header, Hub, I18nProvider, Icon, IconButton, type IconName, JsonInput, type ListQuery, type ListResult, MAESTRO_THEMES, MaestroAdmin, type MaestroAdminProps, MaestroApiError, MaestroClient, type MaestroClientConfig, type MaestroDensity, MaestroMark, type MaestroMetadata, type MaestroScheme, MaestroSeal, type MaestroThemeConfig, type MaestroThemeInput, type MaestroThemeName, type MaestroThemeOption, MaestroThemeProvider, type MaestroThemeState, type MenuGroup, ObjectValue, type PaletteCommand, type PaletteSection, Sidebar, type SidebarMenu, Spinner, Toast, applyLabels, buildMenu, detailFields, entityCommands, entityIcon, formFields, listFields, primaryListFields, stringsFor, useAdminRoot, useAsync, useClient, useColumnPrefs, useEntities, useEntity, useEntityList, useEntityRecord, useMetadata, useRecents, useT, useTheme };
|