@ui0/flex 0.0.0-stage → 0.1.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 +43 -2
- package/dist/components/flex/flex.config.d.ts +3 -0
- package/dist/components/flex/flex.config.d.ts.map +1 -0
- package/dist/components/flex/flex.grid.d.ts +11 -0
- package/dist/components/flex/flex.grid.d.ts.map +1 -0
- package/dist/components/flex/flex.keys.d.ts +5 -0
- package/dist/components/flex/flex.keys.d.ts.map +1 -0
- package/dist/components/flex/flex.layout.d.ts +19 -0
- package/dist/components/flex/flex.layout.d.ts.map +1 -0
- package/dist/components/flex/flex.types.d.ts +99 -0
- package/dist/components/flex/flex.types.d.ts.map +1 -0
- package/dist/components/flex/flex.util.d.ts +5 -0
- package/dist/components/flex/flex.util.d.ts.map +1 -0
- package/dist/components/flex/flex.vue.d.ts +12 -0
- package/dist/components/flex/flex.vue.d.ts.map +1 -0
- package/dist/components/flex/index.d.ts +4 -0
- package/dist/components/flex/index.d.ts.map +1 -0
- package/dist/flex.module.css +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +179 -0
- package/dist/style.css +2 -0
- package/package.json +46 -4
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ui0/flex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Vue flex container with rows, columns, wrapping, spacing, sizing, alignment, and optional ui0 theme styling.
|
|
4
|
+
|
|
5
|
+
```vue
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { Flex } from '@ui0/flex'
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<Flex
|
|
12
|
+
items="center"
|
|
13
|
+
content="space-between"
|
|
14
|
+
:gap="16"
|
|
15
|
+
>
|
|
16
|
+
<strong>Project</strong>
|
|
17
|
+
<button type="button">Save</button>
|
|
18
|
+
</Flex>
|
|
19
|
+
</template>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The main entry imports component CSS automatically. Basic layout works without installing core or theme.
|
|
23
|
+
Use a direct named/default component import; there is no Flex plugin. Global registration, when needed,
|
|
24
|
+
uses Vue's `app.component('Flex', Flex)`.
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
- [English guide and live examples](../docs/en/flex/index.md)
|
|
29
|
+
- [Русское руководство и живые примеры](../docs/flex/index.md)
|
|
30
|
+
|
|
31
|
+
Run the documentation site with `pnpm --filter @ui0/docs docs:dev`.
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pnpm --filter @ui0/flex flex:test
|
|
37
|
+
pnpm --filter @ui0/flex flex:typecheck
|
|
38
|
+
pnpm --filter @ui0/flex flex:build
|
|
39
|
+
pnpm --filter @ui0/flex exec playwright install chromium
|
|
40
|
+
pnpm --filter @ui0/flex flex:test:browser
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Browser checks consume the built package, including its automatic CSS import. Build first.
|
|
44
|
+
`disabled` is visual/ARIA state; it does not disable interactive descendants.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.config.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.config.ts"],"names":[],"mappings":";AAEA,wBAaE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
/** Shares a parent's horizontal gap with twelve-column children. */
|
|
3
|
+
export declare const flexGridGapKey: InjectionKey<ComputedRef<string>>;
|
|
4
|
+
/** Extracts the column gap without splitting whitespace inside CSS functions. */
|
|
5
|
+
export declare function columnGap(value: unknown): string;
|
|
6
|
+
/** Accounts for eleven gutters in a twelve-column row. Explicit basis has priority. */
|
|
7
|
+
export declare function gridStyles(cols: unknown, offset: unknown, parentGap: string): {
|
|
8
|
+
flexBasis: string | undefined;
|
|
9
|
+
marginInlineStart: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=flex.grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.grid.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAIpD,oEAAoE;AACpE,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAA+B,CAAA;AAE5F,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,UAgBvC;AAQD,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;;;EAQ3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.keys.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,eAAO,MAAM,OAAO,EAAwB,YAAY,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StyleList } from '@ui0/types';
|
|
2
|
+
import type { FlexProps } from './flex.types';
|
|
3
|
+
/** Resolves a finite numeric prop without dropping a valid zero. */
|
|
4
|
+
export declare function finiteNumber(value: unknown): number | undefined;
|
|
5
|
+
/** Normalizes unitless dimensions to px while preserving CSS expressions. */
|
|
6
|
+
export declare function cssLength(value: unknown): string | undefined;
|
|
7
|
+
/** Normalizes gap scalars and row/column pairs; invalid pairs are omitted. */
|
|
8
|
+
export declare function cssGap(value: unknown): string | undefined;
|
|
9
|
+
/** Exact glyphs: whitespace is semantic and must never be tokenized or trimmed. */
|
|
10
|
+
export declare const itemGlyphs: Readonly<Record<string, string>>;
|
|
11
|
+
/** Self-alignment additionally supports anchored start/end glyphs. */
|
|
12
|
+
export declare const selfGlyphs: Readonly<Record<string, string>>;
|
|
13
|
+
/** Distribution glyphs resolve independently of the item's cross-axis glyphs. */
|
|
14
|
+
export declare const contentGlyphs: Readonly<Record<string, string>>;
|
|
15
|
+
/** Preserves CSS keywords and resolves only complete known glyphs. */
|
|
16
|
+
export declare function alignment(value: unknown, glyphs: Readonly<Record<string, string>>): string | undefined;
|
|
17
|
+
/** Produces layout declarations independently of theme availability. */
|
|
18
|
+
export declare function flexLayout(props: FlexProps): StyleList;
|
|
19
|
+
//# sourceMappingURL=flex.layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.layout.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,sBAK1C;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,sBAWvC;AAED,8EAA8E;AAC9E,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,sBAWpC;AAED,mFAAmF;AACnF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMvD,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMvD,CAAA;AAED,iFAAiF;AACjF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO1D,CAAA;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,sBAIjF;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAoBtD"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flex component contract.
|
|
3
|
+
*/
|
|
4
|
+
import type { BackdropProps, ColorProps, DisabledProps, ElevationProps, FillProps, RoundProps } from '@ui0/theme';
|
|
5
|
+
import type { BooleanDoubleUnits, BooleanOrUnits, CSS, MaybeBooleanDoubleUnits, MaybeBooleanNumberish, MaybeUnits, Numberish } from '@ui0/types';
|
|
6
|
+
/**
|
|
7
|
+
* Alignment glyphs: a three-cell rail, read in the flex direction's
|
|
8
|
+
* cross-axis (left-to-right or top-to-bottom). A dash marks an occupied
|
|
9
|
+
* cell; SPACES ARE SIGNIFICANT and part of the value. The whole prop value
|
|
10
|
+
* is ONE glyph - never tokenized or trimmed (see the flex behavior task for
|
|
11
|
+
* the glyph -> class mapping).
|
|
12
|
+
*
|
|
13
|
+
* '-- ' packed at the rail's head (start)
|
|
14
|
+
* ' --' packed at the rail's tail (end)
|
|
15
|
+
* ' - ' centered on the rail
|
|
16
|
+
* '---' stretched across all cells
|
|
17
|
+
* '-' baseline alignment
|
|
18
|
+
*
|
|
19
|
+
* Distribution glyphs for content: '- -' = space-between, '- - ' =
|
|
20
|
+
* space-around, ' - -' = space-evenly. Anchored self glyphs '- '/'- --'
|
|
21
|
+
* resolve to self-start; ' -'/'-- -' resolve to self-end.
|
|
22
|
+
*/
|
|
23
|
+
export type FlexAlignItems = '---' | '-- ' | ' --' | ' - ' | '-';
|
|
24
|
+
/** the rail read top-to-bottom: '- ' head, ' - ' middle, ' -' tail */
|
|
25
|
+
export type FlexVerticalSide = ' - ' | ' -' | '- ';
|
|
26
|
+
/** justify-content glyphs: the packed trio plus the distribution family */
|
|
27
|
+
export type FlexJustifyContent = '-- ' | ' --' | ' - ' | '- - ' | ' - -' | '- -';
|
|
28
|
+
/** align-self: every items glyph plus the anchored two-cluster forms */
|
|
29
|
+
export type FlexAlignSelf = FlexAlignItems | '- ' | '- --' | '-- -' | ' -';
|
|
30
|
+
/** justify-self accepts the same glyph set as align-self (CSS parity) */
|
|
31
|
+
export type FlexJustifySelf = FlexAlignSelf;
|
|
32
|
+
export interface Flexible {
|
|
33
|
+
}
|
|
34
|
+
export interface FlexProps extends Flexible, BackdropProps, ColorProps, FillProps, RoundProps, ElevationProps, DisabledProps {
|
|
35
|
+
/** align-self (css value or alignment glyph) */
|
|
36
|
+
align?: CSS.Property.AlignSelf | FlexAlignSelf;
|
|
37
|
+
/** Initial main-axis size; unitless numeric strings become px. */
|
|
38
|
+
basis?: CSS.Property.FlexBasis;
|
|
39
|
+
/** Uses a column; takes priority if row is also true. */
|
|
40
|
+
column?: boolean | undefined;
|
|
41
|
+
/** justify-content (css value or alignment glyph) */
|
|
42
|
+
content?: CSS.Property.JustifyContent | FlexJustifyContent;
|
|
43
|
+
/** Scalar or row/column gap pair; numbers become px, true reads --0-flex-gap, false uses zero. */
|
|
44
|
+
gap?: MaybeBooleanDoubleUnits;
|
|
45
|
+
/** Nonnegative growth factor; true is 1, false is 0, numeric strings are accepted. */
|
|
46
|
+
grow?: MaybeBooleanNumberish;
|
|
47
|
+
/** container height */
|
|
48
|
+
height?: MaybeUnits;
|
|
49
|
+
/** align-items (css value or alignment glyph) */
|
|
50
|
+
items?: CSS.Property.AlignItems | FlexAlignItems;
|
|
51
|
+
/** justify-self (css value or alignment glyph) */
|
|
52
|
+
justify?: CSS.Property.JustifySelf | FlexJustifySelf;
|
|
53
|
+
/** Skips 0–12 tracks within a parent Flex row using its gap prop. */
|
|
54
|
+
offset?: Numberish;
|
|
55
|
+
/** Integer visual order; does not change DOM or keyboard focus order. */
|
|
56
|
+
order?: Numberish;
|
|
57
|
+
/** shortcut for flex-direction: row */
|
|
58
|
+
row?: boolean | undefined;
|
|
59
|
+
/** Reverses the main axis without changing the wrapping direction. */
|
|
60
|
+
reverse?: boolean | undefined;
|
|
61
|
+
/** flex shrink */
|
|
62
|
+
shrink?: Numberish;
|
|
63
|
+
/** flex wrap */
|
|
64
|
+
wrap?: boolean | undefined;
|
|
65
|
+
/** container width */
|
|
66
|
+
width?: MaybeUnits;
|
|
67
|
+
/** Spans 1–12 tracks in a parent Flex row; explicit basis takes priority. */
|
|
68
|
+
cols?: Numberish;
|
|
69
|
+
/** Fills both parent dimensions; explicit width/height take priority. */
|
|
70
|
+
fluid?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** Legacy defaults registry shape, not implicit runtime defaults of the component. */
|
|
73
|
+
export interface FlexDefaults extends FlexProps {
|
|
74
|
+
blur: BooleanOrUnits;
|
|
75
|
+
gap: BooleanDoubleUnits;
|
|
76
|
+
shrink: number | undefined;
|
|
77
|
+
order: number | undefined;
|
|
78
|
+
content: string | undefined;
|
|
79
|
+
grow: BooleanOrUnits;
|
|
80
|
+
}
|
|
81
|
+
export interface FlexSlots {
|
|
82
|
+
default: () => void;
|
|
83
|
+
}
|
|
84
|
+
export interface FlexActions {
|
|
85
|
+
}
|
|
86
|
+
declare global {
|
|
87
|
+
interface Ui0ComponentsProps {
|
|
88
|
+
flex: FlexProps;
|
|
89
|
+
}
|
|
90
|
+
interface Ui0ComponentsDefaults {
|
|
91
|
+
flex: FlexDefaults;
|
|
92
|
+
}
|
|
93
|
+
interface Ui0Components {
|
|
94
|
+
flex: {
|
|
95
|
+
props: FlexProps;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=flex.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.types.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,O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AE,SAAS,CAAA;KAChB;IACD,UAAU,qBAAqB;QAC7B,IAAI,EAAE,YAAY,CAAA;KACnB;IACD,UAAU,aAAa;QACrB,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS,CAAA;SACjB,CAAA;KACF;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.util.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,MAAM,SAAS,CAiBxD,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,aAAa,CAAC,SAAS,CAG7C,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlexProps, FlexSlots } from './flex.types';
|
|
2
|
+
type __VLS_Slots = FlexSlots;
|
|
3
|
+
declare const __VLS_base: import("vue").DefineComponent<FlexProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FlexProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=flex.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.vue.d.ts","sourceRoot":"","sources":["../../../src/components/flex/flex.vue"],"names":[],"mappings":"AAsGE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AASxD,KAAK,WAAW,GAAG,SAAS,CAAC;AA6E/B,QAAA,MAAM,UAAU,8RAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/flex/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAGxC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAA;AACnD,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import "./style.css";
|
|
2
|
+
import { computed as e, createElementBlock as t, defineComponent as n, inject as r, normalizeClass as i, normalizeStyle as a, openBlock as o, provide as s, renderSlot as c, unref as l, useCssModule as u } from "vue";
|
|
3
|
+
import { defineComponentConfig as d, useComponentDefaults as f } from "@ui0/core";
|
|
4
|
+
import { useTheme as p, useThemeContext as m } from "@ui0/theme";
|
|
5
|
+
// src/components/flex/flex.config.ts
|
|
6
|
+
var h = d("flex", {
|
|
7
|
+
fill: "",
|
|
8
|
+
color: "",
|
|
9
|
+
gap: !1,
|
|
10
|
+
blur: !1,
|
|
11
|
+
shrink: void 0,
|
|
12
|
+
order: void 0,
|
|
13
|
+
grow: !1,
|
|
14
|
+
content: void 0,
|
|
15
|
+
round: "inherit",
|
|
16
|
+
options: { debug: !1 }
|
|
17
|
+
});
|
|
18
|
+
// src/components/flex/flex.layout.ts
|
|
19
|
+
function g(e) {
|
|
20
|
+
if (typeof e != "number" && typeof e != "string" || typeof e == "string" && !e.trim()) return;
|
|
21
|
+
let t = Number(e);
|
|
22
|
+
return Number.isFinite(t) ? t : void 0;
|
|
23
|
+
}
|
|
24
|
+
function _(e) {
|
|
25
|
+
let t = g(e);
|
|
26
|
+
if (t !== void 0) return `${t}px`;
|
|
27
|
+
if (typeof e == "string" && e.trim() && !(/^[+-]?(?:infinity|nan)$/i.test(e.trim()) || !Number.isNaN(Number(e)) && !Number.isFinite(Number(e)))) return e;
|
|
28
|
+
}
|
|
29
|
+
function v(e) {
|
|
30
|
+
if (e === !0) return "var(--0-flex-gap, 0.5em)";
|
|
31
|
+
if (e === !1) return "0px";
|
|
32
|
+
let t = Array.isArray(e) ? e : [e];
|
|
33
|
+
if (t.length < 1 || t.length > 2) return;
|
|
34
|
+
let n = t.map((e) => {
|
|
35
|
+
let t = g(e);
|
|
36
|
+
if (!(t !== void 0 && t < 0)) return _(e);
|
|
37
|
+
});
|
|
38
|
+
return n.every((e) => e !== void 0) ? n.join(" ") : void 0;
|
|
39
|
+
}
|
|
40
|
+
var y = {
|
|
41
|
+
"-- ": "flex-start",
|
|
42
|
+
" --": "flex-end",
|
|
43
|
+
" - ": "center",
|
|
44
|
+
"---": "stretch",
|
|
45
|
+
"-": "baseline"
|
|
46
|
+
}, b = {
|
|
47
|
+
...y,
|
|
48
|
+
"- ": "self-start",
|
|
49
|
+
" -": "self-end",
|
|
50
|
+
"- --": "self-start",
|
|
51
|
+
"-- -": "self-end"
|
|
52
|
+
}, x = {
|
|
53
|
+
"-- ": "flex-start",
|
|
54
|
+
" --": "flex-end",
|
|
55
|
+
" - ": "center",
|
|
56
|
+
"- - ": "space-around",
|
|
57
|
+
" - -": "space-evenly",
|
|
58
|
+
"- -": "space-between"
|
|
59
|
+
};
|
|
60
|
+
function S(e, t) {
|
|
61
|
+
if (typeof e == "string") return Object.hasOwn(t, e) ? t[e] : e.trim() && !/^[\s-]+$/.test(e) ? e : void 0;
|
|
62
|
+
}
|
|
63
|
+
function C(e) {
|
|
64
|
+
let t = e.column ? "column" : "row", n = typeof e.grow == "boolean" ? Number(e.grow) : g(e.grow), r = g(e.shrink), i = g(e.order);
|
|
65
|
+
return {
|
|
66
|
+
flexDirection: e.reverse ? `${t}-reverse` : t,
|
|
67
|
+
flexWrap: e.wrap === void 0 ? void 0 : e.wrap ? "wrap" : "nowrap",
|
|
68
|
+
gap: v(e.gap),
|
|
69
|
+
flexGrow: n !== void 0 && n >= 0 ? n : void 0,
|
|
70
|
+
flexShrink: r !== void 0 && r >= 0 ? r : void 0,
|
|
71
|
+
flexBasis: _(e.basis),
|
|
72
|
+
order: i !== void 0 && Number.isInteger(i) ? i : void 0,
|
|
73
|
+
width: _(e.width) ?? (e.fluid ? "100%" : void 0),
|
|
74
|
+
height: _(e.height) ?? (e.fluid ? "100%" : void 0),
|
|
75
|
+
alignItems: S(e.items, y),
|
|
76
|
+
alignSelf: S(e.align, b),
|
|
77
|
+
justifyContent: S(e.content, x),
|
|
78
|
+
justifySelf: S(e.justify, b)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// src/components/flex/flex.grid.ts
|
|
82
|
+
var w = Symbol("ui0-flex-grid-gap");
|
|
83
|
+
function T(e) {
|
|
84
|
+
let t = v(e);
|
|
85
|
+
if (!t) return "0px";
|
|
86
|
+
let n = [], r = 0, i = "";
|
|
87
|
+
for (let e of t) e === "(" && r++, e === ")" && r--, /\s/.test(e) && r === 0 ? (i && n.push(i), i = "") : i += e;
|
|
88
|
+
return i && n.push(i), n[1] ?? n[0] ?? "0px";
|
|
89
|
+
}
|
|
90
|
+
function E(e, t) {
|
|
91
|
+
let n = g(e);
|
|
92
|
+
return n !== void 0 && Number.isInteger(n) && n >= t && n <= 12 ? n : void 0;
|
|
93
|
+
}
|
|
94
|
+
function D(e, t, n) {
|
|
95
|
+
let r = E(e, 1), i = E(t, 0);
|
|
96
|
+
return {
|
|
97
|
+
flexBasis: r === void 0 ? void 0 : `calc((100% - 11 * ${n}) / 12 * ${r} + ${r - 1} * ${n})`,
|
|
98
|
+
marginInlineStart: i === void 0 ? void 0 : `calc((100% + ${n}) / 12 * ${i})`
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// src/components/flex/flex.vue?vue&type=script&setup=true&lang.ts
|
|
102
|
+
var O = ["aria-disabled"], k = /*#__PURE__*/ ((e, t) => {
|
|
103
|
+
let n = e.__vccOpts || e;
|
|
104
|
+
for (let [e, r] of t) n[e] = r;
|
|
105
|
+
return n;
|
|
106
|
+
})(/* @__PURE__ */ n({
|
|
107
|
+
__name: "flex",
|
|
108
|
+
props: {
|
|
109
|
+
align: {},
|
|
110
|
+
basis: {},
|
|
111
|
+
column: { type: Boolean },
|
|
112
|
+
content: {},
|
|
113
|
+
gap: { type: [
|
|
114
|
+
Boolean,
|
|
115
|
+
Number,
|
|
116
|
+
String,
|
|
117
|
+
Array
|
|
118
|
+
] },
|
|
119
|
+
grow: { type: [
|
|
120
|
+
Boolean,
|
|
121
|
+
Number,
|
|
122
|
+
String
|
|
123
|
+
] },
|
|
124
|
+
height: {},
|
|
125
|
+
items: {},
|
|
126
|
+
justify: {},
|
|
127
|
+
offset: {},
|
|
128
|
+
order: {},
|
|
129
|
+
row: { type: Boolean },
|
|
130
|
+
reverse: { type: Boolean },
|
|
131
|
+
shrink: {},
|
|
132
|
+
wrap: { type: Boolean },
|
|
133
|
+
width: {},
|
|
134
|
+
cols: {},
|
|
135
|
+
fluid: { type: Boolean },
|
|
136
|
+
backdrop: {},
|
|
137
|
+
color: {},
|
|
138
|
+
fill: {},
|
|
139
|
+
round: {},
|
|
140
|
+
roundTarget: {},
|
|
141
|
+
elevation: {},
|
|
142
|
+
disabled: { type: Boolean }
|
|
143
|
+
},
|
|
144
|
+
setup(n) {
|
|
145
|
+
let d = n, g = f("flex", d, h), _ = u(), v = r(w, e(() => "0px"));
|
|
146
|
+
s(w, e(() => T(g.gap)));
|
|
147
|
+
let [, y] = p() ? m(d) : [], b = e(() => [
|
|
148
|
+
_.flex,
|
|
149
|
+
g.column ? _.column : _.row,
|
|
150
|
+
g.grow === !0 && _.grow,
|
|
151
|
+
g.disabled && _.disabled,
|
|
152
|
+
Number(g.elevation) !== 0 && g.elevation !== void 0 && _.elevated,
|
|
153
|
+
...y?.classes() ?? []
|
|
154
|
+
]), x = e(() => {
|
|
155
|
+
let e = C(g), t = D(g.cols, g.offset, v.value);
|
|
156
|
+
return {
|
|
157
|
+
...y?.styles(),
|
|
158
|
+
...e,
|
|
159
|
+
...t,
|
|
160
|
+
flexBasis: e.flexBasis ?? t.flexBasis
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
return (e, n) => (o(), t("div", {
|
|
164
|
+
"data-0": "flex",
|
|
165
|
+
class: i(b.value),
|
|
166
|
+
style: a(x.value),
|
|
167
|
+
"aria-disabled": l(g).disabled ? "true" : void 0
|
|
168
|
+
}, [c(e.$slots, "default")], 14, O));
|
|
169
|
+
}
|
|
170
|
+
}), [["__cssModules", { $style: {
|
|
171
|
+
flex: "fl_222f",
|
|
172
|
+
disabled: "di_17eb",
|
|
173
|
+
elevated: "el_dcd5",
|
|
174
|
+
row: "ro_6347",
|
|
175
|
+
column: "co_881d",
|
|
176
|
+
grow: "gr_adca",
|
|
177
|
+
panel: "pa_320e"
|
|
178
|
+
} }]]);
|
|
179
|
+
export { k as Flex, k as default };
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer ui0.flex{.fl_222f{box-sizing:border-box;--0-c-src:initial;--0-c-src-l:initial;--0-c-src-d:initial;--0-c-src-hover:initial;--0-c-src-active:initial;--0-c-src-focus:initial;--0-c-src-l-hover:initial;--0-c-src-l-active:initial;--0-c-src-l-focus:initial;--0-c-src-d-hover:initial;--0-c-src-d-active:initial;--0-c-src-d-focus:initial;--0-c-o:var(--0-c-src,var(--0-c-src-l,1));--0-c-cur:rgb(var(--0-c-cur-v) / var(--0-c-o));display:flex}.theme_dark .fl_222f{--0-c-o:var(--0-c-src-d,var(--0-c-src,1))}.fl_222f:hover{--0-c-o:var(--0-c-src-hover,var(--0-c-src,var(--0-c-src-l,1)))}.fl_222f:active{--0-c-o:var(--0-c-src-active,var(--0-c-src,var(--0-c-src-l,1)))}.fl_222f:focus{--0-c-o:var(--0-c-src-focus,var(--0-c-src,var(--0-c-src-l,1)))}.theme_dark .fl_222f:hover{--0-c-o:var(--0-c-src-d-hover,var(--0-c-src-hover,var(--0-c-src-d,var(--0-c-src,1))))}.theme_dark .fl_222f:active{--0-c-o:var(--0-c-src-d-active,var(--0-c-src-active,var(--0-c-src-d,var(--0-c-src,1))))}.theme_dark .fl_222f:focus{--0-c-o:var(--0-c-src-d-focus,var(--0-c-src-focus,var(--0-c-src-d,var(--0-c-src,1))))}.fl_222f{--0-f-src:initial;--0-f-src-l:initial;--0-f-src-d:initial;--0-f-src-hover:initial;--0-f-src-active:initial;--0-f-src-focus:initial;--0-f-src-l-hover:initial;--0-f-src-l-active:initial;--0-f-src-l-focus:initial;--0-f-src-d-hover:initial;--0-f-src-d-active:initial;--0-f-src-d-focus:initial;--0-f-o:var(--0-f-src,var(--0-f-src-l,1));--0-f-cur:rgb(var(--0-f-cur-v) / var(--0-f-o))}.theme_dark .fl_222f{--0-f-o:var(--0-f-src-d,var(--0-f-src,1))}.fl_222f:hover{--0-f-o:var(--0-f-src-hover,var(--0-f-src,var(--0-f-src-l,1)))}.fl_222f:active{--0-f-o:var(--0-f-src-active,var(--0-f-src,var(--0-f-src-l,1)))}.fl_222f:focus{--0-f-o:var(--0-f-src-focus,var(--0-f-src,var(--0-f-src-l,1)))}.theme_dark .fl_222f:hover{--0-f-o:var(--0-f-src-d-hover,var(--0-f-src-hover,var(--0-f-src-d,var(--0-f-src,1))))}.theme_dark .fl_222f:active{--0-f-o:var(--0-f-src-d-active,var(--0-f-src-active,var(--0-f-src-d,var(--0-f-src,1))))}.theme_dark .fl_222f:focus{--0-f-o:var(--0-f-src-d-focus,var(--0-f-src-focus,var(--0-f-src-d,var(--0-f-src,1))))}.fl_222f{--0-g-cur:initial;color:var(--0-c-cur);background-color:var(--0-f-cur);background-image:var(--0-g-cur);--0c-r-full:var(--0-r-full,calc(calc(var(--0-s-cur,42px) * var(--0-s-density,1)) / 2));--0c-r-smooth:var(--0-r-smooth,calc(calc(var(--0-s-cur,42px) * var(--0-s-density,1)) / 4));--0c-r-basic:var(--0-r-basic,calc(calc(var(--0-s-cur,42px) * var(--0-s-density,1)) / 8));--0c-r-hard:var(--0-r-hard,calc(calc(var(--0-s-cur,42px) * var(--0-s-density,1)) / 14));--0c-r-none:var(--0-r-none,0px);border-start-start-radius:var(--0-r-tl,0px);border-start-end-radius:var(--0-r-tr,0px);border-end-end-radius:var(--0-r-br,0px);border-end-start-radius:var(--0-r-bl,0px)}.di_17eb{opacity:var(--0-dis-o,.5)}.el_dcd5{box-shadow:0 0 0 1px #ffffff1a, var(--0-elv-i, ) 0px 1px 1px rgba(var(--0-elv-c,0 0 0)/.1), var(--0-elv-i, ) var(--0-elv-x1,0px) var(--0-elv-y1,0px) rgba(var(--0-elv-c,0 0 0)/.095), var(--0-elv-i, ) var(--0-elv-x2,0px) var(--0-elv-y2,0px) rgba(var(--0-elv-c,0 0 0)/.13)}.ro_6347{flex-direction:row}.co_881d{flex-direction:column}.gr_adca{flex-grow:1}.pa_320e{box-sizing:border-box}}
|
|
2
|
+
/*$vite$:1*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui0/flex",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Vue flex layouts with optional ui0 theme styling",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"**/*.css"
|
|
11
|
+
],
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./style.css": "./dist/style.css",
|
|
20
|
+
"./style": "./dist/style.css",
|
|
21
|
+
"./classes": "./dist/flex.module.css",
|
|
22
|
+
"./flex.module.css": "./dist/flex.module.css",
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"flex:build": "vite build && vue-tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
27
|
+
"flex:dev": "vite build --watch",
|
|
28
|
+
"flex:typecheck": "vue-tsc --noEmit",
|
|
29
|
+
"flex:test": "vitest run --config vitest.config.ts",
|
|
30
|
+
"flex:test:browser": "node tests/browser/run.mjs"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@ui0/vite": "0.1.1",
|
|
35
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
36
|
+
"playwright": "1.61.1",
|
|
37
|
+
"sass-embedded": "^1.80.0",
|
|
38
|
+
"vue": "^3.5.45"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@ui0/composable": "0.1.1",
|
|
42
|
+
"@ui0/core": "0.1.1",
|
|
43
|
+
"@ui0/theme": "0.1.1",
|
|
44
|
+
"@ui0/types": "0.1.1",
|
|
45
|
+
"@ui0/util": "0.0.2",
|
|
46
|
+
"vue": "^3.5.45"
|
|
47
|
+
}
|
|
48
|
+
}
|