origam 2.7.3 → 2.8.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/dist/src/components/Alert/OrigamAlert.vue +4 -0
- package/dist/src/components/App/OrigamAppBar.vue +4 -0
- package/dist/src/components/Audio/OrigamAudio.vue +4 -0
- package/dist/src/components/Avatar/OrigamAvatar.vue +4 -0
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +4 -0
- package/dist/src/components/Badge/OrigamBadge.vue +4 -0
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +18 -5
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +4 -0
- package/dist/src/components/Bracket/OrigamBracket.vue +4 -0
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +4 -0
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +4 -0
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +4 -0
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +4 -0
- package/dist/src/components/Btn/OrigamBtn.vue +4 -0
- package/dist/src/components/Btn/OrigamBtnGroup.vue +4 -0
- package/dist/src/components/Btn/OrigamBtnToggle.vue +4 -0
- package/dist/src/components/Calendar/OrigamCalendar.vue +4 -0
- package/dist/src/components/Card/OrigamCard.vue +4 -0
- package/dist/src/components/Card/OrigamCardHeader.vue +4 -0
- package/dist/src/components/Card/OrigamCardText.vue +4 -0
- package/dist/src/components/Carousel/OrigamCarousel.vue +4 -0
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +4 -0
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +4 -0
- package/dist/src/components/Chip/OrigamChip.vue +4 -0
- package/dist/src/components/Chip/OrigamChipGroup.vue +4 -0
- package/dist/src/components/Clipboard/OrigamClipboard.vue +4 -0
- package/dist/src/components/Code/OrigamCode.vue +4 -0
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +4 -0
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +4 -0
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +4 -0
- package/dist/src/components/Counter/OrigamCounter.vue +4 -0
- package/dist/src/components/DataList/OrigamDataList.vue +4 -0
- package/dist/src/components/DataTable/OrigamDataTable.vue +4 -0
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +4 -0
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +4 -0
- package/dist/src/components/Dialog/OrigamDialog.vue +4 -0
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +4 -0
- package/dist/src/components/Drawer/OrigamDrawer.vue +4 -0
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +4 -0
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +4 -0
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +4 -0
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +4 -0
- package/dist/src/components/Field/OrigamField.vue +4 -0
- package/dist/src/components/FileField/OrigamFileField.vue +4 -0
- package/dist/src/components/Grid/OrigamGrid.vue +5 -1
- package/dist/src/components/Grids/OrigamCol.vue +4 -0
- package/dist/src/components/Grids/OrigamContainer.vue +5 -1
- package/dist/src/components/Grids/OrigamRow.vue +4 -0
- package/dist/src/components/Icon/OrigamClassIcon.vue +4 -0
- package/dist/src/components/Icon/OrigamComponentIcon.vue +4 -0
- package/dist/src/components/Icon/OrigamIcon.vue +4 -0
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +4 -0
- package/dist/src/components/Icon/OrigamSvgIcon.vue +4 -0
- package/dist/src/components/Img/OrigamImg.vue +4 -0
- package/dist/src/components/Input/OrigamInput.vue +4 -0
- package/dist/src/components/Kbd/OrigamKbd.vue +4 -0
- package/dist/src/components/Label/OrigamLabel.vue +4 -0
- package/dist/src/components/Layout/OrigamLayout.vue +5 -1
- package/dist/src/components/List/OrigamList.vue +4 -0
- package/dist/src/components/List/OrigamListGroup.vue +4 -0
- package/dist/src/components/List/OrigamListItem.vue +4 -0
- package/dist/src/components/List/OrigamListSubheader.vue +4 -0
- package/dist/src/components/Main/OrigamMain.vue +4 -0
- package/dist/src/components/Masonry/OrigamMasonry.vue +5 -1
- package/dist/src/components/Menu/OrigamMenu.vue +4 -0
- package/dist/src/components/Messages/OrigamMessages.vue +4 -0
- package/dist/src/components/NumberField/OrigamNumberField.vue +4 -0
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +4 -0
- package/dist/src/components/Pagination/OrigamPagination.vue +4 -0
- package/dist/src/components/Parallax/OrigamParallax.vue +4 -0
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +4 -0
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +4 -0
- package/dist/src/components/Picker/OrigamPicker.vue +4 -0
- package/dist/src/components/QrCode/OrigamQrCode.vue +4 -0
- package/dist/src/components/Radio/OrigamRadio.vue +4 -0
- package/dist/src/components/Radio/OrigamRadioGroup.vue +4 -0
- package/dist/src/components/RatingField/OrigamRatingField.vue +4 -0
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +4 -0
- package/dist/src/components/Responsive/OrigamResponsive.vue +4 -0
- package/dist/src/components/Select/OrigamSelect.vue +4 -0
- package/dist/src/components/Sheet/OrigamSheet.vue +4 -0
- package/dist/src/components/Slide/OrigamSlideGroup.vue +4 -0
- package/dist/src/components/SliderField/OrigamSliderField.vue +4 -0
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +4 -0
- package/dist/src/components/Stepper/OrigamStepper.vue +5 -1
- package/dist/src/components/Switch/OrigamSwitch.vue +4 -0
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +4 -0
- package/dist/src/components/Table/OrigamTable.vue +4 -0
- package/dist/src/components/TextField/OrigamTextField.vue +4 -0
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +4 -0
- package/dist/src/components/Title/OrigamTitle.vue +4 -0
- package/dist/src/components/Toolbar/OrigamToolbar.vue +4 -0
- package/dist/src/components/Video/OrigamVideo.vue +4 -0
- package/dist/src/components/Window/OrigamWindow.vue +4 -0
- package/dist/src/composables/Commons/border.composable.cjs +22 -0
- package/dist/src/composables/Commons/border.composable.d.ts +19 -0
- package/dist/src/composables/Commons/border.composable.js +28 -2
- package/dist/src/composables/Commons/elevation.composable.cjs +5 -1
- package/dist/src/composables/Commons/elevation.composable.d.ts +14 -3
- package/dist/src/composables/Commons/elevation.composable.js +6 -2
- package/dist/src/composables/Commons/stateEffect.composable.cjs +24 -0
- package/dist/src/composables/Commons/stateEffect.composable.js +24 -0
- package/dist/src/consts/Commons/border.const.cjs +20 -2
- package/dist/src/consts/Commons/border.const.d.ts +29 -0
- package/dist/src/consts/Commons/border.const.js +7 -0
- package/dist/src/consts/Commons/elevation.const.cjs +3 -2
- package/dist/src/consts/Commons/elevation.const.d.ts +20 -0
- package/dist/src/consts/Commons/elevation.const.js +1 -0
- package/dist/src/interfaces/Blockquote/blockquote.interface.d.ts +15 -8
- package/dist/src/interfaces/Commons/border.interface.d.ts +20 -1
- package/dist/src/interfaces/Commons/color.interface.d.ts +24 -0
- package/dist/src/interfaces/Commons/elevation.interface.d.ts +2 -1
- package/dist/src/types/Commons/elevation.type.cjs +1 -0
- package/dist/src/types/Commons/elevation.type.d.ts +20 -0
- package/dist/src/types/Commons/elevation.type.js +0 -0
- package/dist/src/types/index.cjs +11 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/utils/Commons/border.util.cjs +36 -0
- package/dist/src/utils/Commons/border.util.d.ts +59 -0
- package/dist/src/utils/Commons/border.util.js +29 -0
- package/dist/src/utils/Commons/color.util.cjs +9 -0
- package/dist/src/utils/Commons/color.util.d.ts +7 -0
- package/dist/src/utils/Commons/color.util.js +10 -0
- package/dist/src/utils/Commons/elevation.util.cjs +5 -0
- package/dist/src/utils/Commons/elevation.util.d.ts +10 -0
- package/dist/src/utils/Commons/elevation.util.js +4 -0
- package/dist/src/utils/Commons/margin.util.cjs +4 -0
- package/dist/src/utils/Commons/margin.util.d.ts +23 -1
- package/dist/src/utils/Commons/margin.util.js +4 -0
- package/dist/src/utils/Commons/padding.util.d.ts +23 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TColor, TDirectionBoth } from '../../types';
|
|
1
2
|
/**
|
|
2
3
|
* Format border styles var.
|
|
3
4
|
*
|
|
@@ -5,3 +6,61 @@
|
|
|
5
6
|
* @param type …
|
|
6
7
|
*/
|
|
7
8
|
export declare function formatBorderStylesVar(values: Array<string>, type: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Parse a single per-side border value (`borderTop` / `borderRight` /
|
|
11
|
+
* `borderBottom` / `borderLeft`, issue #215) into width / style / color
|
|
12
|
+
* facets.
|
|
13
|
+
*
|
|
14
|
+
* Reuses `BORDER_REGEX` — the SAME grammar the global `border` shorthand
|
|
15
|
+
* parses in `useBorder` — so a value like `"2px dashed red"` resolves
|
|
16
|
+
* consistently with what `border="2px dashed red"` would produce. Unlike
|
|
17
|
+
* the global shorthand (which can distribute 1/2/4 values across several
|
|
18
|
+
* positions, see `formatBorderStylesVar`), a per-side value always
|
|
19
|
+
* describes exactly ONE side, so each facet resolves to a single token.
|
|
20
|
+
*
|
|
21
|
+
* Mirrors the global string-parsing defaults in `useBorder`: an omitted
|
|
22
|
+
* style defaults to `solid`, an omitted color defaults to `currentColor`
|
|
23
|
+
* (a bare width alone would otherwise paint nothing — `border-style`
|
|
24
|
+
* defaults to `none` per the CSS spec). Unlike the global path, an
|
|
25
|
+
* entirely unparsable / empty value returns `null` instead of emitting
|
|
26
|
+
* blank declarations — the caller skips emission rather than pushing
|
|
27
|
+
* `border-top-width: ` onto the style array.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseBorderPositionValue(value: string): {
|
|
30
|
+
width: string;
|
|
31
|
+
style: string;
|
|
32
|
+
color: string;
|
|
33
|
+
} | null;
|
|
34
|
+
/**
|
|
35
|
+
* Format the width/style/color facets resolved by `parseBorderPositionValue`
|
|
36
|
+
* into PHYSICAL per-side CSS declarations (`border-{position}-{type}`).
|
|
37
|
+
*
|
|
38
|
+
* Deliberately physical (not logical, unlike `formatBorderStylesVar`'s
|
|
39
|
+
* 2/4-value output for the global `border` shorthand) — `borderTop` /
|
|
40
|
+
* `borderRight` / `borderBottom` / `borderLeft` are already named
|
|
41
|
+
* physically on `IBorderProps`, so the emitted CSS property stays
|
|
42
|
+
* physical too: no logical/physical mismatch for the consumer to
|
|
43
|
+
* mentally translate.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatBorderPositionStylesVar(position: TDirectionBoth, facets: {
|
|
46
|
+
width?: string;
|
|
47
|
+
style?: string;
|
|
48
|
+
color?: string;
|
|
49
|
+
}): Array<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a {@link TColor} value (semantic intent | raw CSS color |
|
|
52
|
+
* gradient | falsy opt-out) into a single CSS color for a
|
|
53
|
+
* `border-{side}-color` declaration (issue #215's `borderTopColor` /
|
|
54
|
+
* `borderRightColor` / `borderBottomColor` / `borderLeftColor`).
|
|
55
|
+
*
|
|
56
|
+
* A border is a STROKE, not a filled surface — so an intent resolves via
|
|
57
|
+
* `tokenForegroundForIntent`, the SAME token family the `color` prop
|
|
58
|
+
* (foreground-only) uses, rather than a background token.
|
|
59
|
+
*
|
|
60
|
+
* Gradients are NOT supported: native CSS `border-color` has no gradient
|
|
61
|
+
* form (only `border-image` does, which is a different, unrelated CSS
|
|
62
|
+
* property and out of scope for this ticket). A gradient value is
|
|
63
|
+
* silently ignored — this is documented on `IBorderProps` so it's not a
|
|
64
|
+
* silent surprise.
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveBorderSideColor(value: TColor): string | null;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { BORDER_REGEX } from "../../consts/index.js";
|
|
2
|
+
import { isEmpty } from "./commons.util.js";
|
|
3
|
+
import { isCssColor, isIntent, tokenForegroundForIntent } from "./color.util.js";
|
|
4
|
+
import { isGradient } from "./gradient.util.js";
|
|
1
5
|
export function formatBorderStylesVar(values, type) {
|
|
2
6
|
const styles = [];
|
|
3
7
|
switch (values.length) {
|
|
@@ -17,3 +21,28 @@ export function formatBorderStylesVar(values, type) {
|
|
|
17
21
|
}
|
|
18
22
|
return styles;
|
|
19
23
|
}
|
|
24
|
+
export function parseBorderPositionValue(value) {
|
|
25
|
+
const match = BORDER_REGEX.exec(value)?.groups;
|
|
26
|
+
if (!match) return null;
|
|
27
|
+
const width = String(match.width ?? "").trim();
|
|
28
|
+
let style = String(match.style ?? "").trim();
|
|
29
|
+
let color = String(match.color ?? "").trim();
|
|
30
|
+
if (isEmpty(width) && isEmpty(style) && isEmpty(color)) return null;
|
|
31
|
+
if (isEmpty(style)) style = "solid";
|
|
32
|
+
if (isEmpty(color)) color = "currentColor";
|
|
33
|
+
return { width, style, color };
|
|
34
|
+
}
|
|
35
|
+
export function formatBorderPositionStylesVar(position, facets) {
|
|
36
|
+
const styles = [];
|
|
37
|
+
if (!isEmpty(facets.width)) styles.push(`border-${position}-width: ${facets.width}`);
|
|
38
|
+
if (!isEmpty(facets.style)) styles.push(`border-${position}-style: ${facets.style}`);
|
|
39
|
+
if (!isEmpty(facets.color)) styles.push(`border-${position}-color: ${facets.color}`);
|
|
40
|
+
return styles;
|
|
41
|
+
}
|
|
42
|
+
export function resolveBorderSideColor(value) {
|
|
43
|
+
if (!value) return null;
|
|
44
|
+
if (isGradient(value)) return null;
|
|
45
|
+
if (isIntent(value)) return tokenForegroundForIntent(value);
|
|
46
|
+
if (typeof value === "string" && isCssColor(value)) return value;
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
@@ -39,6 +39,7 @@ exports.rawBgExprWithState = rawBgExprWithState;
|
|
|
39
39
|
exports.toHex = toHex;
|
|
40
40
|
exports.tokenForegroundForIntent = tokenForegroundForIntent;
|
|
41
41
|
exports.tokenStylesForIntent = tokenStylesForIntent;
|
|
42
|
+
exports.warnDeprecatedProp = warnDeprecatedProp;
|
|
42
43
|
exports.warnLegacyColor = warnLegacyColor;
|
|
43
44
|
var _consts = require("../../consts/index.cjs");
|
|
44
45
|
var _commons = require("./commons.util.cjs");
|
|
@@ -405,4 +406,12 @@ function warnLegacyColor(kind, value) {
|
|
|
405
406
|
if (_warnedColorKeys.has(key)) return;
|
|
406
407
|
_warnedColorKeys.add(key);
|
|
407
408
|
console.warn(`[origam] received a raw color for prop "${kind}" (value: ${value}). Pass a TIntent ('primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary' | 'ghost' | 'neutral') or use a :style binding for one-off custom colors. Raw color support is deprecated and will be removed in v3.0.0.`);
|
|
409
|
+
}
|
|
410
|
+
const _warnedDeprecatedPropKeys = /* @__PURE__ */new Set();
|
|
411
|
+
function warnDeprecatedProp(component, oldProp, newProp, removalVersion = "v3.0.0") {
|
|
412
|
+
if (typeof console === "undefined") return;
|
|
413
|
+
const key = `${component}::${oldProp}->${newProp}`;
|
|
414
|
+
if (_warnedDeprecatedPropKeys.has(key)) return;
|
|
415
|
+
_warnedDeprecatedPropKeys.add(key);
|
|
416
|
+
console.warn(`[origam] <${component}> prop "${oldProp}" is deprecated \u2014 use "${newProp}" instead. "${oldProp}" keeps working as an alias and will be removed in ${removalVersion}.`);
|
|
408
417
|
}
|
|
@@ -274,3 +274,10 @@ export declare function tokenForegroundForIntent(intent: TIntent): string;
|
|
|
274
274
|
* support is deprecated and will be removed in v3.0.0.
|
|
275
275
|
*/
|
|
276
276
|
export declare function warnLegacyColor(kind: 'color' | 'bgColor' | 'hoverColor' | 'hoverBgColor' | 'activeColor' | 'activeBgColor', value: string): void;
|
|
277
|
+
/**
|
|
278
|
+
* Warn (once per component / old-prop) that the consumer passed a
|
|
279
|
+
* deprecated prop name where the design system now expects the renamed
|
|
280
|
+
* one. The deprecated prop keeps working (alias) until the removal
|
|
281
|
+
* version.
|
|
282
|
+
*/
|
|
283
|
+
export declare function warnDeprecatedProp(component: string, oldProp: string, newProp: string, removalVersion?: string): void;
|
|
@@ -348,3 +348,13 @@ export function warnLegacyColor(kind, value) {
|
|
|
348
348
|
`[origam] received a raw color for prop "${kind}" (value: ${value}). Pass a TIntent ('primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary' | 'ghost' | 'neutral') or use a :style binding for one-off custom colors. Raw color support is deprecated and will be removed in v3.0.0.`
|
|
349
349
|
);
|
|
350
350
|
}
|
|
351
|
+
const _warnedDeprecatedPropKeys = /* @__PURE__ */ new Set();
|
|
352
|
+
export function warnDeprecatedProp(component, oldProp, newProp, removalVersion = "v3.0.0") {
|
|
353
|
+
if (typeof console === "undefined") return;
|
|
354
|
+
const key = `${component}::${oldProp}->${newProp}`;
|
|
355
|
+
if (_warnedDeprecatedPropKeys.has(key)) return;
|
|
356
|
+
_warnedDeprecatedPropKeys.add(key);
|
|
357
|
+
console.warn(
|
|
358
|
+
`[origam] <${component}> prop "${oldProp}" is deprecated \u2014 use "${newProp}" instead. "${oldProp}" keeps working as an alias and will be removed in ${removalVersion}.`
|
|
359
|
+
);
|
|
360
|
+
}
|
|
@@ -4,7 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.formatElevationStyle = formatElevationStyle;
|
|
7
|
+
exports.isCustomBoxShadow = isCustomBoxShadow;
|
|
8
|
+
var _consts = require("../../consts/index.cjs");
|
|
7
9
|
var _utils = require("../../utils/index.cjs");
|
|
10
|
+
function isCustomBoxShadow(value) {
|
|
11
|
+
return _consts.CUSTOM_BOX_SHADOW_REGEX.test(value.trim());
|
|
12
|
+
}
|
|
8
13
|
function formatElevationStyle(elevation = 0, bgColor) {
|
|
9
14
|
const blurRadius = (0, _utils.roundTo)((0, _utils.normalize)(elevation * 0.04, 0, 1, 0, 16), 1);
|
|
10
15
|
const offsetX = (0, _utils.roundTo)((0, _utils.normalize)(elevation * 0.04, 0, 1, 0, 8), 1);
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { TColor } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a string is a free-form custom `box-shadow` value (not an
|
|
4
|
+
* origam-native rung name, not a Material 0..24 number) that should be
|
|
5
|
+
* emitted verbatim as an inline `box-shadow` declaration. Mirrors
|
|
6
|
+
* `isCustomBorderRadius` (`rounded.util.ts`) — same permissive,
|
|
7
|
+
* signal-based detection instead of a strict grammar parser.
|
|
8
|
+
*
|
|
9
|
+
* @param value …
|
|
10
|
+
*/
|
|
11
|
+
export declare function isCustomBoxShadow(value: string): boolean;
|
|
2
12
|
/**
|
|
3
13
|
* @deprecated Since v0.4 — replaced by the `--origam-shadow-{xs|sm|md|lg|xl}`
|
|
4
14
|
* design tokens generated from `tokens/primitive.json`. The new
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { CUSTOM_BOX_SHADOW_REGEX } from "../../consts/index.js";
|
|
1
2
|
import { convertToUnit, HSVtoHSL, isParsableColor, normalize, parseColor, RGBtoHSV, roundTo } from "../../utils/index.js";
|
|
3
|
+
export function isCustomBoxShadow(value) {
|
|
4
|
+
return CUSTOM_BOX_SHADOW_REGEX.test(value.trim());
|
|
5
|
+
}
|
|
2
6
|
export function formatElevationStyle(elevation = 0, bgColor) {
|
|
3
7
|
const blurRadius = roundTo(normalize(elevation * 0.04, 0, 1, 0, 16), 1);
|
|
4
8
|
const offsetX = roundTo(normalize(elevation * 0.04, 0, 1, 0, 8), 1);
|
|
@@ -10,6 +10,10 @@ function formatMarginStylesVar(values) {
|
|
|
10
10
|
case 1:
|
|
11
11
|
styles.push(`margin: ${values[0]}`);
|
|
12
12
|
break;
|
|
13
|
+
case 2:
|
|
14
|
+
styles.push(`margin-block: ${values[0]}`);
|
|
15
|
+
styles.push(`margin-inline: ${values[1]}`);
|
|
16
|
+
break;
|
|
13
17
|
case 4:
|
|
14
18
|
styles.push(`margin-block-start: ${values[0]}`);
|
|
15
19
|
styles.push(`margin-block-end: ${values[2]}`);
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Format margin styles var.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Accepts 1, 2 or 4 space-separated values (mirrors `formatPaddingStylesVar`):
|
|
5
|
+
* - **1 value** — shorthand `margin: <v0>`.
|
|
6
|
+
* - **2 values** — `margin-block: <v0>` (top+bottom) / `margin-inline: <v1>` (left+right).
|
|
7
|
+
* - **4 values** — logical per-side, see the order note below.
|
|
8
|
+
*
|
|
9
|
+
* ⚠️ **4-value order is `Haut/Gauche/Bas/Droite` (Top/Left/Bottom/Right),
|
|
10
|
+
* NOT the CSS clockwise shorthand order (Top/Right/Bottom/Left).**
|
|
11
|
+
* This is an **intentional DS convention** (arbitrated in issue #216), not a
|
|
12
|
+
* bug: values are grouped **by logical axis** (block first, then inline),
|
|
13
|
+
* which keeps the mapping RTL-safe —
|
|
14
|
+
* `values[0]` → `margin-block-start` (top)
|
|
15
|
+
* `values[1]` → `margin-inline-start` (left in LTR)
|
|
16
|
+
* `values[2]` → `margin-block-end` (bottom)
|
|
17
|
+
* `values[3]` → `margin-inline-end` (right in LTR)
|
|
18
|
+
*
|
|
19
|
+
* Example — do NOT assume CSS clockwise order:
|
|
20
|
+
* ```ts
|
|
21
|
+
* // '8px 16px 24px 32px' → top=8px, LEFT=16px, bottom=24px, RIGHT=32px
|
|
22
|
+
* // (native CSS `margin: 8px 16px 24px 32px` would mean top=8/right=16/bottom=24/left=32 — different!)
|
|
23
|
+
* formatMarginStylesVar(['8px', '16px', '24px', '32px'])
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param values Array of 1, 2 or 4 CSS length/keyword strings.
|
|
5
27
|
*/
|
|
6
28
|
export declare function formatMarginStylesVar(values: Array<string>): string[];
|
|
@@ -4,6 +4,10 @@ export function formatMarginStylesVar(values) {
|
|
|
4
4
|
case 1:
|
|
5
5
|
styles.push(`margin: ${values[0]}`);
|
|
6
6
|
break;
|
|
7
|
+
case 2:
|
|
8
|
+
styles.push(`margin-block: ${values[0]}`);
|
|
9
|
+
styles.push(`margin-inline: ${values[1]}`);
|
|
10
|
+
break;
|
|
7
11
|
case 4:
|
|
8
12
|
styles.push(`margin-block-start: ${values[0]}`);
|
|
9
13
|
styles.push(`margin-block-end: ${values[2]}`);
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Format padding styles var.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Accepts 1, 2 or 4 space-separated values (mirrors `formatMarginStylesVar`):
|
|
5
|
+
* - **1 value** — shorthand `padding: <v0>`.
|
|
6
|
+
* - **2 values** — `padding-block: <v0>` (top+bottom) / `padding-inline: <v1>` (left+right).
|
|
7
|
+
* - **4 values** — logical per-side, see the order note below.
|
|
8
|
+
*
|
|
9
|
+
* ⚠️ **4-value order is `Haut/Gauche/Bas/Droite` (Top/Left/Bottom/Right),
|
|
10
|
+
* NOT the CSS clockwise shorthand order (Top/Right/Bottom/Left).**
|
|
11
|
+
* This is an **intentional DS convention** (arbitrated in issue #216), not a
|
|
12
|
+
* bug: values are grouped **by logical axis** (block first, then inline),
|
|
13
|
+
* which keeps the mapping RTL-safe —
|
|
14
|
+
* `values[0]` → `padding-block-start` (top)
|
|
15
|
+
* `values[1]` → `padding-inline-start` (left in LTR)
|
|
16
|
+
* `values[2]` → `padding-block-end` (bottom)
|
|
17
|
+
* `values[3]` → `padding-inline-end` (right in LTR)
|
|
18
|
+
*
|
|
19
|
+
* Example — do NOT assume CSS clockwise order:
|
|
20
|
+
* ```ts
|
|
21
|
+
* // '8px 16px 24px 32px' → top=8px, LEFT=16px, bottom=24px, RIGHT=32px
|
|
22
|
+
* // (native CSS `padding: 8px 16px 24px 32px` would mean top=8/right=16/bottom=24/left=32 — different!)
|
|
23
|
+
* formatPaddingStylesVar(['8px', '16px', '24px', '32px'])
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param values Array of 1, 2 or 4 CSS length/keyword strings.
|
|
5
27
|
*/
|
|
6
28
|
export declare function formatPaddingStylesVar(values: Array<string>): string[];
|