origam 2.18.19 → 2.18.21
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/CHANGELOG.md +101 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/origam-utilities.css +30 -0
- package/dist/src/assets/css/tokens/primitive.css +5 -0
- package/dist/src/assets/scss/tokens/_origam-utilities.scss +30 -0
- package/dist/src/assets/scss/tokens/_primitive.scss +5 -0
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +2 -1
- package/dist/src/components/TextMask/OrigamTextMask.vue +2 -1
- package/dist/src/components/Title/OrigamTitle.vue +2 -1
- package/dist/src/composables/Commons/backdrop.composable.cjs +50 -0
- package/dist/src/composables/Commons/backdrop.composable.d.ts +32 -0
- package/dist/src/composables/Commons/backdrop.composable.js +33 -0
- package/dist/src/composables/Commons/opacity.composable.cjs +50 -0
- package/dist/src/composables/Commons/opacity.composable.d.ts +33 -0
- package/dist/src/composables/Commons/opacity.composable.js +34 -0
- package/dist/src/composables/Commons/stateEffect.composable.cjs +17 -2
- package/dist/src/composables/Commons/stateEffect.composable.d.ts +7 -2
- package/dist/src/composables/Commons/stateEffect.composable.js +23 -2
- package/dist/src/composables/Commons/typography.composable.cjs +7 -0
- package/dist/src/composables/Commons/typography.composable.d.ts +6 -1
- package/dist/src/composables/Commons/typography.composable.js +9 -0
- package/dist/src/composables/index.cjs +24 -0
- package/dist/src/composables/index.d.ts +2 -0
- package/dist/src/composables/index.js +2 -0
- package/dist/src/consts/Commons/backdrop.const.cjs +15 -0
- package/dist/src/consts/Commons/backdrop.const.d.ts +47 -0
- package/dist/src/consts/Commons/backdrop.const.js +9 -0
- package/dist/src/consts/Commons/border.const.cjs +4 -1
- package/dist/src/consts/Commons/border.const.d.ts +0 -18
- package/dist/src/consts/Commons/border.const.js +7 -2
- package/dist/src/consts/Commons/opacity.const.cjs +20 -0
- package/dist/src/consts/Commons/opacity.const.d.ts +58 -0
- package/dist/src/consts/Commons/opacity.const.js +14 -0
- package/dist/src/consts/index.cjs +22 -0
- package/dist/src/consts/index.d.ts +2 -0
- package/dist/src/consts/index.js +2 -0
- package/dist/src/interfaces/Commons/backdrop.interface.cjs +1 -0
- package/dist/src/interfaces/Commons/backdrop.interface.d.ts +49 -0
- package/dist/src/interfaces/Commons/backdrop.interface.js +0 -0
- package/dist/src/interfaces/Commons/opacity.interface.cjs +1 -0
- package/dist/src/interfaces/Commons/opacity.interface.d.ts +37 -0
- package/dist/src/interfaces/Commons/opacity.interface.js +0 -0
- package/dist/src/interfaces/Commons/state-effect.interface.d.ts +31 -0
- package/dist/src/interfaces/Commons/typography.interface.d.ts +47 -3
- package/dist/src/interfaces/index.cjs +22 -0
- package/dist/src/interfaces/index.d.ts +2 -0
- package/dist/src/interfaces/index.js +2 -0
- package/dist/src/types/Commons/backdrop.type.cjs +1 -0
- package/dist/src/types/Commons/backdrop.type.d.ts +23 -0
- package/dist/src/types/Commons/backdrop.type.js +0 -0
- package/dist/src/types/Commons/opacity.type.cjs +1 -0
- package/dist/src/types/Commons/opacity.type.d.ts +36 -0
- package/dist/src/types/Commons/opacity.type.js +0 -0
- package/dist/src/types/Commons/state-effect.type.d.ts +2 -1
- package/dist/src/types/index.cjs +22 -0
- package/dist/src/types/index.d.ts +2 -0
- package/dist/src/types/index.js +2 -0
- package/dist/src/types/tokens.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -123,3 +123,33 @@
|
|
|
123
123
|
.origam--text-lg { font-size: var(--origam-font__size---lg); }
|
|
124
124
|
.origam--text-xl { font-size: var(--origam-font__size---xl); }
|
|
125
125
|
.origam--text-2xl { font-size: var(--origam-font__size---2xl); }
|
|
126
|
+
|
|
127
|
+
/* --- Opacity --------------------------------------------- */
|
|
128
|
+
/* */
|
|
129
|
+
/* Emitted by `useOpacity` when the value lands on a rung of */
|
|
130
|
+
/* the primitive ladder. `useOpacity` ALSO emits the matching */
|
|
131
|
+
/* inline `opacity:` declaration (strategy A). That is not */
|
|
132
|
+
/* redundancy: a scoped component rule is (0,2,0) and beats */
|
|
133
|
+
/* this (0,1,0) class whatever the load order, and OrigamBtn */
|
|
134
|
+
/* already declares `opacity` in its own SCSS. See #514. */
|
|
135
|
+
.origam--opacity-0 { opacity: var(--origam-opacity---0); }
|
|
136
|
+
.origam--opacity-12 { opacity: var(--origam-opacity---12); }
|
|
137
|
+
.origam--opacity-26 { opacity: var(--origam-opacity---26); }
|
|
138
|
+
.origam--opacity-32 { opacity: var(--origam-opacity---32); }
|
|
139
|
+
.origam--opacity-50 { opacity: var(--origam-opacity---50); }
|
|
140
|
+
.origam--opacity-60 { opacity: var(--origam-opacity---60); }
|
|
141
|
+
.origam--opacity-70 { opacity: var(--origam-opacity---70); }
|
|
142
|
+
.origam--opacity-87 { opacity: var(--origam-opacity---87); }
|
|
143
|
+
.origam--opacity-100 { opacity: var(--origam-opacity---100); }
|
|
144
|
+
|
|
145
|
+
/* --- Backdrop blur --------------------------------------- */
|
|
146
|
+
/* */
|
|
147
|
+
/* Emitted by `useBackdrop`. The -webkit- twin is required: */
|
|
148
|
+
/* Safari still ships backdrop-filter prefixed only. Rung */
|
|
149
|
+
/* values follow the measured distribution of blur() literals */
|
|
150
|
+
/* in this repo, not a tidy doubling, hence sm = 6px. */
|
|
151
|
+
.origam--backdrop-blur-xs { backdrop-filter: blur(var(--origam-blur---xs)); -webkit-backdrop-filter: blur(var(--origam-blur---xs)); }
|
|
152
|
+
.origam--backdrop-blur-sm { backdrop-filter: blur(var(--origam-blur---sm)); -webkit-backdrop-filter: blur(var(--origam-blur---sm)); }
|
|
153
|
+
.origam--backdrop-blur-md { backdrop-filter: blur(var(--origam-blur---md)); -webkit-backdrop-filter: blur(var(--origam-blur---md)); }
|
|
154
|
+
.origam--backdrop-blur-lg { backdrop-filter: blur(var(--origam-blur---lg)); -webkit-backdrop-filter: blur(var(--origam-blur---lg)); }
|
|
155
|
+
.origam--backdrop-blur-xl { backdrop-filter: blur(var(--origam-blur---xl)); -webkit-backdrop-filter: blur(var(--origam-blur---xl)); }
|
|
@@ -162,6 +162,11 @@
|
|
|
162
162
|
--origam-opacity---70: 0.7;
|
|
163
163
|
--origam-opacity---87: 0.87;
|
|
164
164
|
--origam-opacity---100: 1;
|
|
165
|
+
--origam-blur---xs: 4px;
|
|
166
|
+
--origam-blur---sm: 6px;
|
|
167
|
+
--origam-blur---md: 8px;
|
|
168
|
+
--origam-blur---lg: 16px;
|
|
169
|
+
--origam-blur---xl: 24px;
|
|
165
170
|
--origam-border__width---0: 0px;
|
|
166
171
|
--origam-border__width---2: 2px;
|
|
167
172
|
--origam-border__width---4: 4px;
|
|
@@ -123,3 +123,33 @@
|
|
|
123
123
|
.origam--text-lg { font-size: var(--origam-font__size---lg); }
|
|
124
124
|
.origam--text-xl { font-size: var(--origam-font__size---xl); }
|
|
125
125
|
.origam--text-2xl { font-size: var(--origam-font__size---2xl); }
|
|
126
|
+
|
|
127
|
+
/* --- Opacity --------------------------------------------- */
|
|
128
|
+
/* */
|
|
129
|
+
/* Emitted by `useOpacity` when the value lands on a rung of */
|
|
130
|
+
/* the primitive ladder. `useOpacity` ALSO emits the matching */
|
|
131
|
+
/* inline `opacity:` declaration (strategy A). That is not */
|
|
132
|
+
/* redundancy: a scoped component rule is (0,2,0) and beats */
|
|
133
|
+
/* this (0,1,0) class whatever the load order, and OrigamBtn */
|
|
134
|
+
/* already declares `opacity` in its own SCSS. See #514. */
|
|
135
|
+
.origam--opacity-0 { opacity: var(--origam-opacity---0); }
|
|
136
|
+
.origam--opacity-12 { opacity: var(--origam-opacity---12); }
|
|
137
|
+
.origam--opacity-26 { opacity: var(--origam-opacity---26); }
|
|
138
|
+
.origam--opacity-32 { opacity: var(--origam-opacity---32); }
|
|
139
|
+
.origam--opacity-50 { opacity: var(--origam-opacity---50); }
|
|
140
|
+
.origam--opacity-60 { opacity: var(--origam-opacity---60); }
|
|
141
|
+
.origam--opacity-70 { opacity: var(--origam-opacity---70); }
|
|
142
|
+
.origam--opacity-87 { opacity: var(--origam-opacity---87); }
|
|
143
|
+
.origam--opacity-100 { opacity: var(--origam-opacity---100); }
|
|
144
|
+
|
|
145
|
+
/* --- Backdrop blur --------------------------------------- */
|
|
146
|
+
/* */
|
|
147
|
+
/* Emitted by `useBackdrop`. The -webkit- twin is required: */
|
|
148
|
+
/* Safari still ships backdrop-filter prefixed only. Rung */
|
|
149
|
+
/* values follow the measured distribution of blur() literals */
|
|
150
|
+
/* in this repo, not a tidy doubling, hence sm = 6px. */
|
|
151
|
+
.origam--backdrop-blur-xs { backdrop-filter: blur(var(--origam-blur---xs)); -webkit-backdrop-filter: blur(var(--origam-blur---xs)); }
|
|
152
|
+
.origam--backdrop-blur-sm { backdrop-filter: blur(var(--origam-blur---sm)); -webkit-backdrop-filter: blur(var(--origam-blur---sm)); }
|
|
153
|
+
.origam--backdrop-blur-md { backdrop-filter: blur(var(--origam-blur---md)); -webkit-backdrop-filter: blur(var(--origam-blur---md)); }
|
|
154
|
+
.origam--backdrop-blur-lg { backdrop-filter: blur(var(--origam-blur---lg)); -webkit-backdrop-filter: blur(var(--origam-blur---lg)); }
|
|
155
|
+
.origam--backdrop-blur-xl { backdrop-filter: blur(var(--origam-blur---xl)); -webkit-backdrop-filter: blur(var(--origam-blur---xl)); }
|
|
@@ -162,6 +162,11 @@
|
|
|
162
162
|
--origam-opacity---70: 0.7;
|
|
163
163
|
--origam-opacity---87: 0.87;
|
|
164
164
|
--origam-opacity---100: 1;
|
|
165
|
+
--origam-blur---xs: 4px;
|
|
166
|
+
--origam-blur---sm: 6px;
|
|
167
|
+
--origam-blur---md: 8px;
|
|
168
|
+
--origam-blur---lg: 16px;
|
|
169
|
+
--origam-blur---xl: 24px;
|
|
165
170
|
--origam-border__width---0: 0px;
|
|
166
171
|
--origam-border__width---2: 2px;
|
|
167
172
|
--origam-border__width---4: 4px;
|
|
@@ -113,7 +113,8 @@ const props = defineProps({
|
|
|
113
113
|
fontSize: { type: null, required: false },
|
|
114
114
|
fontWeight: { type: null, required: false },
|
|
115
115
|
lineHeight: { type: null, required: false },
|
|
116
|
-
letterSpacing: { type: null, required: false }
|
|
116
|
+
letterSpacing: { type: null, required: false },
|
|
117
|
+
fontStyle: { type: String, required: false }
|
|
117
118
|
});
|
|
118
119
|
defineEmits([]);
|
|
119
120
|
defineSlots();
|
|
@@ -33,7 +33,8 @@ const props = defineProps({
|
|
|
33
33
|
fontSize: { type: null, required: false },
|
|
34
34
|
fontWeight: { type: null, required: false },
|
|
35
35
|
lineHeight: { type: null, required: false },
|
|
36
|
-
letterSpacing: { type: null, required: false }
|
|
36
|
+
letterSpacing: { type: null, required: false },
|
|
37
|
+
fontStyle: { type: String, required: false }
|
|
37
38
|
});
|
|
38
39
|
defineEmits([]);
|
|
39
40
|
defineSlots();
|
|
@@ -66,7 +66,8 @@ const props = defineProps({
|
|
|
66
66
|
fontSize: { type: null, required: false },
|
|
67
67
|
fontWeight: { type: null, required: false },
|
|
68
68
|
lineHeight: { type: null, required: false },
|
|
69
|
-
letterSpacing: { type: null, required: false }
|
|
69
|
+
letterSpacing: { type: null, required: false },
|
|
70
|
+
fontStyle: { type: String, required: false }
|
|
70
71
|
});
|
|
71
72
|
const { filterProps } = useProps(props);
|
|
72
73
|
defineEmits([]);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBackdrop = useBackdrop;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _backdrop = require("../../consts/Commons/backdrop.const.cjs");
|
|
9
|
+
function resolveBackdropBlur(value) {
|
|
10
|
+
if (value == null || value === false || value === "") return null;
|
|
11
|
+
if (value === true) {
|
|
12
|
+
return {
|
|
13
|
+
rung: _backdrop.BACKDROP_BLUR_DEFAULT_RUNG,
|
|
14
|
+
length: _backdrop.BACKDROP_BLUR_RUNG_VARS[_backdrop.BACKDROP_BLUR_DEFAULT_RUNG]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === "number") return {
|
|
18
|
+
rung: null,
|
|
19
|
+
length: `${value}px`
|
|
20
|
+
};
|
|
21
|
+
const key = String(value).trim();
|
|
22
|
+
const rungVar = _backdrop.BACKDROP_BLUR_RUNG_VARS[key];
|
|
23
|
+
if (rungVar) return {
|
|
24
|
+
rung: key,
|
|
25
|
+
length: rungVar
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
rung: null,
|
|
29
|
+
length: key
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function useBackdrop(props) {
|
|
33
|
+
const resolved = (0, _vue.computed)(() => {
|
|
34
|
+
return resolveBackdropBlur((0, _vue.isRef)(props) ? props.value : props.backdropBlur);
|
|
35
|
+
});
|
|
36
|
+
const backdropClasses = (0, _vue.computed)(() => {
|
|
37
|
+
const rung = resolved.value?.rung;
|
|
38
|
+
return rung ? [`${_backdrop.BACKDROP_UTILITY_CLASS_PREFIX}${rung}`] : [];
|
|
39
|
+
});
|
|
40
|
+
const backdropStyles = (0, _vue.computed)(() => {
|
|
41
|
+
const current = resolved.value;
|
|
42
|
+
if (!current) return [];
|
|
43
|
+
const filter = `blur(${current.length})`;
|
|
44
|
+
return [`backdrop-filter: ${filter}`, `-webkit-backdrop-filter: ${filter}`];
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
backdropClasses,
|
|
48
|
+
backdropStyles
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import type { IBackdropProps } from '../../interfaces/Commons/backdrop.interface';
|
|
3
|
+
import { TBackdropBlur } from '../../types/Commons/backdrop.type';
|
|
4
|
+
/*********************************************************
|
|
5
|
+
* useBackdrop
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* Translates the `backdropBlur` prop into `backdropClasses` (the global
|
|
9
|
+
* utility class, when the value lands on a token rung) AND
|
|
10
|
+
* `backdropStyles` (always a `backdrop-filter` pair). Both channels are
|
|
11
|
+
* emitted in PARALLEL — strategy A, same contract as `useElevation`.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* The `-webkit-` prefixed twin is emitted alongside the standard property
|
|
15
|
+
* on every path: Safari still ships `backdrop-filter` prefixed only, and
|
|
16
|
+
* every one of the 12 components already painting glass in this DS writes
|
|
17
|
+
* the pair. Dropping it would make the prop a no-op on Safari while
|
|
18
|
+
* looking correct everywhere the author tests.
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* No `@supports` gate, and that is not an oversight. An unsupported
|
|
22
|
+
* browser drops an unknown declaration by itself, so the gate would buy
|
|
23
|
+
* nothing here — and an inline style cannot carry one anyway. The
|
|
24
|
+
* `@supports not (backdrop-filter: ...)` blocks that exist in the DS
|
|
25
|
+
* today thicken the BACKGROUND COLOUR when blur is unavailable, which is
|
|
26
|
+
* a `bgColor` decision belonging to whoever writes the preset, not to
|
|
27
|
+
* this composable.
|
|
28
|
+
********************************************************/
|
|
29
|
+
export declare function useBackdrop(props: IBackdropProps | Ref<TBackdropBlur | undefined>): {
|
|
30
|
+
backdropClasses: import("vue").ComputedRef<string[]>;
|
|
31
|
+
backdropStyles: import("vue").ComputedRef<string[]>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { computed, isRef } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
BACKDROP_BLUR_DEFAULT_RUNG,
|
|
4
|
+
BACKDROP_BLUR_RUNG_VARS,
|
|
5
|
+
BACKDROP_UTILITY_CLASS_PREFIX
|
|
6
|
+
} from "../../consts/Commons/backdrop.const.js";
|
|
7
|
+
function resolveBackdropBlur(value) {
|
|
8
|
+
if (value == null || value === false || value === "") return null;
|
|
9
|
+
if (value === true) {
|
|
10
|
+
return { rung: BACKDROP_BLUR_DEFAULT_RUNG, length: BACKDROP_BLUR_RUNG_VARS[BACKDROP_BLUR_DEFAULT_RUNG] };
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === "number") return { rung: null, length: `${value}px` };
|
|
13
|
+
const key = String(value).trim();
|
|
14
|
+
const rungVar = BACKDROP_BLUR_RUNG_VARS[key];
|
|
15
|
+
if (rungVar) return { rung: key, length: rungVar };
|
|
16
|
+
return { rung: null, length: key };
|
|
17
|
+
}
|
|
18
|
+
export function useBackdrop(props) {
|
|
19
|
+
const resolved = computed(() => {
|
|
20
|
+
return resolveBackdropBlur(isRef(props) ? props.value : props.backdropBlur);
|
|
21
|
+
});
|
|
22
|
+
const backdropClasses = computed(() => {
|
|
23
|
+
const rung = resolved.value?.rung;
|
|
24
|
+
return rung ? [`${BACKDROP_UTILITY_CLASS_PREFIX}${rung}`] : [];
|
|
25
|
+
});
|
|
26
|
+
const backdropStyles = computed(() => {
|
|
27
|
+
const current = resolved.value;
|
|
28
|
+
if (!current) return [];
|
|
29
|
+
const filter = `blur(${current.length})`;
|
|
30
|
+
return [`backdrop-filter: ${filter}`, `-webkit-backdrop-filter: ${filter}`];
|
|
31
|
+
});
|
|
32
|
+
return { backdropClasses, backdropStyles };
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useOpacity = useOpacity;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _opacity = require("../../consts/Commons/opacity.const.cjs");
|
|
9
|
+
function resolveNumericOpacity(value) {
|
|
10
|
+
if (value <= _opacity.OPACITY_FRACTION_CEILING) return {
|
|
11
|
+
rung: null,
|
|
12
|
+
css: String(value)
|
|
13
|
+
};
|
|
14
|
+
const rung = String(value);
|
|
15
|
+
const rungVar = _opacity.OPACITY_RUNG_VARS[rung];
|
|
16
|
+
if (rungVar) return {
|
|
17
|
+
rung,
|
|
18
|
+
css: rungVar
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
rung: null,
|
|
22
|
+
css: String(value / _opacity.OPACITY_PERCENT_SCALE)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function resolveOpacity(value) {
|
|
26
|
+
if (value == null || value === "") return null;
|
|
27
|
+
const numeric = typeof value === "number" ? value : Number(String(value).trim());
|
|
28
|
+
if (Number.isFinite(numeric)) return resolveNumericOpacity(numeric);
|
|
29
|
+
return {
|
|
30
|
+
rung: null,
|
|
31
|
+
css: String(value).trim()
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function useOpacity(props) {
|
|
35
|
+
const resolved = (0, _vue.computed)(() => {
|
|
36
|
+
return resolveOpacity((0, _vue.isRef)(props) ? props.value : props.opacity);
|
|
37
|
+
});
|
|
38
|
+
const opacityClasses = (0, _vue.computed)(() => {
|
|
39
|
+
const rung = resolved.value?.rung;
|
|
40
|
+
return rung ? [`${_opacity.OPACITY_UTILITY_CLASS_PREFIX}${rung}`] : [];
|
|
41
|
+
});
|
|
42
|
+
const opacityStyles = (0, _vue.computed)(() => {
|
|
43
|
+
const current = resolved.value;
|
|
44
|
+
return current ? [`opacity: ${current.css}`] : [];
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
opacityClasses,
|
|
48
|
+
opacityStyles
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import type { IOpacityProps } from '../../interfaces/Commons/opacity.interface';
|
|
3
|
+
import { TOpacity } from '../../types/Commons/opacity.type';
|
|
4
|
+
/*********************************************************
|
|
5
|
+
* useOpacity
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* Translates the `opacity` prop into `opacityClasses` (the global utility
|
|
9
|
+
* class, when the value lands on a token rung) AND `opacityStyles`
|
|
10
|
+
* (always an `opacity:` declaration). Both channels are emitted in
|
|
11
|
+
* PARALLEL, never one instead of the other — strategy A, the same
|
|
12
|
+
* contract `useElevation` and `useRounded` honour.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* ⛔ THE STYLE IS NOT REDUNDANT WITH THE CLASS, and dropping it would
|
|
16
|
+
* break the prop on most components. A utility class is `(0,1,0)`; a Vue
|
|
17
|
+
* scoped component rule is `.class[data-v-hash]` = `(0,2,0)` and wins
|
|
18
|
+
* regardless of load order. `OrigamBtn` already declares `opacity` in its
|
|
19
|
+
* own scoped SCSS (`--variant-plain`, `--disabled`), so on Btn the class
|
|
20
|
+
* alone would paint nothing. This is the measured lesson of #514 on the
|
|
21
|
+
* foreground channel, applied here before it can be re-learned.
|
|
22
|
+
*
|
|
23
|
+
* @description
|
|
24
|
+
* REUSES the primitive ladder that already existed
|
|
25
|
+
* (`--origam-opacity---{0,12,26,32,50,60,70,87,100}`, `primitive.css`);
|
|
26
|
+
* this composable declares no token of its own. See
|
|
27
|
+
* {@link IOpacityProps} for why ADR-005's "add a token group" was already
|
|
28
|
+
* half-done.
|
|
29
|
+
********************************************************/
|
|
30
|
+
export declare function useOpacity(props: IOpacityProps | Ref<TOpacity | undefined>): {
|
|
31
|
+
opacityClasses: import("vue").ComputedRef<string[]>;
|
|
32
|
+
opacityStyles: import("vue").ComputedRef<string[]>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { computed, isRef } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
OPACITY_FRACTION_CEILING,
|
|
4
|
+
OPACITY_PERCENT_SCALE,
|
|
5
|
+
OPACITY_RUNG_VARS,
|
|
6
|
+
OPACITY_UTILITY_CLASS_PREFIX
|
|
7
|
+
} from "../../consts/Commons/opacity.const.js";
|
|
8
|
+
function resolveNumericOpacity(value) {
|
|
9
|
+
if (value <= OPACITY_FRACTION_CEILING) return { rung: null, css: String(value) };
|
|
10
|
+
const rung = String(value);
|
|
11
|
+
const rungVar = OPACITY_RUNG_VARS[rung];
|
|
12
|
+
if (rungVar) return { rung, css: rungVar };
|
|
13
|
+
return { rung: null, css: String(value / OPACITY_PERCENT_SCALE) };
|
|
14
|
+
}
|
|
15
|
+
function resolveOpacity(value) {
|
|
16
|
+
if (value == null || value === "") return null;
|
|
17
|
+
const numeric = typeof value === "number" ? value : Number(String(value).trim());
|
|
18
|
+
if (Number.isFinite(numeric)) return resolveNumericOpacity(numeric);
|
|
19
|
+
return { rung: null, css: String(value).trim() };
|
|
20
|
+
}
|
|
21
|
+
export function useOpacity(props) {
|
|
22
|
+
const resolved = computed(() => {
|
|
23
|
+
return resolveOpacity(isRef(props) ? props.value : props.opacity);
|
|
24
|
+
});
|
|
25
|
+
const opacityClasses = computed(() => {
|
|
26
|
+
const rung = resolved.value?.rung;
|
|
27
|
+
return rung ? [`${OPACITY_UTILITY_CLASS_PREFIX}${rung}`] : [];
|
|
28
|
+
});
|
|
29
|
+
const opacityStyles = computed(() => {
|
|
30
|
+
const current = resolved.value;
|
|
31
|
+
return current ? [`opacity: ${current.css}`] : [];
|
|
32
|
+
});
|
|
33
|
+
return { opacityClasses, opacityStyles };
|
|
34
|
+
}
|
|
@@ -8,6 +8,7 @@ var _vue = require("vue");
|
|
|
8
8
|
var _border = require("./border.composable.cjs");
|
|
9
9
|
var _elevation = require("./elevation.composable.cjs");
|
|
10
10
|
var _margin = require("./margin.composable.cjs");
|
|
11
|
+
var _opacity = require("./opacity.composable.cjs");
|
|
11
12
|
var _padding = require("./padding.composable.cjs");
|
|
12
13
|
var _rounded = require("./rounded.composable.cjs");
|
|
13
14
|
var _color = require("../../utils/Commons/color.util.cjs");
|
|
@@ -44,6 +45,8 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
|
|
|
44
45
|
const padding = pickEffective(() => props.padding, isHover, isActive, hoverState, activeState, "padding");
|
|
45
46
|
const margin = pickEffective(() => props.margin, isHover, isActive, hoverState, activeState, "margin");
|
|
46
47
|
const gap = pickEffective(() => props.gap, isHover, isActive, hoverState, activeState, "gap");
|
|
48
|
+
const opacity = pickEffective(() => props.opacity, isHover, isActive, hoverState, activeState, "opacity");
|
|
49
|
+
const borderColor = pickEffective(() => props.borderColor, isHover, isActive, hoverState, activeState, "borderColor");
|
|
47
50
|
const sameIntent = (a, b) => {
|
|
48
51
|
return !!a && !!b && a === b && (0, _color.isIntent)(a);
|
|
49
52
|
};
|
|
@@ -105,7 +108,7 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
|
|
|
105
108
|
return border.value;
|
|
106
109
|
},
|
|
107
110
|
get borderColor() {
|
|
108
|
-
return
|
|
111
|
+
return borderColor.value;
|
|
109
112
|
},
|
|
110
113
|
get borderStyle() {
|
|
111
114
|
return props.borderStyle;
|
|
@@ -225,6 +228,14 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
|
|
|
225
228
|
return [`gap: ${v}`];
|
|
226
229
|
});
|
|
227
230
|
const gapClasses = (0, _vue.computed)(() => []);
|
|
231
|
+
const {
|
|
232
|
+
opacityClasses,
|
|
233
|
+
opacityStyles
|
|
234
|
+
} = (0, _opacity.useOpacity)((0, _vue.reactive)({
|
|
235
|
+
get opacity() {
|
|
236
|
+
return opacity.value;
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
228
239
|
return {
|
|
229
240
|
// Resolved scalar refs (so consumers can read the effective value)
|
|
230
241
|
color,
|
|
@@ -235,6 +246,8 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
|
|
|
235
246
|
padding,
|
|
236
247
|
margin,
|
|
237
248
|
gap,
|
|
249
|
+
opacity,
|
|
250
|
+
borderColor,
|
|
238
251
|
// Per-axis classes + styles (state-aware)
|
|
239
252
|
colorClasses,
|
|
240
253
|
colorStyles,
|
|
@@ -249,6 +262,8 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
|
|
|
249
262
|
marginClasses,
|
|
250
263
|
marginStyles,
|
|
251
264
|
gapClasses,
|
|
252
|
-
gapStyles
|
|
265
|
+
gapStyles,
|
|
266
|
+
opacityClasses,
|
|
267
|
+
opacityStyles
|
|
253
268
|
};
|
|
254
269
|
}
|
|
@@ -10,8 +10,9 @@ import type { TStateEffectProps } from '../../types/Commons/state-effect.type';
|
|
|
10
10
|
* `useBorder` + `useRounded` + `useElevation` + `usePadding` + `useMargin`
|
|
11
11
|
* que chaque composant visuel devait repeter. Lit les etats `isHover`/
|
|
12
12
|
* `isActive`/`isDisabled` (et leurs overrides `hoverState`/`activeState`)
|
|
13
|
-
* et resout
|
|
14
|
-
* elevation, padding, margin, gap — chacun avec
|
|
13
|
+
* et resout 10 axes state-aware : color, bgColor, border, borderColor,
|
|
14
|
+
* rounded, elevation, padding, margin, gap, opacity — chacun avec
|
|
15
|
+
* classes ET styles.
|
|
15
16
|
* Priorite de resolution par axe : HOVER gagne sur ACTIVE (survoler un
|
|
16
17
|
* element presse/selectionne montre la surface hover), qui gagne sur la
|
|
17
18
|
* valeur de repos (`props.xxx`).
|
|
@@ -43,6 +44,8 @@ flat?: Ref<boolean> | ComputedRef<boolean>): {
|
|
|
43
44
|
padding: ComputedRef<string | number | boolean | undefined>;
|
|
44
45
|
margin: ComputedRef<string | number | boolean | undefined>;
|
|
45
46
|
gap: ComputedRef<string | number | boolean | undefined>;
|
|
47
|
+
opacity: ComputedRef<string | number | undefined>;
|
|
48
|
+
borderColor: ComputedRef<string | undefined>;
|
|
46
49
|
colorClasses: ComputedRef<string[]>;
|
|
47
50
|
colorStyles: ComputedRef<string[]>;
|
|
48
51
|
borderClasses: ComputedRef<string[]>;
|
|
@@ -57,4 +60,6 @@ flat?: Ref<boolean> | ComputedRef<boolean>): {
|
|
|
57
60
|
marginStyles: ComputedRef<string[]>;
|
|
58
61
|
gapClasses: ComputedRef<string[]>;
|
|
59
62
|
gapStyles: ComputedRef<string[]>;
|
|
63
|
+
opacityClasses: ComputedRef<string[]>;
|
|
64
|
+
opacityStyles: ComputedRef<string[]>;
|
|
60
65
|
};
|
|
@@ -2,6 +2,7 @@ import { computed, reactive } from "vue";
|
|
|
2
2
|
import { useBorder } from "./border.composable.js";
|
|
3
3
|
import { useElevation } from "./elevation.composable.js";
|
|
4
4
|
import { useMargin } from "./margin.composable.js";
|
|
5
|
+
import { useOpacity } from "./opacity.composable.js";
|
|
5
6
|
import { usePadding } from "./padding.composable.js";
|
|
6
7
|
import { useRounded } from "./rounded.composable.js";
|
|
7
8
|
import { getForeground, intentBgExpr, isCssColor, isIntent, isParsableColor, isUtilityIntent, parseColor, rawBgExprWithState, tokenForegroundForIntent, tokenStylesForIntent, warnLegacyColor } from "../../utils/Commons/color.util.js";
|
|
@@ -45,6 +46,15 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
|
|
|
45
46
|
activeState,
|
|
46
47
|
"gap"
|
|
47
48
|
);
|
|
49
|
+
const opacity = pickEffective(() => props.opacity, isHover, isActive, hoverState, activeState, "opacity");
|
|
50
|
+
const borderColor = pickEffective(
|
|
51
|
+
() => props.borderColor,
|
|
52
|
+
isHover,
|
|
53
|
+
isActive,
|
|
54
|
+
hoverState,
|
|
55
|
+
activeState,
|
|
56
|
+
"borderColor"
|
|
57
|
+
);
|
|
48
58
|
const sameIntent = (a, b) => {
|
|
49
59
|
return !!a && !!b && a === b && isIntent(a);
|
|
50
60
|
};
|
|
@@ -104,7 +114,7 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
|
|
|
104
114
|
return border.value;
|
|
105
115
|
},
|
|
106
116
|
get borderColor() {
|
|
107
|
-
return
|
|
117
|
+
return borderColor.value;
|
|
108
118
|
},
|
|
109
119
|
get borderStyle() {
|
|
110
120
|
return props.borderStyle;
|
|
@@ -222,6 +232,13 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
|
|
|
222
232
|
return [`gap: ${v}`];
|
|
223
233
|
});
|
|
224
234
|
const gapClasses = computed(() => []);
|
|
235
|
+
const { opacityClasses, opacityStyles } = useOpacity(
|
|
236
|
+
reactive({
|
|
237
|
+
get opacity() {
|
|
238
|
+
return opacity.value;
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
);
|
|
225
242
|
return {
|
|
226
243
|
// Resolved scalar refs (so consumers can read the effective value)
|
|
227
244
|
color,
|
|
@@ -232,6 +249,8 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
|
|
|
232
249
|
padding,
|
|
233
250
|
margin,
|
|
234
251
|
gap,
|
|
252
|
+
opacity,
|
|
253
|
+
borderColor,
|
|
235
254
|
// Per-axis classes + styles (state-aware)
|
|
236
255
|
colorClasses,
|
|
237
256
|
colorStyles,
|
|
@@ -246,6 +265,8 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
|
|
|
246
265
|
marginClasses,
|
|
247
266
|
marginStyles,
|
|
248
267
|
gapClasses,
|
|
249
|
-
gapStyles
|
|
268
|
+
gapStyles,
|
|
269
|
+
opacityClasses,
|
|
270
|
+
opacityStyles
|
|
250
271
|
};
|
|
251
272
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useTypography = useTypography;
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
const TYPOGRAPHY_TOKEN_MAP = [["fontFamily", "font-family", "font__family"], ["fontSize", "font-size", "font__size"], ["fontWeight", "font-weight", "font__weight"], ["lineHeight", "line-height", "font__lineHeight"], ["letterSpacing", "letter-spacing", "font__letterSpacing"]];
|
|
9
|
+
const TYPOGRAPHY_PASSTHROUGH_MAP = [["fontStyle", "font-style"]];
|
|
9
10
|
function useTypography(props, varPrefix) {
|
|
10
11
|
const typographyStyles = (0, _vue.computed)(() => {
|
|
11
12
|
const styles = {};
|
|
@@ -15,6 +16,12 @@ function useTypography(props, varPrefix) {
|
|
|
15
16
|
styles[`--origam-${varPrefix}---${cssProp}`] = `var(--origam-${tokenGroup}---${value})`;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
for (const [propKey, cssProp] of TYPOGRAPHY_PASSTHROUGH_MAP) {
|
|
20
|
+
const value = props[propKey];
|
|
21
|
+
if (value) {
|
|
22
|
+
styles[`--origam-${varPrefix}---${cssProp}`] = String(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
return Object.keys(styles).length ? styles : null;
|
|
19
26
|
});
|
|
20
27
|
return {
|
|
@@ -4,13 +4,18 @@ import type { ITypographyProps } from '../../interfaces/Commons/typography.inter
|
|
|
4
4
|
*
|
|
5
5
|
* @description
|
|
6
6
|
* Volet typographique de `useMargin`/`useBorder`/`useColor` : pour
|
|
7
|
-
* chacune des cinq `ITypographyProps` (`fontFamily`, `fontSize`,
|
|
7
|
+
* chacune des cinq `ITypographyProps` de TOKEN (`fontFamily`, `fontSize`,
|
|
8
8
|
* `fontWeight`, `lineHeight`, `letterSpacing`) que le consommateur a
|
|
9
9
|
* fixee, emet une custom property inline `--origam-{varPrefix}---{prop}`
|
|
10
10
|
* qui repointe vers le token primitif correspondant. Une prop non fixee
|
|
11
11
|
* n'emet rien — le theme/la variante du composant garde la main.
|
|
12
12
|
*
|
|
13
13
|
* @description
|
|
14
|
+
* La sixieme, `fontStyle`, passe par un canal PASSTHROUGH : sa valeur est
|
|
15
|
+
* un mot-cle CSS rendu verbatim, sans enveloppe `var()`. Voir
|
|
16
|
+
* `TYPOGRAPHY_PASSTHROUGH_MAP` pour le pourquoi.
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
14
19
|
* INLINE UNIQUEMENT (pas de classe utilitaire — `origam-utilities.css`
|
|
15
20
|
* n'a pas de famille `.origam--font-*`), et `typographyStyles` est un
|
|
16
21
|
* objet PLAT `{ '--var': valeur }` (jamais un tableau) : `useStyle()`
|
|
@@ -6,6 +6,9 @@ const TYPOGRAPHY_TOKEN_MAP = [
|
|
|
6
6
|
["lineHeight", "line-height", "font__lineHeight"],
|
|
7
7
|
["letterSpacing", "letter-spacing", "font__letterSpacing"]
|
|
8
8
|
];
|
|
9
|
+
const TYPOGRAPHY_PASSTHROUGH_MAP = [
|
|
10
|
+
["fontStyle", "font-style"]
|
|
11
|
+
];
|
|
9
12
|
export function useTypography(props, varPrefix) {
|
|
10
13
|
const typographyStyles = computed(() => {
|
|
11
14
|
const styles = {};
|
|
@@ -15,6 +18,12 @@ export function useTypography(props, varPrefix) {
|
|
|
15
18
|
styles[`--origam-${varPrefix}---${cssProp}`] = `var(--origam-${tokenGroup}---${value})`;
|
|
16
19
|
}
|
|
17
20
|
}
|
|
21
|
+
for (const [propKey, cssProp] of TYPOGRAPHY_PASSTHROUGH_MAP) {
|
|
22
|
+
const value = props[propKey];
|
|
23
|
+
if (value) {
|
|
24
|
+
styles[`--origam-${varPrefix}---${cssProp}`] = String(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
18
27
|
return Object.keys(styles).length ? styles : null;
|
|
19
28
|
});
|
|
20
29
|
return { typographyStyles };
|
|
@@ -168,6 +168,18 @@ Object.keys(_dimension).forEach(function (key) {
|
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
|
+
var _backdrop = require("./Commons/backdrop.composable.cjs");
|
|
172
|
+
Object.keys(_backdrop).forEach(function (key) {
|
|
173
|
+
if (key === "default" || key === "__esModule") return;
|
|
174
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
175
|
+
if (key in exports && exports[key] === _backdrop[key]) return;
|
|
176
|
+
Object.defineProperty(exports, key, {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function () {
|
|
179
|
+
return _backdrop[key];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
171
183
|
var _elevation = require("./Commons/elevation.composable.cjs");
|
|
172
184
|
Object.keys(_elevation).forEach(function (key) {
|
|
173
185
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -180,6 +192,18 @@ Object.keys(_elevation).forEach(function (key) {
|
|
|
180
192
|
}
|
|
181
193
|
});
|
|
182
194
|
});
|
|
195
|
+
var _opacity = require("./Commons/opacity.composable.cjs");
|
|
196
|
+
Object.keys(_opacity).forEach(function (key) {
|
|
197
|
+
if (key === "default" || key === "__esModule") return;
|
|
198
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
199
|
+
if (key in exports && exports[key] === _opacity[key]) return;
|
|
200
|
+
Object.defineProperty(exports, key, {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
get: function () {
|
|
203
|
+
return _opacity[key];
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
183
207
|
var _group = require("./Commons/group.composable.cjs");
|
|
184
208
|
Object.keys(_group).forEach(function (key) {
|
|
185
209
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -11,7 +11,9 @@ export * from './Commons/date-picker-calendar.composable';
|
|
|
11
11
|
export * from './Commons/date.composable';
|
|
12
12
|
export * from './Commons/density.composable';
|
|
13
13
|
export * from './Commons/dimension.composable';
|
|
14
|
+
export * from './Commons/backdrop.composable';
|
|
14
15
|
export * from './Commons/elevation.composable';
|
|
16
|
+
export * from './Commons/opacity.composable';
|
|
15
17
|
export * from './Commons/group.composable';
|
|
16
18
|
export * from './Commons/groupItem.composable';
|
|
17
19
|
export * from './Commons/groupSiblingLink.composable';
|
|
@@ -11,7 +11,9 @@ export * from "./Commons/date-picker-calendar.composable.js";
|
|
|
11
11
|
export * from "./Commons/date.composable.js";
|
|
12
12
|
export * from "./Commons/density.composable.js";
|
|
13
13
|
export * from "./Commons/dimension.composable.js";
|
|
14
|
+
export * from "./Commons/backdrop.composable.js";
|
|
14
15
|
export * from "./Commons/elevation.composable.js";
|
|
16
|
+
export * from "./Commons/opacity.composable.js";
|
|
15
17
|
export * from "./Commons/group.composable.js";
|
|
16
18
|
export * from "./Commons/groupItem.composable.js";
|
|
17
19
|
export * from "./Commons/groupSiblingLink.composable.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BACKDROP_UTILITY_CLASS_PREFIX = exports.BACKDROP_BLUR_RUNG_VARS = exports.BACKDROP_BLUR_DEFAULT_RUNG = void 0;
|
|
7
|
+
const BACKDROP_BLUR_RUNG_VARS = exports.BACKDROP_BLUR_RUNG_VARS = {
|
|
8
|
+
xs: "var(--origam-blur---xs, 4px)",
|
|
9
|
+
sm: "var(--origam-blur---sm, 6px)",
|
|
10
|
+
md: "var(--origam-blur---md, 8px)",
|
|
11
|
+
lg: "var(--origam-blur---lg, 16px)",
|
|
12
|
+
xl: "var(--origam-blur---xl, 24px)"
|
|
13
|
+
};
|
|
14
|
+
const BACKDROP_BLUR_DEFAULT_RUNG = exports.BACKDROP_BLUR_DEFAULT_RUNG = "md";
|
|
15
|
+
const BACKDROP_UTILITY_CLASS_PREFIX = exports.BACKDROP_UTILITY_CLASS_PREFIX = "origam--backdrop-blur-";
|