@aleph-alpha/ui-library 6.1.0 → 6.2.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/config.js +42 -0
- package/dist/system/components/UiCodeBlock/types.d.ts +11 -0
- package/dist/system/components/core/sidebar/utils.d.ts +9 -0
- package/dist/system/icons/story-sidebar-icons.json +1 -0
- package/dist/system/lib.js +4949 -4883
- package/dist/system/patterns/UiLayout/UiLayoutContent.vue.d.ts +39 -0
- package/dist/system/patterns/UiLayout/index.d.ts +2 -0
- package/dist/system/patterns/UiLayout/layout-shell.d.ts +944 -0
- package/dist/system/patterns/UiLayout/types.d.ts +43 -0
- package/dist/system/patterns/index.d.ts +1 -0
- package/dist/system/story-sidebar-icons.json +1 -0
- package/package.json +5 -5
- package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +83 -0
- package/src/components/UiCodeBlock/UiCodeBlock.vue +30 -2
- package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +21 -0
- package/src/components/UiCodeBlock/types.ts +11 -0
- package/src/components/core/sidebar/Sidebar.vue +21 -5
- package/src/components/core/sidebar/utils.ts +10 -0
- package/src/patterns/UiLayout/UiLayoutContent.stories.ts +1234 -0
- package/src/patterns/UiLayout/UiLayoutContent.vue +98 -0
- package/src/patterns/UiLayout/__tests__/UiLayoutContent.test.ts +97 -0
- package/src/patterns/UiLayout/index.ts +2 -0
- package/src/patterns/UiLayout/layout-shell.ts +64 -15
- package/src/patterns/UiLayout/types.ts +44 -0
- package/src/patterns/index.ts +1 -0
package/config.js
CHANGED
|
@@ -965,6 +965,27 @@ export const presetUiLibraryThemeFromTokens = (options = {}) => {
|
|
|
965
965
|
{ getCSS: () => getSaansFontFaceCss() },
|
|
966
966
|
{ getCSS: () => fontVariablesCss },
|
|
967
967
|
],
|
|
968
|
+
/**
|
|
969
|
+
* Design-system breakpoints on top of the Wind defaults. `desktop`
|
|
970
|
+
* (1200px) is the standard desktop size; between the minimum desktop size
|
|
971
|
+
* of 1024px and `desktop`, layouts compact (32px content margins, 162px
|
|
972
|
+
* sidebar). Extended rather than set via `theme.breakpoint`, which would
|
|
973
|
+
* replace the Wind defaults; rebuilt in ascending order so media queries
|
|
974
|
+
* cascade mobile-first.
|
|
975
|
+
* @param {Record<string, unknown>} theme Merged UnoCSS theme.
|
|
976
|
+
*/
|
|
977
|
+
extendTheme: (theme) => {
|
|
978
|
+
const breakpoint = /** @type {Record<string, string>} */ (
|
|
979
|
+
theme.breakpoint ?? {}
|
|
980
|
+
);
|
|
981
|
+
const entries = Object.entries({ ...breakpoint, desktop: '75rem' });
|
|
982
|
+
const toPx = (value) =>
|
|
983
|
+
value.endsWith('rem')
|
|
984
|
+
? Number.parseFloat(value) * 16
|
|
985
|
+
: Number.parseFloat(value);
|
|
986
|
+
entries.sort(([, a], [, b]) => toPx(a) - toPx(b));
|
|
987
|
+
theme.breakpoint = Object.fromEntries(entries);
|
|
988
|
+
},
|
|
968
989
|
theme: {
|
|
969
990
|
font: {
|
|
970
991
|
sans: `'${fontBody}', sans-serif`,
|
|
@@ -1440,6 +1461,27 @@ const scrollbarCSS = `
|
|
|
1440
1461
|
export const presetUiLibraryUtils = () =>
|
|
1441
1462
|
definePreset(() => ({
|
|
1442
1463
|
name: '@aleph-alpha/ui-library-utils',
|
|
1464
|
+
// Variant separator `:` only. The default also allows `-`, under which
|
|
1465
|
+
// the `lg` breakpoint would swallow `lg-min:` as `lg-` + `min:…` and the
|
|
1466
|
+
// desktop-minimum variant below could never match.
|
|
1467
|
+
separators: [':'],
|
|
1468
|
+
// `lg-min:` is the design system's desktop minimum (1200px = 75rem):
|
|
1469
|
+
// library components switch from 32px to 48px layout-grid margins there
|
|
1470
|
+
// (e.g. `px-8 lg-min:px-12` in `UiLayoutContent`). Registered through
|
|
1471
|
+
// `extendTheme` so it lands in the resolved theme after any user
|
|
1472
|
+
// breakpoint map is merged, inserted after `lg` to keep size order.
|
|
1473
|
+
extendTheme: (theme) => {
|
|
1474
|
+
const breakpoints = theme.breakpoint ?? {};
|
|
1475
|
+
if (!breakpoints['lg-min']) {
|
|
1476
|
+
const entries = Object.entries(breakpoints);
|
|
1477
|
+
const lgIndex = entries.findIndex(([name]) => name === 'lg');
|
|
1478
|
+
entries.splice(lgIndex === -1 ? entries.length : lgIndex + 1, 0, [
|
|
1479
|
+
'lg-min',
|
|
1480
|
+
'75rem',
|
|
1481
|
+
]);
|
|
1482
|
+
theme.breakpoint = Object.fromEntries(entries);
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1443
1485
|
preflights: [
|
|
1444
1486
|
{ getCSS: () => vHoverOverlayCSS },
|
|
1445
1487
|
{ getCSS: () => scrollbarCSS },
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A code block component for displaying source code with syntax highlighting,
|
|
3
3
|
* line numbers, and copy-to-clipboard functionality. Powered by Shiki.
|
|
4
|
+
*
|
|
5
|
+
* The header (language label + copy button) can be recolored from the outside
|
|
6
|
+
* with CSS custom properties, set on the code block or on any ancestor. Use
|
|
7
|
+
* them when the block sits on a surface the default muted header clashes with:
|
|
8
|
+
*
|
|
9
|
+
* - `--ui-code-block-header-surface` — header background
|
|
10
|
+
* - `--ui-code-block-header-content` — label and copy-icon color
|
|
11
|
+
* - `--ui-code-block-header-border` — divider under the header
|
|
12
|
+
*
|
|
13
|
+
* Each takes a full CSS color (`#0d1117`, `oklch(var(--background-surface-primary))`)
|
|
14
|
+
* and falls back to the design token it used before when unset.
|
|
4
15
|
* @category Content
|
|
5
16
|
* @useCases code display, code snippet, syntax highlighting, API response, terminal output
|
|
6
17
|
* @keywords code, codeblock, syntax, highlight, copy, pre, snippet
|
|
@@ -5,6 +5,15 @@ export declare const SIDEBAR_WIDTH = "16rem";
|
|
|
5
5
|
export declare const SIDEBAR_WIDTH_DEFAULT = 256;
|
|
6
6
|
export declare const SIDEBAR_WIDTH_MIN = 240;
|
|
7
7
|
export declare const SIDEBAR_WIDTH_MAX = 480;
|
|
8
|
+
/**
|
|
9
|
+
* Width on compact desktop viewports (from `md` up to below the `desktop`
|
|
10
|
+
* breakpoint, 1200px): toward the minimum desktop size of 1024px the sidebar
|
|
11
|
+
* narrows to 162px and its content truncates, leaving the room to the content
|
|
12
|
+
* area's grid.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SIDEBAR_WIDTH_MIN_DESKTOP = "162px";
|
|
15
|
+
/** Matches compact desktop viewports — at or above `md`, below `desktop`. */
|
|
16
|
+
export declare const SIDEBAR_MIN_DESKTOP_MEDIA_QUERY = "(min-width: 768px) and (max-width: 1199.9px)";
|
|
8
17
|
export declare const SIDEBAR_WIDTH_MOBILE = "16rem";
|
|
9
18
|
export declare const SIDEBAR_WIDTH_ICON = "3rem";
|
|
10
19
|
export declare const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"components-uiautocomplete--accessibility": "accessibility",
|
|
33
33
|
"components-uibreadcrumb--accessibility": "accessibility",
|
|
34
34
|
"patterns-uifloatactions--accessibility": "accessibility",
|
|
35
|
+
"patterns-uilayout-content--accessibility": "accessibility",
|
|
35
36
|
"patterns-uidatatable--accessibility": "accessibility",
|
|
36
37
|
"patterns-uitopbar--accessibility": "accessibility",
|
|
37
38
|
"patterns-uifileupload-uifileitem--accessibility": "accessibility",
|