@khsura/sui 1.18.3 → 1.20.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/@types/components/cards/sCardText.vue.d.ts +2 -2
- package/@types/components/datePicker/sDatePickerSwitch.vue.d.ts +2 -0
- package/@types/components/form/index.d.ts +1 -0
- package/@types/components/form/radio/sRadio.vue.d.ts +3 -0
- package/@types/components/form/sFormRow.vue.d.ts +18 -0
- package/@types/components/form/sInput.vue.d.ts +1 -0
- package/@types/components/form/sSelect.vue.d.ts +2 -0
- package/@types/components/layout/sNavigationDrawer.vue.d.ts +6 -6
- package/@types/components/progress/sProgressCircular.vue.d.ts +1 -0
- package/@types/components/progress/sProgressLinear.vue.d.ts +1 -0
- package/@types/components/sAutocomplete.vue.d.ts +3 -0
- package/@types/components/slideGroup/sSlideGroup.vue.d.ts +4 -1
- package/@types/components/table/sTable.vue.d.ts +17 -96
- package/@types/components/tabs/sTabs.vue.d.ts +2 -2
- package/@types/configs/app.d.ts +4 -0
- package/@types/configs/i18n.d.ts +3 -0
- package/@types/configs/provider.d.ts +1 -0
- package/@types/constants/color.d.ts +15 -0
- package/@types/constants/cssVariables.d.ts +4 -0
- package/@types/constants/datePicker.d.ts +7 -0
- package/@types/constants/i18n.d.ts +3 -0
- package/@types/constants/index.d.ts +3 -0
- package/@types/constants/keyboard.d.ts +12 -0
- package/@types/constants/listbox.d.ts +1 -0
- package/@types/constants/overlay.d.ts +5 -0
- package/@types/constants/tabs.d.ts +4 -0
- package/@types/definitions/props/core/propsLink.d.ts +2 -2
- package/@types/definitions/props/propsAutocomplete.d.ts +6 -0
- package/@types/definitions/props/propsInput.d.ts +1 -0
- package/@types/definitions/props/propsLink.d.ts +2 -2
- package/@types/definitions/props/propsProgressCircular.d.ts +2 -0
- package/@types/definitions/props/propsProgressLinear.d.ts +2 -0
- package/@types/definitions/props/propsSelect.d.ts +4 -0
- package/@types/definitions/props/propsSlideGroup.d.ts +4 -0
- package/@types/definitions/props/propsTable.d.ts +1 -0
- package/@types/definitions/props/propsTextarea.d.ts +3 -0
- package/@types/helpers/colorHelpers.d.ts +1 -1
- package/@types/helpers/createAppStore.d.ts +4 -0
- package/@types/lib/color.d.ts +21 -2
- package/@types/lib/index.d.ts +4 -0
- package/@types/lib/linkLocation.d.ts +9 -0
- package/@types/lib/overlayPlacement.d.ts +11 -0
- package/@types/lib/revealInScroller.d.ts +11 -0
- package/@types/lib/safeArea.d.ts +3 -0
- package/@types/playwright.visual.config.d.ts +3 -0
- package/@types/services/backgroundScrollService.d.ts +8 -2
- package/@types/services/datePicker/datePickerItemDateService.d.ts +1 -0
- package/@types/services/dialogService.d.ts +4 -8
- package/@types/services/fieldLayoutService.d.ts +19 -0
- package/@types/services/formInputService.d.ts +6 -0
- package/@types/services/index.d.ts +7 -0
- package/@types/services/linkService.d.ts +11 -1
- package/@types/services/listboxNavigationService.d.ts +20 -0
- package/@types/services/menuService.d.ts +2 -0
- package/@types/services/overlayFocusService.d.ts +10 -0
- package/@types/services/routerLinkService.d.ts +19 -0
- package/@types/services/scrollableFocusService.d.ts +10 -0
- package/@types/services/surfaceTextColorService.d.ts +8 -0
- package/@types/services/tabsService.d.ts +9 -0
- package/@types/store/index.d.ts +1 -0
- package/@types/store/scrollLockStore.d.ts +1 -0
- package/@types/tests/visual/constants/a11yAudit.d.ts +4 -0
- package/@types/tests/visual/constants/index.d.ts +4 -0
- package/@types/tests/visual/constants/resizeScroll.d.ts +10 -0
- package/@types/tests/visual/constants/storyRender.d.ts +5 -0
- package/@types/tests/visual/constants/visualMatrix.d.ts +20 -0
- package/@types/tests/visual/schemas/index.d.ts +1 -0
- package/@types/tests/visual/schemas/storyIndex.d.ts +17 -0
- package/@types/tests/visual/types/a11yAudit.d.ts +2 -0
- package/@types/tests/visual/types/index.d.ts +2 -0
- package/@types/tests/visual/types/visualStory.d.ts +8 -0
- package/@types/types/app.d.ts +2 -0
- package/@types/types/breadcrumbs.d.ts +2 -2
- package/@types/types/index.d.ts +2 -0
- package/@types/types/link.d.ts +20 -0
- package/@types/types/menu.d.ts +17 -0
- package/@types/types/safeArea.d.ts +1 -0
- package/@types/types/table.d.ts +45 -0
- package/@types/vite.config.d.ts +1 -0
- package/README.md +22 -31
- package/dist/base.css.map +1 -1
- package/dist/s-ui.css +1 -1
- package/dist/s-ui.js +3122 -2478
- package/dist/s-ui.umd.cjs +1 -1
- package/dist/styles/components/button/mixins.scss +5 -0
- package/dist/styles/components/form/_variables.scss +11 -0
- package/dist/styles/components/form/index.scss +1 -0
- package/dist/styles/components/index.scss +1 -0
- package/dist/styles/mixins/_app.scss +7 -0
- package/dist/styles/tools/_safeArea.scss +8 -0
- package/dist/styles/tools/index.scss +1 -0
- package/dist/sui-api.json +10128 -0
- package/package.json +30 -6
- package/sui-plugin/.claude-plugin/plugin.json +2 -2
- package/sui-plugin/README.md +24 -1
- package/sui-plugin/skills/sui-component/SKILL.md +13 -3
- package/sui-plugin/skills/sui-component/references/alert.md +30 -14
- package/sui-plugin/skills/sui-component/references/autocomplete.md +96 -34
- package/sui-plugin/skills/sui-component/references/badge.md +55 -29
- package/sui-plugin/skills/sui-component/references/breadcrumbs.md +33 -19
- package/sui-plugin/skills/sui-component/references/button.md +76 -37
- package/sui-plugin/skills/sui-component/references/calendar.md +64 -34
- package/sui-plugin/skills/sui-component/references/cards.md +142 -25
- package/sui-plugin/skills/sui-component/references/carousel.md +107 -42
- package/sui-plugin/skills/sui-component/references/chip.md +52 -28
- package/sui-plugin/skills/sui-component/references/date-picker.md +148 -61
- package/sui-plugin/skills/sui-component/references/dialog.md +60 -21
- package/sui-plugin/skills/sui-component/references/divider.md +15 -6
- package/sui-plugin/skills/sui-component/references/droppable.md +36 -16
- package/sui-plugin/skills/sui-component/references/expansion-panels.md +107 -30
- package/sui-plugin/skills/sui-component/references/form.md +483 -35
- package/sui-plugin/skills/sui-component/references/icon.md +30 -11
- package/sui-plugin/skills/sui-component/references/image.md +39 -17
- package/sui-plugin/skills/sui-component/references/layout.md +456 -69
- package/sui-plugin/skills/sui-component/references/list.md +223 -52
- package/sui-plugin/skills/sui-component/references/menu.md +64 -28
- package/sui-plugin/skills/sui-component/references/overlay.md +35 -16
- package/sui-plugin/skills/sui-component/references/progress.md +76 -26
- package/sui-plugin/skills/sui-component/references/sheet.md +46 -23
- package/sui-plugin/skills/sui-component/references/slide-group.md +77 -38
- package/sui-plugin/skills/sui-component/references/snackbar.md +48 -17
- package/sui-plugin/skills/sui-component/references/split-view.md +51 -12
- package/sui-plugin/skills/sui-component/references/stepper.md +58 -23
- package/sui-plugin/skills/sui-component/references/table.md +123 -55
- package/sui-plugin/skills/sui-component/references/tabs.md +78 -30
- package/sui-plugin/skills/sui-component/references/toggle-button-group.md +85 -39
- package/sui-plugin/skills/sui-component/references/toolbar.md +92 -33
- package/sui-plugin/skills/sui-component/references/tooltip.md +58 -20
- package/sui-plugin/skills/sui-component/references/window.md +89 -29
- package/sui-plugin/skills/sui-form/SKILL.md +23 -16
- package/sui-plugin/skills/sui-getting-started/SKILL.md +60 -44
- package/sui-plugin/skills/sui-layout/SKILL.md +3 -1
- package/sui-plugin/skills/sui-utilities/docs/classes.md +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LinkLocation } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The plain URL a `to` location points at, for apps without vue-router.
|
|
4
|
+
*
|
|
5
|
+
* A path string is already a URL. A location object resolves only when it
|
|
6
|
+
* names a `path`; a route addressed by `name` needs the router's route table,
|
|
7
|
+
* so it has no URL here and the result is `undefined`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getLinkLocationHref: (location: LinkLocation) => string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OverlayPlacementInput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps an overlay inside the viewport, `gutter` pixels from every edge.
|
|
4
|
+
*
|
|
5
|
+
* Vertically it first flips to the other side of the activator (keeping the same gap) when that side has room,
|
|
6
|
+
* otherwise it shifts the overlay until it fits. Horizontally it shifts. All values are viewport coordinates.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getOverlayPlacement: ({ content, activator, viewportWidth, viewportHeight, gutter, }: OverlayPlacementInput) => {
|
|
9
|
+
top: number;
|
|
10
|
+
left: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Horizontal edges of a box, in viewport pixels (a subset of DOMRect). */
|
|
2
|
+
export interface HorizontalEdges {
|
|
3
|
+
left: number;
|
|
4
|
+
right: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The scrollLeft that brings `item` fully into view inside a horizontal scroller, moving as little as
|
|
8
|
+
* possible. Returns the current scrollLeft when the item is already visible. An item wider than the
|
|
9
|
+
* scroller is aligned to its start.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getScrollLeftToReveal: (scroller: HorizontalEdges, item: HorizontalEdges, scrollLeft: number) => number;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blocks the page scroll behind a modal overlay. Each caller is one lock owner; the page stays pinned while any
|
|
3
|
+
* owner holds a lock and is released when the last one lets go. Both calls are idempotent and apply at once, so
|
|
4
|
+
* a drawer that turns mobile and closes in the same tick (a window resize across the md breakpoint) ends unlocked
|
|
5
|
+
* whatever order its watchers ran in. An owner created inside a component lets go when the component unmounts.
|
|
6
|
+
*/
|
|
1
7
|
export declare const useBackgroundScrollService: () => {
|
|
2
|
-
enableBackgroundScroll: () =>
|
|
3
|
-
disableBackgroundScroll: () =>
|
|
8
|
+
enableBackgroundScroll: () => void;
|
|
9
|
+
disableBackgroundScroll: () => void;
|
|
4
10
|
};
|
|
@@ -19,14 +19,10 @@ export declare const useDialogService: (props: PropsDialog, isDialogOpen: ModelR
|
|
|
19
19
|
's_dialog__content--bottom': boolean;
|
|
20
20
|
's_dialog__content--borderless': boolean | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
contentStyles: import("vue").ComputedRef<{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
maxWidth?: string;
|
|
27
|
-
minHeight?: string;
|
|
28
|
-
minWidth?: string;
|
|
29
|
-
}>;
|
|
22
|
+
contentStyles: import("vue").ComputedRef<Partial<{
|
|
23
|
+
minHeight?: string | undefined;
|
|
24
|
+
minWidth?: string | undefined;
|
|
25
|
+
}>>;
|
|
30
26
|
transitionName: import("vue").ComputedRef<STransition.appear | "s_transition__dialog--bottom">;
|
|
31
27
|
onClickOutside: () => void;
|
|
32
28
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComputedRef } from 'vue';
|
|
2
|
+
export interface FieldLayoutState {
|
|
3
|
+
/** A label is rendered above the field box (a label is set and `hideDetails` is off). */
|
|
4
|
+
hasLabel: boolean;
|
|
5
|
+
/** The details line (error / counter) is reserved below the field box. */
|
|
6
|
+
hasDetails: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Marker classes on a text field's root, so `SFormRow` can line its buttons up with the field box:
|
|
10
|
+
* it offsets the other children by the label height when a field in the row shows a label.
|
|
11
|
+
* The classes carry no styles of their own, so a field outside `SFormRow` renders unchanged.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useFieldLayoutService: (state: ComputedRef<FieldLayoutState>) => {
|
|
14
|
+
classListField: ComputedRef<{
|
|
15
|
+
s_field: boolean;
|
|
16
|
+
's_field--labelled': boolean;
|
|
17
|
+
's_field--details': boolean;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
@@ -5,4 +5,10 @@ export declare const useFormInputService: <T extends FormInputModelValue = FormI
|
|
|
5
5
|
updateFormInput: (value?: T) => Promise<boolean>;
|
|
6
6
|
errors: import("vue").ComputedRef<string[]>;
|
|
7
7
|
hasError: import("vue").ComputedRef<boolean>;
|
|
8
|
+
inputId: import("vue").ComputedRef<string>;
|
|
9
|
+
errorId: import("vue").ComputedRef<string>;
|
|
10
|
+
ariaAttributesFormInput: import("vue").ComputedRef<{
|
|
11
|
+
'aria-invalid': true | undefined;
|
|
12
|
+
'aria-describedby': string | undefined;
|
|
13
|
+
}>;
|
|
8
14
|
};
|
|
@@ -16,28 +16,35 @@ export * from './displayService';
|
|
|
16
16
|
export * from './elevationService';
|
|
17
17
|
export * from './expandableItemService';
|
|
18
18
|
export * from './expandableService';
|
|
19
|
+
export * from './fieldLayoutService';
|
|
19
20
|
export * from './formInputService';
|
|
20
21
|
export * from './groupItemService';
|
|
21
22
|
export * from './groupService';
|
|
22
23
|
export * from './layoutProviderService';
|
|
23
24
|
export * from './layoutService';
|
|
24
25
|
export * from './linkService';
|
|
26
|
+
export * from './routerLinkService';
|
|
25
27
|
export * from './listMediaItemService';
|
|
26
28
|
export * from './measurableStylesService';
|
|
29
|
+
export * from './listboxNavigationService';
|
|
27
30
|
export * from './menuService';
|
|
28
31
|
export * from './navigationDrawerService';
|
|
29
32
|
export * from './navigationDrawerResizeService';
|
|
30
33
|
export * from './positionService';
|
|
31
34
|
export * from './resizeService';
|
|
35
|
+
export * from './scrollableFocusService';
|
|
32
36
|
export * from './scrollService';
|
|
33
37
|
export * from './scrollableService';
|
|
34
38
|
export * from './singleGroupItemService';
|
|
35
39
|
export * from './singleGroupService';
|
|
36
40
|
export * from './sizeService';
|
|
37
41
|
export * from './slideGroupService';
|
|
42
|
+
export * from './tabsService';
|
|
38
43
|
export * from './table';
|
|
39
44
|
export * from './tagService';
|
|
45
|
+
export * from './surfaceTextColorService';
|
|
40
46
|
export * from './textColorService';
|
|
41
47
|
export * from './themeService';
|
|
42
48
|
export * from './toolbarService';
|
|
43
49
|
export * from './touchService';
|
|
50
|
+
export * from './overlayFocusService';
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { type PropsLink, type PropsTag } from '../definitions';
|
|
2
|
+
/**
|
|
3
|
+
* `to` renders a `router-link` when the app has vue-router, and degrades to a
|
|
4
|
+
* plain `<a href>` when it does not, so `@khsura/sui` never needs vue-router
|
|
5
|
+
* installed. See `useRouterLinkService`.
|
|
6
|
+
*/
|
|
2
7
|
export declare const useLinkService: (props: PropsLink & PropsTag) => {
|
|
3
8
|
tag: import("vue").ComputedRef<import("..").HtmlTagName | "router-link">;
|
|
4
9
|
isLink: import("vue").ComputedRef<boolean>;
|
|
5
10
|
linkAttrs: import("vue").ComputedRef<{
|
|
6
|
-
to:
|
|
11
|
+
to: import("..").LinkLocation | null | undefined;
|
|
7
12
|
href?: undefined;
|
|
8
13
|
target?: undefined;
|
|
9
14
|
rel?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
href: string | undefined;
|
|
17
|
+
to?: undefined;
|
|
18
|
+
target?: undefined;
|
|
19
|
+
rel?: undefined;
|
|
10
20
|
} | {
|
|
11
21
|
href: string | null | undefined;
|
|
12
22
|
target: "_blank" | "_self" | "_parent" | "_top" | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Keyboard highlight for a popup listbox driven from a focused combobox (the `aria-activedescendant` pattern):
|
|
4
|
+
* focus stays on the field while the arrow keys move a highlighted option. Disabled options are skipped.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useListboxNavigationService: (options: {
|
|
7
|
+
idPrefix: MaybeRefOrGetter<string>;
|
|
8
|
+
getOptionCount: () => number;
|
|
9
|
+
getIsOptionDisabled: (index: number) => boolean;
|
|
10
|
+
}) => {
|
|
11
|
+
activeIndex: import("vue").Ref<number, number>;
|
|
12
|
+
activeOptionId: import("vue").ComputedRef<string | undefined>;
|
|
13
|
+
listboxId: import("vue").ComputedRef<string>;
|
|
14
|
+
getOptionId: (index: number) => string;
|
|
15
|
+
setActiveIndex: (index: number) => void;
|
|
16
|
+
resetActiveIndex: () => void;
|
|
17
|
+
moveActive: (step: 1 | -1) => void;
|
|
18
|
+
moveToFirst: () => void;
|
|
19
|
+
moveToLast: () => void;
|
|
20
|
+
};
|
|
@@ -10,6 +10,8 @@ export declare const useMenuService: (props: PropsMenu, model: Ref<boolean | und
|
|
|
10
10
|
alignMiddle?: boolean;
|
|
11
11
|
preventOverlap?: boolean;
|
|
12
12
|
autoFlip?: boolean;
|
|
13
|
+
/** Flip or shift the content so it stays inside the viewport (gutter: `screenPadding` or the default). */
|
|
14
|
+
keepInViewport?: boolean;
|
|
13
15
|
onChange?: (v: boolean | undefined | null) => void;
|
|
14
16
|
}) => {
|
|
15
17
|
contentClasses: import("vue").ComputedRef<Record<string, boolean>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
export declare const useOverlayFocusService: (model: Ref<boolean | null | undefined>, elements: {
|
|
3
|
+
activator: Readonly<Ref<HTMLElement | null>>;
|
|
4
|
+
content: Readonly<Ref<HTMLElement | null>>;
|
|
5
|
+
}, options: {
|
|
6
|
+
/** Esc closes the overlay unless this returns false (a persistent dialog). */
|
|
7
|
+
canCloseOnEscape: () => boolean;
|
|
8
|
+
/** Move focus into the content on open and keep Tab inside it (modal dialogs). */
|
|
9
|
+
trapFocus: boolean;
|
|
10
|
+
}) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LinkLocation } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the host app can render `RouterLink`, found without importing
|
|
4
|
+
* vue-router.
|
|
5
|
+
*
|
|
6
|
+
* `@khsura/sui` does not depend on vue-router. A static import of it — even
|
|
7
|
+
* a type import written as `import { type X } from 'vue-router'`, which
|
|
8
|
+
* `verbatimModuleSyntax` keeps as a bare `import 'vue-router'` — puts the
|
|
9
|
+
* package into `dist/s-ui.js`, and an app without it then fails to build
|
|
10
|
+
* with "Failed to resolve import 'vue-router'".
|
|
11
|
+
*
|
|
12
|
+
* `app.use(router)` registers `RouterLink` as a global component, so the
|
|
13
|
+
* app's component registry answers the question. Call this from `setup`:
|
|
14
|
+
* outside a component there is no app, and so no router.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useRouterLinkService: () => {
|
|
17
|
+
hasRouterLink: boolean;
|
|
18
|
+
warnIfNoRouter: (to: LinkLocation | null | undefined) => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* A region that scrolls must be reachable from the keyboard (WCAG 2.1.1), or its overflow cannot be read
|
|
4
|
+
* without a mouse. Returns a `tabindex` that makes the element a Tab stop only while its content overflows.
|
|
5
|
+
* The element and its direct children are observed, so content that grows inside a fixed-size box counts too.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useScrollableFocusService: (element: MaybeRefOrGetter<HTMLElement | null | undefined>) => {
|
|
8
|
+
isScrollable: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
scrollableTabindex: import("vue").ComputedRef<0 | undefined>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `s_textColor__<name>` reads `--s-color-<name>--readable`, which SApp tunes for the app background and cards.
|
|
3
|
+
* A surface with a fixed colour of its own (the always-dark snackbar) redefines those variables for its subtree,
|
|
4
|
+
* so a preset colour as text (`color="warning"` on a text button) reaches 4.5:1 on that surface instead.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useSurfaceTextColorService: (surfaceColorName: string, appName?: string | symbol) => {
|
|
7
|
+
styleListSurfaceTextColor: import("vue").ComputedRef<Record<string, string>>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* STabs keeps its tabs on one row that scrolls sideways when they do not fit. This keeps the selected tab
|
|
4
|
+
* scrolled into view, without scrolling the page: on mount, once the web fonts have loaded, and whenever the
|
|
5
|
+
* selection changes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useTabsService: (selected: Ref<number | string>, element: Ref<HTMLElement | null | undefined>) => {
|
|
8
|
+
revealSelectedTab: () => void;
|
|
9
|
+
};
|
package/@types/store/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const scrollLockOwners: Set<symbol>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const resizeScrollShellStoryId = "recipes--app-shell";
|
|
2
|
+
export declare const resizeScrollPageStoryId = "recipes--responsive-grid";
|
|
3
|
+
export declare const resizeScrollBrowser = "chromium";
|
|
4
|
+
export declare const resizeScrollSteps = 10;
|
|
5
|
+
export declare const resizeScrollStepDelayMs = 16;
|
|
6
|
+
export declare const resizeScrollSettleMs = 400;
|
|
7
|
+
export declare const resizeScrollDistance = 200;
|
|
8
|
+
export declare const resizeScrollPageHeight = 500;
|
|
9
|
+
export declare const resizeScrollBlockedClassName = "s_overlay__scrollBlocked";
|
|
10
|
+
export declare const resizeObserverLoopMessage = "ResizeObserver loop";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const storyFailureEvents: string[];
|
|
2
|
+
export declare const storybookChannelGlobal = "__STORYBOOK_ADDONS_CHANNEL__";
|
|
3
|
+
export declare const storyFailuresGlobal = "__suiVisualStoryFailures";
|
|
4
|
+
export declare const storyFailureMaxLength = 500;
|
|
5
|
+
export declare const storybookA11yManualGlobal = "a11y.manual:!true";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const visualTag = "visual";
|
|
2
|
+
export declare const visualViewportWidths: readonly [375, 768, 1280];
|
|
3
|
+
export declare const visualViewportHeight = 800;
|
|
4
|
+
export declare const visualThemes: readonly ["light", "dark"];
|
|
5
|
+
export declare const visualBrowsers: readonly ["chromium", "webkit"];
|
|
6
|
+
export declare const visualStorybookDir = "storybook-static";
|
|
7
|
+
export declare const visualServerPort = 6007;
|
|
8
|
+
export declare const visualServerUrl = "http://127.0.0.1:6007";
|
|
9
|
+
export declare const visualServerTimeoutMs = 60000;
|
|
10
|
+
export declare const mdiFontPackage = "@mdi/font";
|
|
11
|
+
export declare const mdiFontCdnPathPattern: RegExp;
|
|
12
|
+
export declare const visualFixedTime = "2026-01-01T09:00:00.000Z";
|
|
13
|
+
export declare const visualStoryRenderTimeoutMs = 15000;
|
|
14
|
+
export declare const visualStoryRenderPollingMs = 100;
|
|
15
|
+
export declare const storyRenderFinishedPhase = "finished";
|
|
16
|
+
export declare const storyRenderTerminalPhases: string[];
|
|
17
|
+
export declare const visualTestTimeoutMs = 60000;
|
|
18
|
+
export declare const visualScreenshotTimeoutMs = 15000;
|
|
19
|
+
export declare const visualPixelThreshold = 0.2;
|
|
20
|
+
export declare const visualMaxDiffPixelRatio = 0.002;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './storyIndex';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const storyIndexEntrySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
type: z.ZodString;
|
|
7
|
+
tags: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const storyIndexSchema: z.ZodObject<{
|
|
10
|
+
entries: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
title: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
type: z.ZodString;
|
|
15
|
+
tags: z.ZodArray<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { visualThemes } from '../constants';
|
|
3
|
+
import type { storyIndexEntrySchema } from '../schemas';
|
|
4
|
+
export type StoryIndexEntry = z.infer<typeof storyIndexEntrySchema>;
|
|
5
|
+
export type VisualTheme = (typeof visualThemes)[number];
|
|
6
|
+
export type VisualOptions = {
|
|
7
|
+
theme: VisualTheme;
|
|
8
|
+
};
|
package/@types/types/app.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LinkLocation } from './link';
|
|
2
2
|
export interface BreadcrumbsItem {
|
|
3
3
|
text: string | number;
|
|
4
4
|
link?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
href?: string;
|
|
7
|
-
to?:
|
|
7
|
+
to?: LinkLocation;
|
|
8
8
|
}
|
package/@types/types/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './form';
|
|
|
11
11
|
export * from './grids';
|
|
12
12
|
export * from './icon';
|
|
13
13
|
export * from './input';
|
|
14
|
+
export * from './link';
|
|
14
15
|
export * from './location';
|
|
15
16
|
export * from './materialDesignIcon';
|
|
16
17
|
export * from './menu';
|
|
@@ -22,3 +23,4 @@ export * from './table';
|
|
|
22
23
|
export * from './tag';
|
|
23
24
|
export * from './toolbar';
|
|
24
25
|
export * from './touch';
|
|
26
|
+
export * from './safeArea';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The destination a component's `to` prop accepts.
|
|
3
|
+
*
|
|
4
|
+
* A structural copy of vue-router's `RouteLocationRaw` rather than an import
|
|
5
|
+
* of it: `@khsura/sui` does not depend on vue-router, and its published
|
|
6
|
+
* declarations must type-check in an app that never installed it. Every value
|
|
7
|
+
* vue-router accepts (a path string, or a location object by path or by name)
|
|
8
|
+
* fits this type, so apps with a router lose nothing.
|
|
9
|
+
*/
|
|
10
|
+
export type LinkLocationObject = {
|
|
11
|
+
path?: string;
|
|
12
|
+
name?: string | symbol;
|
|
13
|
+
params?: object;
|
|
14
|
+
query?: object;
|
|
15
|
+
hash?: string;
|
|
16
|
+
replace?: boolean;
|
|
17
|
+
force?: boolean;
|
|
18
|
+
state?: object;
|
|
19
|
+
};
|
|
20
|
+
export type LinkLocation = string | LinkLocationObject;
|
package/@types/types/menu.d.ts
CHANGED
|
@@ -4,6 +4,23 @@ export interface MenuContentStyle extends CSSProperties {
|
|
|
4
4
|
left?: string;
|
|
5
5
|
minWidth?: string;
|
|
6
6
|
}
|
|
7
|
+
/** A box in viewport coordinates (pixels from the top-left corner of the visible area). */
|
|
8
|
+
export interface OverlayBox {
|
|
9
|
+
top: number;
|
|
10
|
+
left: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
export interface OverlayPlacementInput {
|
|
15
|
+
/** The overlay where its location prop put it. */
|
|
16
|
+
content: OverlayBox;
|
|
17
|
+
/** The activator the overlay belongs to. */
|
|
18
|
+
activator: OverlayBox;
|
|
19
|
+
viewportWidth: number;
|
|
20
|
+
viewportHeight: number;
|
|
21
|
+
/** Distance to keep from every viewport edge. */
|
|
22
|
+
gutter: number;
|
|
23
|
+
}
|
|
7
24
|
export interface EmitMenu {
|
|
8
25
|
(event: 'close'): void;
|
|
9
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SafeAreaSide = 'top' | 'right' | 'bottom' | 'left';
|
package/@types/types/table.d.ts
CHANGED
|
@@ -37,3 +37,48 @@ export interface TableHeader<V extends string | number | symbol = string> {
|
|
|
37
37
|
colspan?: number;
|
|
38
38
|
scope?: 'colgroup' | 'col';
|
|
39
39
|
}
|
|
40
|
+
/** A header as STable renders it: the user's header plus the layout fields computed for it. */
|
|
41
|
+
export type TableComputedHeader = TableHeader & {
|
|
42
|
+
colspan: number;
|
|
43
|
+
rowspan: number;
|
|
44
|
+
isSticky: boolean;
|
|
45
|
+
isSticked: boolean | undefined;
|
|
46
|
+
index: number;
|
|
47
|
+
};
|
|
48
|
+
/** Props of the dynamic `header.<column>` slot. */
|
|
49
|
+
export interface TableHeaderSlotProps {
|
|
50
|
+
header: TableComputedHeader;
|
|
51
|
+
isSticked: boolean | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** Props shared by the row-level slots (`item.<column>`, `itemHeader`, `itemFooter`). */
|
|
54
|
+
export interface TableRowSlotProps<T extends TableItem = TableItem> {
|
|
55
|
+
item: T;
|
|
56
|
+
value: T[keyof T];
|
|
57
|
+
row: number;
|
|
58
|
+
group: string;
|
|
59
|
+
expand: () => void;
|
|
60
|
+
select: () => void;
|
|
61
|
+
isSelected: boolean;
|
|
62
|
+
isExpanded: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Props of the dynamic `item.<column>` slot. */
|
|
65
|
+
export interface TableItemSlotProps<T extends TableItem = TableItem> extends TableRowSlotProps<T> {
|
|
66
|
+
header: TableComputedHeader;
|
|
67
|
+
col: number;
|
|
68
|
+
isLeftSticked: boolean;
|
|
69
|
+
}
|
|
70
|
+
/** Props of the `itemHeader` slot. */
|
|
71
|
+
export interface TableItemHeaderSlotProps<T extends TableItem = TableItem> extends TableRowSlotProps<T> {
|
|
72
|
+
isLeftStickActive: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Props of the `itemFooter` slot. */
|
|
75
|
+
export interface TableItemFooterSlotProps<T extends TableItem = TableItem> extends TableRowSlotProps<T> {
|
|
76
|
+
isStickActive: boolean;
|
|
77
|
+
}
|
|
78
|
+
/** Props of the `group` slot (rendered when `groupBy` is set). */
|
|
79
|
+
export interface TableGroupSlotProps<T extends TableItem = TableItem> {
|
|
80
|
+
items: T[];
|
|
81
|
+
group: string;
|
|
82
|
+
isFolded: boolean | undefined;
|
|
83
|
+
toggleFold: () => void;
|
|
84
|
+
}
|
package/@types/vite.config.d.ts
CHANGED
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ A Vue 3 + TypeScript component framework — batteries included.
|
|
|
4
4
|
|
|
5
5
|
> 89 components · 39 composables · layout system · theming · SCSS helpers · Storybook · Vitest
|
|
6
6
|
|
|
7
|
+
**Docs and live examples:** [Storybook — sui.surakh.com](https://sui.surakh.com/)
|
|
8
|
+
|
|
7
9
|
## Features
|
|
8
10
|
|
|
9
11
|
- **89 components** prefixed with `S` (e.g. `SButton`, `SCard`, `SInput`, `SDialog`, `SAutocomplete`, `SDataTable`). Every component ships with TypeScript prop types in `definitions/`.
|
|
@@ -17,42 +19,21 @@ A Vue 3 + TypeScript component framework — batteries included.
|
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### 1. Configure the registry
|
|
23
|
-
|
|
24
|
-
**For Yarn 4 (Berry)** — add to `.yarnrc.yml`:
|
|
25
|
-
|
|
26
|
-
```yaml
|
|
27
|
-
npmScopes:
|
|
28
|
-
khsura:
|
|
29
|
-
npmAlwaysAuth: true
|
|
30
|
-
npmAuthToken: "${NPM_GITHUB_TOKEN}"
|
|
31
|
-
npmRegistryServer: "https://npm.pkg.github.com"
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Then expose the token via an env file (e.g. `.env.yarn` listed under `injectEnvironmentFiles`):
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
NPM_GITHUB_TOKEN=ghp_xxx...
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**For npm** — add to `~/.npmrc` (or project `.npmrc`):
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
@khsura:registry=https://npm.pkg.github.com
|
|
44
|
-
//npm.pkg.github.com/:_authToken=${NPM_GITHUB_TOKEN}
|
|
45
|
-
```
|
|
22
|
+
Published to the public npm registry — no `.npmrc`, registry config or token needed.
|
|
46
23
|
|
|
47
|
-
###
|
|
24
|
+
### 1. Add the package
|
|
48
25
|
|
|
49
26
|
```bash
|
|
50
|
-
yarn add @khsura/sui
|
|
51
|
-
# or
|
|
52
27
|
npm i @khsura/sui
|
|
28
|
+
# or
|
|
29
|
+
yarn add @khsura/sui
|
|
53
30
|
```
|
|
54
31
|
|
|
55
|
-
|
|
32
|
+
`vue` is a peer dependency: the app needs **Vue 3.5.41 or newer** (3.5.40 and older have a template compiler bug that breaks `v-show` inside a keyed `v-for`, e.g. tab panels). `vue-router` is optional: with it, `to` props render a `router-link`; without it, they render a plain `<a href>`.
|
|
33
|
+
|
|
34
|
+
> **Migrating from GitHub Packages:** older versions were published to GitHub Packages. Remove the `@khsura:registry=...` line (and its `:_authToken=...` line) from your `.npmrc`, or the `npmScopes.khsura` block from `.yarnrc.yml`, so the scope resolves from npm again.
|
|
35
|
+
|
|
36
|
+
### 2. Install the plugin
|
|
56
37
|
|
|
57
38
|
```ts
|
|
58
39
|
// main.ts
|
|
@@ -75,6 +56,16 @@ You can also import SCSS sources if you want to extend tokens:
|
|
|
75
56
|
@use '@khsura/sui/helpers.scss' as *;
|
|
76
57
|
```
|
|
77
58
|
|
|
59
|
+
### 3. iPhone notch and home indicator (optional)
|
|
60
|
+
|
|
61
|
+
For a full-screen app on iPhone, add `viewport-fit=cover` to the viewport meta in `index.html`:
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`SApp` reads `env(safe-area-inset-*)` into `--s-safe-area-top|right|bottom|left`. A fixed `SAppBar`, `SBottomNavigation`, the mobile `SNavigationDrawer`, a fullscreen `SDialog` and `SSnackbar` pad by them. Without the opt-in, and on desktop and Android, the insets are `0px` and nothing changes.
|
|
68
|
+
|
|
78
69
|
## Quick start
|
|
79
70
|
|
|
80
71
|
```vue
|
|
@@ -159,7 +150,7 @@ const {
|
|
|
159
150
|
|
|
160
151
|
Per-component docs live in [`docs/components/`](./docs/components/). Start with [`index.md`](./docs/components/index.md).
|
|
161
152
|
|
|
162
|
-
Interactive reference is in Storybook:
|
|
153
|
+
Interactive reference with live examples is in Storybook at **https://sui.surakh.com/**. To run it locally:
|
|
163
154
|
|
|
164
155
|
```bash
|
|
165
156
|
yarn workspace @khsura/sui storybook:dev
|