@skewedaspect/sleekspace-ui 0.8.1 → 0.9.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/dist/components/Dropdown/SkDropdown.vue.d.ts +9 -1
- package/dist/components/Dropdown/types.d.ts +2 -1
- package/dist/components/NavBar/SkNavBar.vue.d.ts +9 -1
- package/dist/components/NavBar/context.d.ts +2 -0
- package/dist/components/NavBar/types.d.ts +5 -1
- package/dist/components/NumberInput/SkNumberInput.vue.d.ts +8 -0
- package/dist/components/Page/SkPage.vue.d.ts +9 -0
- package/dist/components/ScrollArea/SkScrollArea.vue.d.ts +105 -4
- package/dist/composables/useCustomColors.d.ts +18 -56
- package/{src → dist}/global.d.ts +6 -2
- package/dist/sleekspace-ui.css +4257 -1253
- package/dist/sleekspace-ui.es.js +300 -170
- package/dist/sleekspace-ui.umd.js +299 -169
- package/dist/static/classes.d.ts +18 -0
- package/dist/static/components/alert.d.ts +12 -0
- package/dist/static/components/avatar.d.ts +9 -0
- package/dist/static/components/breadcrumbs.d.ts +6 -0
- package/dist/static/components/button.d.ts +13 -0
- package/dist/static/components/card.d.ts +5 -0
- package/dist/static/components/checkbox.d.ts +10 -0
- package/dist/static/components/colorPicker.d.ts +8 -0
- package/dist/static/components/divider.d.ts +8 -0
- package/dist/static/components/dropdown.d.ts +8 -0
- package/dist/static/components/field.d.ts +15 -0
- package/dist/static/components/group.d.ts +5 -0
- package/dist/static/components/input.d.ts +14 -0
- package/dist/static/components/navBar.d.ts +16 -0
- package/dist/static/components/numberInput.d.ts +15 -0
- package/dist/static/components/page.d.ts +9 -0
- package/dist/static/components/pagination.d.ts +5 -0
- package/dist/static/components/panel.d.ts +11 -0
- package/dist/static/components/progress.d.ts +9 -0
- package/dist/static/components/radio.d.ts +11 -0
- package/dist/static/components/select.d.ts +10 -0
- package/dist/static/components/sidebar.d.ts +9 -0
- package/dist/static/components/skeleton.d.ts +11 -0
- package/dist/static/components/slider.d.ts +12 -0
- package/dist/static/components/spinner.d.ts +12 -0
- package/dist/static/components/switchInput.d.ts +10 -0
- package/dist/static/components/table.d.ts +12 -0
- package/dist/static/components/tag.d.ts +8 -0
- package/dist/static/components/tagsInput.d.ts +7 -0
- package/dist/static/components/textarea.d.ts +12 -0
- package/dist/static/components/toolbar.d.ts +12 -0
- package/dist/static/components/tooltip.d.ts +7 -0
- package/dist/static/escape.d.ts +2 -0
- package/dist/static/index.cjs.js +1 -0
- package/dist/static/index.d.ts +68 -0
- package/dist/static/index.es.js +732 -0
- package/dist/static/render.d.ts +12 -0
- package/dist/static/specs.d.ts +2 -0
- package/dist/static/types.d.ts +43 -0
- package/dist/tokens.css +322 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/utils/slots.d.ts +6 -0
- package/docs/guides/installation.md +8 -2
- package/docs/guides/pure-css/_meta.yaml +8 -0
- package/docs/guides/pure-css/class-api.md +1070 -0
- package/docs/guides/pure-css/custom-elements.md +574 -0
- package/docs/guides/pure-css/index.md +86 -0
- package/docs/guides/pure-css/limitations.md +152 -0
- package/docs/guides/pure-css/static-helpers.md +1203 -0
- package/llms-full.txt +3739 -261
- package/package.json +19 -5
- package/src/components/Alert/SkAlert.vue +4 -2
- package/src/components/Breadcrumbs/SkBreadcrumbs.vue +6 -12
- package/src/components/Button/SkButton.vue +8 -5
- package/src/components/Card/SkCard.vue +13 -5
- package/src/components/Checkbox/SkCheckbox.vue +9 -2
- package/src/components/ContextMenu/SkContextMenuRadioGroup.vue +4 -1
- package/src/components/Dropdown/SkDropdown.vue +20 -3
- package/src/components/Dropdown/SkDropdownRadioGroup.vue +4 -1
- package/src/components/Dropdown/types.ts +2 -1
- package/src/components/Modal/SkModal.vue +11 -4
- package/src/components/NavBar/SkNavBar.vue +19 -8
- package/src/components/NavBar/context.ts +4 -2
- package/src/components/NavBar/types.ts +6 -1
- package/src/components/NumberInput/SkNumberInput.vue +10 -1
- package/src/components/Page/SkPage.vue +29 -15
- package/src/components/Panel/SkPanel.vue +2 -1
- package/src/components/Popover/SkPopover.vue +11 -4
- package/src/components/Radio/SkRadio.vue +9 -2
- package/src/components/ScrollArea/SkScrollArea.vue +78 -5
- package/src/components/Switch/SkSwitch.vue +14 -13
- package/src/components/Tabs/SkTab.vue +7 -2
- package/src/components/TreeView/SkTreeItem.vue +10 -2
- package/src/components/TreeView/SkTreeView.vue +7 -2
- package/src/composables/useCustomColors.ts +86 -77
- package/src/composables/usePortalContext.test.ts +0 -2
- package/src/shims.d.ts +10 -0
- package/src/static/__tests__/parity.test.ts +717 -0
- package/src/static/__tests__/parityHarness.test.ts +98 -0
- package/src/static/__tests__/parityHarness.ts +260 -0
- package/src/static/classes.test.ts +82 -0
- package/src/static/classes.ts +111 -0
- package/src/static/components/__tests__/helpers.test.ts +837 -0
- package/src/static/components/alert.ts +117 -0
- package/src/static/components/avatar.ts +86 -0
- package/src/static/components/breadcrumbs.ts +28 -0
- package/src/static/components/button.ts +75 -0
- package/src/static/components/card.ts +27 -0
- package/src/static/components/checkbox.ts +48 -0
- package/src/static/components/colorPicker.ts +45 -0
- package/src/static/components/divider.ts +39 -0
- package/src/static/components/dropdown.ts +36 -0
- package/src/static/components/field.ts +86 -0
- package/src/static/components/group.ts +27 -0
- package/src/static/components/input.ts +55 -0
- package/src/static/components/navBar.ts +94 -0
- package/src/static/components/numberInput.ts +64 -0
- package/src/static/components/page.ts +31 -0
- package/src/static/components/pagination.ts +27 -0
- package/src/static/components/panel.ts +33 -0
- package/src/static/components/progress.ts +31 -0
- package/src/static/components/radio.ts +53 -0
- package/src/static/components/select.ts +51 -0
- package/src/static/components/sidebar.ts +85 -0
- package/src/static/components/skeleton.ts +66 -0
- package/src/static/components/slider.ts +50 -0
- package/src/static/components/spinner.ts +94 -0
- package/src/static/components/switchInput.ts +49 -0
- package/src/static/components/table.ts +88 -0
- package/src/static/components/tag.ts +76 -0
- package/src/static/components/tagsInput.ts +35 -0
- package/src/static/components/textarea.ts +53 -0
- package/src/static/components/toolbar.ts +74 -0
- package/src/static/components/tooltip.ts +29 -0
- package/src/static/escape.test.ts +53 -0
- package/src/static/escape.ts +28 -0
- package/src/static/generated/defaults.ts +379 -0
- package/src/static/generated/propTypes.ts +426 -0
- package/src/static/index.ts +116 -0
- package/src/static/render.test.ts +83 -0
- package/src/static/render.ts +76 -0
- package/src/static/specs.test.ts +58 -0
- package/src/static/specs.ts +230 -0
- package/src/static/types.ts +176 -0
- package/src/styles/__tests__/testHelpers.ts +97 -0
- package/src/styles/base/_custom-elements.scss +51 -0
- package/src/styles/base/_index.scss +4 -0
- package/src/styles/components/__tests__/componentSelectors.test.ts +2575 -0
- package/src/styles/components/_alert.scss +82 -39
- package/src/styles/components/_avatar.scss +102 -47
- package/src/styles/components/_breadcrumbs.scss +39 -37
- package/src/styles/components/_button.scss +58 -5
- package/src/styles/components/_card.scss +64 -2
- package/src/styles/components/_checkbox.scss +35 -5
- package/src/styles/components/_color-picker.scss +48 -13
- package/src/styles/components/_divider.scss +86 -52
- package/src/styles/components/_dropdown.scss +214 -0
- package/src/styles/components/_field.scss +76 -23
- package/src/styles/components/_group.scss +190 -79
- package/src/styles/components/_index.scss +1 -0
- package/src/styles/components/_input.scss +81 -5
- package/src/styles/components/_menu.scss +1 -1
- package/src/styles/components/_navbar.scss +76 -45
- package/src/styles/components/_number-input.scss +98 -85
- package/src/styles/components/_page.scss +82 -23
- package/src/styles/components/_pagination.scss +240 -212
- package/src/styles/components/_panel.scss +268 -122
- package/src/styles/components/_progress.scss +120 -70
- package/src/styles/components/_radio.scss +35 -5
- package/src/styles/components/_scroll-area.scss +50 -22
- package/src/styles/components/_select.scss +40 -9
- package/src/styles/components/_sidebar.scss +59 -34
- package/src/styles/components/_skeleton.scss +111 -65
- package/src/styles/components/_slider.scss +34 -10
- package/src/styles/components/_spinner.scss +107 -56
- package/src/styles/components/_switch.scss +36 -5
- package/src/styles/components/_table.scss +150 -166
- package/src/styles/components/_tag.scss +244 -154
- package/src/styles/components/_tags-input.scss +46 -12
- package/src/styles/components/_textarea.scss +36 -5
- package/src/styles/components/_toolbar.scss +85 -31
- package/src/styles/components/_tooltip.scss +172 -3
- package/src/styles/mixins/_cut-border.scss +18 -4
- package/src/styles/mixins/_dual-selector.scss +192 -0
- package/src/styles/mixins/_index.scss +1 -0
- package/src/styles/mixins/dualSelector.test.ts +151 -0
- package/src/styles/themes/_colorful.scss +25 -0
- package/src/styles/themes/_greyscale.scss +25 -0
- package/src/styles/themes/_shade-scale.scss +39 -0
- package/src/styles/tokens/_semantic-color-kinds.scss +66 -0
- package/src/{types.ts → types/index.ts} +19 -11
- package/src/utils/slots.ts +75 -0
- package/web-types.json +980 -137
- package/dist/composables/useCustomColors.test.d.ts +0 -1
- package/dist/composables/useFocusTrap.test.d.ts +0 -1
- package/dist/composables/usePortalContext.test.d.ts +0 -1
- package/dist/styles/mixins/fluidSize.test.d.ts +0 -1
- package/dist/types.d.ts +0 -29
|
@@ -4,117 +4,126 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Ref, computed } from 'vue';
|
|
6
6
|
|
|
7
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
8
|
+
// Kind name resolution
|
|
9
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Kind names that the color props accept as shortcuts. Typing `baseColor="neon-pink"` resolves
|
|
13
|
+
* to `var(--sk-neon-pink-base)`; typing `borderColor="primary"` resolves to `var(--sk-primary-base)`.
|
|
14
|
+
* Any string not in this set is passed through verbatim as a CSS color value.
|
|
15
|
+
*/
|
|
16
|
+
const KIND_NAMES = new Set<string>([
|
|
17
|
+
// Semantic
|
|
18
|
+
'neutral',
|
|
19
|
+
'primary',
|
|
20
|
+
'accent',
|
|
21
|
+
'info',
|
|
22
|
+
'success',
|
|
23
|
+
'warning',
|
|
24
|
+
'danger',
|
|
25
|
+
// Color
|
|
26
|
+
'boulder',
|
|
27
|
+
'neon-blue',
|
|
28
|
+
'light-blue',
|
|
29
|
+
'neon-orange',
|
|
30
|
+
'neon-purple',
|
|
31
|
+
'neon-green',
|
|
32
|
+
'neon-mint',
|
|
33
|
+
'neon-pink',
|
|
34
|
+
'yellow',
|
|
35
|
+
'red',
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
type ColorPart = 'base' | 'text';
|
|
39
|
+
|
|
40
|
+
function resolveColor(value : string | undefined, part : ColorPart) : string | undefined
|
|
41
|
+
{
|
|
42
|
+
if(!value) { return undefined; }
|
|
43
|
+
const trimmed = value.trim();
|
|
44
|
+
if(KIND_NAMES.has(trimmed))
|
|
45
|
+
{
|
|
46
|
+
return `var(--sk-${ trimmed }-${ part })`;
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function unwrap(input : Ref<string | undefined> | string | undefined) : string | undefined
|
|
52
|
+
{
|
|
53
|
+
return typeof input === 'string' ? input : input?.value;
|
|
54
|
+
}
|
|
55
|
+
|
|
7
56
|
//----------------------------------------------------------------------------------------------------------------------
|
|
8
57
|
|
|
9
58
|
/**
|
|
10
59
|
* Composable for handling custom color props in components.
|
|
11
60
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
61
|
+
* Generates CSS custom properties that override a component's default color tokens. Props accept
|
|
62
|
+
* either a kind name (e.g. `"neon-pink"`, `"primary"`), which resolves to the matching
|
|
63
|
+
* `--sk-<kind>-base/-text` token, or any raw CSS color value (hex, rgb, oklch, named, or
|
|
64
|
+
* `var(...)`), which is passed through unchanged. This lets consumers use SleekSpace's palette
|
|
65
|
+
* by name without having to remember the token syntax.
|
|
15
66
|
*
|
|
16
67
|
* Works with any component that follows the CSS variable naming convention:
|
|
17
68
|
* - `--sk-{componentName}-color-base` for the base/background color
|
|
18
69
|
* - `--sk-{componentName}-fg` for the foreground/text color
|
|
70
|
+
* - `--sk-{componentName}-border-base` / `--sk-{componentName}-border-color` for the border (optional)
|
|
19
71
|
*
|
|
20
|
-
* @param componentName - The component name used in CSS variable naming
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
23
|
-
*
|
|
72
|
+
* @param componentName - The component name used in CSS variable naming (e.g., 'button', 'panel')
|
|
73
|
+
* @param baseColor - Kind name or CSS color value for the base/background color
|
|
74
|
+
* @param textColor - Kind name or CSS color value for the foreground/text color. Falls back to
|
|
75
|
+
* `--sk-neutral-text` when only `baseColor` is provided.
|
|
76
|
+
* @param borderColor - Optional kind name or CSS color value for the border. When provided,
|
|
77
|
+
* both `--sk-<component>-border-base` and `--sk-<component>-border-color`
|
|
78
|
+
* are emitted so the border takes precedence over any kind's default.
|
|
24
79
|
*
|
|
25
80
|
* @returns Computed style object with CSS variables ready to bind to a component's style attribute
|
|
26
81
|
*
|
|
27
|
-
* @example
|
|
82
|
+
* @example Kind name shortcut
|
|
28
83
|
* ```vue
|
|
29
|
-
* <
|
|
30
|
-
* import { useCustomColors } from '@/composables/useCustomColors';
|
|
31
|
-
*
|
|
32
|
-
* const props = defineProps<{ baseColor?: string }>();
|
|
33
|
-
* const customColors = useCustomColors('button', toRef(() => props.baseColor), undefined);
|
|
34
|
-
* </script>
|
|
35
|
-
*
|
|
36
|
-
* <template>
|
|
37
|
-
* <button :style="customColors">Click me</button>
|
|
38
|
-
* </template>
|
|
84
|
+
* <SkPanel base-color="neon-pink" text-color="primary" border-color="neon-purple">...</SkPanel>
|
|
39
85
|
* ```
|
|
40
86
|
*
|
|
41
|
-
* @example
|
|
87
|
+
* @example Raw CSS values
|
|
42
88
|
* ```vue
|
|
43
|
-
* <SkButton base-color="oklch(0.7 0.25 300)" text-color="white">
|
|
44
|
-
* Custom Purple Button
|
|
45
|
-
* </SkButton>
|
|
89
|
+
* <SkButton base-color="oklch(0.7 0.25 300)" text-color="white">Click me</SkButton>
|
|
46
90
|
* ```
|
|
47
|
-
*
|
|
48
|
-
* @example Using CSS variables
|
|
49
|
-
* ```vue
|
|
50
|
-
* <SkPanel base-color="var(--my-custom-color)" text-color="var(--my-text-color)">
|
|
51
|
-
* Content
|
|
52
|
-
* </SkPanel>
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @example Custom component
|
|
56
|
-
* ```vue
|
|
57
|
-
* <script setup>
|
|
58
|
-
* import { useCustomColors } from '@/composables/useCustomColors';
|
|
59
|
-
*
|
|
60
|
-
* const props = defineProps<{ baseColor?: string; textColor?: string }>();
|
|
61
|
-
* const customColors = useCustomColors('my-widget', toRef(() => props.baseColor), toRef(() => props.textColor));
|
|
62
|
-
* </script>
|
|
63
|
-
*
|
|
64
|
-
* <template>
|
|
65
|
-
* <div class="my-widget" :style="customColors">
|
|
66
|
-
* <!-- Will generate: --sk-my-widget-color-base and --sk-my-widget-fg -->
|
|
67
|
-
* </div>
|
|
68
|
-
* </template>
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* Generated CSS variables:
|
|
72
|
-
* - `--sk-{componentName}-color-base` - The base color for backgrounds and accents
|
|
73
|
-
* - `--sk-{componentName}-fg` - The foreground/text color
|
|
74
|
-
*
|
|
75
|
-
* @remarks
|
|
76
|
-
* - If `textColor` is not provided, components will use `--sk-neutral-text` from the active theme
|
|
77
|
-
* - For best contrast, always provide `textColor` when using custom `baseColor`
|
|
78
|
-
* - The generated CSS variables integrate with the component's existing token system
|
|
79
|
-
* - Works with any component name - no need to register components beforehand
|
|
80
91
|
*/
|
|
81
92
|
export function useCustomColors(
|
|
82
93
|
componentName : string,
|
|
83
94
|
baseColor : Ref<string | undefined> | string | undefined,
|
|
84
|
-
textColor : Ref<string | undefined> | string | undefined
|
|
95
|
+
textColor : Ref<string | undefined> | string | undefined,
|
|
96
|
+
borderColor ?: Ref<string | undefined> | string | undefined
|
|
85
97
|
) : Ref<Record<string, string>>
|
|
86
98
|
{
|
|
87
99
|
return computed(() =>
|
|
88
100
|
{
|
|
89
101
|
const styles : Record<string, string> = {};
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
const
|
|
103
|
+
const baseResolved = resolveColor(unwrap(baseColor), 'base');
|
|
104
|
+
const textResolved = resolveColor(unwrap(textColor), 'text');
|
|
105
|
+
const borderResolved = resolveColor(unwrap(borderColor), 'base');
|
|
94
106
|
|
|
95
|
-
|
|
96
|
-
if(!baseColorValue)
|
|
107
|
+
if(baseResolved)
|
|
97
108
|
{
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Set the base color CSS variable
|
|
102
|
-
const baseVarName = `--sk-${ componentName }-color-base`;
|
|
103
|
-
styles[baseVarName] = baseColorValue;
|
|
109
|
+
styles[`--sk-${ componentName }-color-base`] = baseResolved;
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
// Keep historical contract: when a caller sets baseColor without textColor, fall back
|
|
112
|
+
// to --sk-neutral-text so text remains legible on arbitrary custom backgrounds.
|
|
113
|
+
styles[`--sk-${ componentName }-fg`] = textResolved ?? 'var(--sk-neutral-text)';
|
|
114
|
+
}
|
|
115
|
+
else if(textResolved)
|
|
109
116
|
{
|
|
110
|
-
|
|
111
|
-
styles[fgVarName] = textColorValue;
|
|
117
|
+
styles[`--sk-${ componentName }-fg`] = textResolved;
|
|
112
118
|
}
|
|
113
|
-
|
|
119
|
+
|
|
120
|
+
if(borderResolved)
|
|
114
121
|
{
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
|
|
122
|
+
// Set both tokens so the override wins regardless of which one the component's
|
|
123
|
+
// SCSS consults (`--*-border-base` usually drives decorations; `--*-border-color`
|
|
124
|
+
// drives the actual border).
|
|
125
|
+
styles[`--sk-${ componentName }-border-base`] = borderResolved;
|
|
126
|
+
styles[`--sk-${ componentName }-border-color`] = borderResolved;
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
return styles;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Portal Context Composable Tests
|
|
3
3
|
//----------------------------------------------------------------------------------------------------------------------
|
|
4
4
|
|
|
5
|
-
/* eslint-disable vue/one-component-per-file */
|
|
6
|
-
|
|
7
5
|
import { describe, expect, it } from 'vitest';
|
|
8
6
|
import { defineComponent, h, inject, provide, ref } from 'vue';
|
|
9
7
|
import { mount } from '@vue/test-utils';
|
package/src/shims.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// Module shims
|
|
3
|
+
//
|
|
4
|
+
// Type declarations for side-effect imports and asset modules that TypeScript can't resolve natively.
|
|
5
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
declare module '*.css';
|
|
8
|
+
declare module '*.scss';
|
|
9
|
+
|
|
10
|
+
//----------------------------------------------------------------------------------------------------------------------
|