@aglyn/shared-data-types 1.0.0-beta.213 → 1.0.0-beta.215

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/shared-data-types",
3
- "version": "1.0.0-beta.213",
3
+ "version": "1.0.0-beta.215",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -91,13 +91,40 @@ export interface HostThemeTypography {
91
91
  };
92
92
  }
93
93
  /**
94
- * Plain-JSON component override: serialized `defaultProps` and
95
- * `styleOverrides` (slot name -> CSS object). Functions are not
96
- * representable by design.
94
+ * A style a component takes only when its props match (MUI's theme
95
+ * `variants`), e.g. `{ props: { variant: 'outlined' }, sx: { borderWidth: 2 } }`.
96
+ *
97
+ * `style` is literal CSS and `sx` is resolved against the theme, the same
98
+ * split {@link HostThemeComponentOverride} makes between `styleOverrides` and
99
+ * `sx`. Either or both.
100
+ */
101
+ export interface HostThemeComponentVariant {
102
+ /** Every prop named must equal the value given for the style to apply. */
103
+ props: Record<string, string | number | boolean | null>;
104
+ style?: Record<string, unknown>;
105
+ sx?: Record<string, unknown>;
106
+ }
107
+ /**
108
+ * Plain-JSON component override. Functions are not representable by design,
109
+ * so the theme-dependent half of MUI's component API is expressed as data:
110
+ *
111
+ * - `defaultProps` — MUI's own.
112
+ * - `styleOverrides` — slot name → literal CSS object, MUI's own. `padding:
113
+ * 8` is 8px.
114
+ * - `sx` — slot name → an `sx` object, resolved against the site's theme per
115
+ * scheme: palette paths (`borderColor: 'divider'`, `bgcolor:
116
+ * 'primary.main'`), spacing units (`px: 2`), radius multiples
117
+ * (`borderRadius: 2`), shadow indices (`boxShadow: 3`) and whole type
118
+ * variants (`typography: 'button'`). A separate field, not a flag on
119
+ * `styleOverrides`, because the same number means a different length in
120
+ * each (`padding: 8` is 8px there and `spacing(8)` here).
121
+ * - `variants` — props-matched styles, MUI's own.
97
122
  */
98
123
  export interface HostThemeComponentOverride {
99
124
  defaultProps?: Record<string, unknown>;
100
125
  styleOverrides?: Record<string, unknown>;
126
+ sx?: Record<string, Record<string, unknown>>;
127
+ variants?: Array<HostThemeComponentVariant>;
101
128
  }
102
129
  /**
103
130
  * Plain-JSON theme mixins.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/shared/data/types/src/lib/host-theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Persisted host theme document types.\n *\n * These are plain-JSON (Firestore round-trippable) descriptions of a MUI\n * theme. They intentionally carry no MUI imports so data-scope libs can\n * depend on them; `@aglyn/shared-ui-theme` owns the conversion into runtime\n * `ThemeOptions`.\n */\n\nexport type HostThemeScheme = 'light' | 'dark'\n\nexport interface HostThemePaletteColor {\n main: string\n light?: string\n dark?: string\n contrastText?: string\n}\n\n/**\n * Pale washes of the three accents, used as SURFACES (AGL-1244).\n *\n * Deliberately NOT a {@link HostThemePaletteColor}: a tint has no ramp and no\n * `contrastText`, because it is never a component `color`. It is the fill\n * behind an icon that is already `primary.dark` / `secondary.main` /\n * `tertiary.main`, so its members are named after the accent they belong to\n * rather than after a shade. Same shape as `background` and `text` — a group\n * of string leaves — which is why the theme editor reads and writes it\n * through the same path-based fields.\n */\nexport interface HostThemeTintColors {\n primary?: string\n secondary?: string\n tertiary?: string\n}\n\n/** Palette color keys supported per scheme, including repo-custom ones. */\nexport interface HostThemeSchemeColors {\n primary?: HostThemePaletteColor\n secondary?: HostThemePaletteColor\n tertiary?: HostThemePaletteColor\n surface?: HostThemePaletteColor\n error?: HostThemePaletteColor\n warning?: HostThemePaletteColor\n info?: HostThemePaletteColor\n success?: HostThemePaletteColor\n background?: {\n default?: string\n paper?: string\n }\n text?: {\n primary?: string\n secondary?: string\n disabled?: string\n }\n tint?: HostThemeTintColors\n divider?: string\n}\n\nexport interface HostThemeFont {\n /** Font family name, e.g. \"Inter\". */\n family: string\n weights?: Array<number>\n /** Where the tenant loads the font from; system fonts need no loading. */\n source?: 'google' | 'system'\n}\n\nexport type HostThemeTypographyVariantKey =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'button'\n | 'caption'\n | 'overline'\n\nexport interface HostThemeTypographyVariant {\n fontFamily?: string\n fontSize?: string | number\n fontWeight?: number\n lineHeight?: string | number\n letterSpacing?: string | number\n textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase'\n}\n\nexport interface HostThemeTypography {\n /** CSS font-family stack applied theme-wide. */\n fontFamily?: string\n variants?: {\n [P in HostThemeTypographyVariantKey]?: HostThemeTypographyVariant\n }\n}\n\n/**\n * Plain-JSON component override: serialized `defaultProps` and\n * `styleOverrides` (slot name -> CSS object). Functions are not\n * representable by design.\n */\nexport interface HostThemeComponentOverride {\n defaultProps?: Record<string, unknown>\n styleOverrides?: Record<string, unknown>\n}\n\n/**\n * Plain-JSON theme mixins.\n *\n * `toolbar` is the only one a host can set, and it exists because it is the\n * ONLY way to change toolbar height from data (AGL-1242). MUI builds the\n * Toolbar's `regular` variant style FROM `theme.mixins.toolbar`, and applies\n * that variant AFTER `components.MuiToolbar.styleOverrides` — so a slot\n * override can never win, no matter how it is written. The value is a CSS\n * object and may nest media queries, e.g.\n * `{ minHeight: '56px', '@media (min-width:600px)': { minHeight: '72px' } }`.\n */\nexport interface HostThemeMixins {\n toolbar?: Record<string, unknown>\n}\n\nexport interface HostTheme {\n colorSchemes?: {\n [P in HostThemeScheme]?: HostThemeSchemeColors\n }\n typography?: HostThemeTypography\n fonts?: Array<HostThemeFont>\n shape?: {\n borderRadius?: number\n }\n spacing?: number\n mixins?: HostThemeMixins\n /** Keyed by MUI component slot name (e.g. `MuiButton`). Consumers validate against a whitelist. */\n components?: Record<string, HostThemeComponentOverride>\n /**\n * Whether visitors get a dark scheme. Absent (`'auto'`) follows the\n * visitor's system setting or their choice in the theme mode switcher,\n * rendering the platform's default dark palette under whatever dark colors\n * the site authored. `'off'` keeps every visitor on light — for a site whose\n * content carries light-only backgrounds — and hides the switcher on\n * published pages.\n */\n darkScheme?: 'auto' | 'off'\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GAoHD,WAsBC"}
1
+ {"version":3,"sources":["../../../../../../../libs/shared/data/types/src/lib/host-theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Persisted host theme document types.\n *\n * These are plain-JSON (Firestore round-trippable) descriptions of a MUI\n * theme. They intentionally carry no MUI imports so data-scope libs can\n * depend on them; `@aglyn/shared-ui-theme` owns the conversion into runtime\n * `ThemeOptions`.\n */\n\nexport type HostThemeScheme = 'light' | 'dark'\n\nexport interface HostThemePaletteColor {\n main: string\n light?: string\n dark?: string\n contrastText?: string\n}\n\n/**\n * Pale washes of the three accents, used as SURFACES (AGL-1244).\n *\n * Deliberately NOT a {@link HostThemePaletteColor}: a tint has no ramp and no\n * `contrastText`, because it is never a component `color`. It is the fill\n * behind an icon that is already `primary.dark` / `secondary.main` /\n * `tertiary.main`, so its members are named after the accent they belong to\n * rather than after a shade. Same shape as `background` and `text` — a group\n * of string leaves — which is why the theme editor reads and writes it\n * through the same path-based fields.\n */\nexport interface HostThemeTintColors {\n primary?: string\n secondary?: string\n tertiary?: string\n}\n\n/** Palette color keys supported per scheme, including repo-custom ones. */\nexport interface HostThemeSchemeColors {\n primary?: HostThemePaletteColor\n secondary?: HostThemePaletteColor\n tertiary?: HostThemePaletteColor\n surface?: HostThemePaletteColor\n error?: HostThemePaletteColor\n warning?: HostThemePaletteColor\n info?: HostThemePaletteColor\n success?: HostThemePaletteColor\n background?: {\n default?: string\n paper?: string\n }\n text?: {\n primary?: string\n secondary?: string\n disabled?: string\n }\n tint?: HostThemeTintColors\n divider?: string\n}\n\nexport interface HostThemeFont {\n /** Font family name, e.g. \"Inter\". */\n family: string\n weights?: Array<number>\n /** Where the tenant loads the font from; system fonts need no loading. */\n source?: 'google' | 'system'\n}\n\nexport type HostThemeTypographyVariantKey =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'button'\n | 'caption'\n | 'overline'\n\nexport interface HostThemeTypographyVariant {\n fontFamily?: string\n fontSize?: string | number\n fontWeight?: number\n lineHeight?: string | number\n letterSpacing?: string | number\n textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase'\n}\n\nexport interface HostThemeTypography {\n /** CSS font-family stack applied theme-wide. */\n fontFamily?: string\n variants?: {\n [P in HostThemeTypographyVariantKey]?: HostThemeTypographyVariant\n }\n}\n\n/**\n * A style a component takes only when its props match (MUI's theme\n * `variants`), e.g. `{ props: { variant: 'outlined' }, sx: { borderWidth: 2 } }`.\n *\n * `style` is literal CSS and `sx` is resolved against the theme, the same\n * split {@link HostThemeComponentOverride} makes between `styleOverrides` and\n * `sx`. Either or both.\n */\nexport interface HostThemeComponentVariant {\n /** Every prop named must equal the value given for the style to apply. */\n props: Record<string, string | number | boolean | null>\n style?: Record<string, unknown>\n sx?: Record<string, unknown>\n}\n\n/**\n * Plain-JSON component override. Functions are not representable by design,\n * so the theme-dependent half of MUI's component API is expressed as data:\n *\n * - `defaultProps` — MUI's own.\n * - `styleOverrides` — slot name → literal CSS object, MUI's own. `padding:\n * 8` is 8px.\n * - `sx` — slot name → an `sx` object, resolved against the site's theme per\n * scheme: palette paths (`borderColor: 'divider'`, `bgcolor:\n * 'primary.main'`), spacing units (`px: 2`), radius multiples\n * (`borderRadius: 2`), shadow indices (`boxShadow: 3`) and whole type\n * variants (`typography: 'button'`). A separate field, not a flag on\n * `styleOverrides`, because the same number means a different length in\n * each (`padding: 8` is 8px there and `spacing(8)` here).\n * - `variants` — props-matched styles, MUI's own.\n */\nexport interface HostThemeComponentOverride {\n defaultProps?: Record<string, unknown>\n styleOverrides?: Record<string, unknown>\n sx?: Record<string, Record<string, unknown>>\n variants?: Array<HostThemeComponentVariant>\n}\n\n/**\n * Plain-JSON theme mixins.\n *\n * `toolbar` is the only one a host can set, and it exists because it is the\n * ONLY way to change toolbar height from data (AGL-1242). MUI builds the\n * Toolbar's `regular` variant style FROM `theme.mixins.toolbar`, and applies\n * that variant AFTER `components.MuiToolbar.styleOverrides` — so a slot\n * override can never win, no matter how it is written. The value is a CSS\n * object and may nest media queries, e.g.\n * `{ minHeight: '56px', '@media (min-width:600px)': { minHeight: '72px' } }`.\n */\nexport interface HostThemeMixins {\n toolbar?: Record<string, unknown>\n}\n\nexport interface HostTheme {\n colorSchemes?: {\n [P in HostThemeScheme]?: HostThemeSchemeColors\n }\n typography?: HostThemeTypography\n fonts?: Array<HostThemeFont>\n shape?: {\n borderRadius?: number\n }\n spacing?: number\n mixins?: HostThemeMixins\n /** Keyed by MUI component slot name (e.g. `MuiButton`). Consumers validate against a whitelist. */\n components?: Record<string, HostThemeComponentOverride>\n /**\n * Whether visitors get a dark scheme. Absent (`'auto'`) follows the\n * visitor's system setting or their choice in the theme mode switcher,\n * rendering the platform's default dark palette under whatever dark colors\n * the site authored. `'off'` keeps every visitor on light — for a site whose\n * content carries light-only backgrounds — and hides the switcher on\n * published pages.\n */\n darkScheme?: 'auto' | 'off'\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GAgJD,WAsBC"}