@warp-ds/elements 2.0.1 → 2.0.2-next.2
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/index.js
CHANGED
|
@@ -651,13 +651,13 @@ var require_moo = __commonJS({
|
|
|
651
651
|
line: this.line,
|
|
652
652
|
col: this.col
|
|
653
653
|
};
|
|
654
|
-
var
|
|
655
|
-
this.index +=
|
|
654
|
+
var size3 = text.length;
|
|
655
|
+
this.index += size3;
|
|
656
656
|
this.line += lineBreaks;
|
|
657
657
|
if (lineBreaks !== 0) {
|
|
658
|
-
this.col =
|
|
658
|
+
this.col = size3 - nl + 1;
|
|
659
659
|
} else {
|
|
660
|
-
this.col +=
|
|
660
|
+
this.col += size3;
|
|
661
661
|
}
|
|
662
662
|
if (group.shouldThrow) {
|
|
663
663
|
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
@@ -3125,6 +3125,151 @@ var offset = function(options) {
|
|
|
3125
3125
|
}
|
|
3126
3126
|
};
|
|
3127
3127
|
};
|
|
3128
|
+
var shift = function(options) {
|
|
3129
|
+
if (options === void 0) {
|
|
3130
|
+
options = {};
|
|
3131
|
+
}
|
|
3132
|
+
return {
|
|
3133
|
+
name: "shift",
|
|
3134
|
+
options,
|
|
3135
|
+
async fn(state) {
|
|
3136
|
+
const {
|
|
3137
|
+
x,
|
|
3138
|
+
y: y2,
|
|
3139
|
+
placement
|
|
3140
|
+
} = state;
|
|
3141
|
+
const _a = evaluate(options, state), {
|
|
3142
|
+
mainAxis: checkMainAxis = true,
|
|
3143
|
+
crossAxis: checkCrossAxis = false,
|
|
3144
|
+
limiter = {
|
|
3145
|
+
fn: (_ref) => {
|
|
3146
|
+
let {
|
|
3147
|
+
x: x2,
|
|
3148
|
+
y: y3
|
|
3149
|
+
} = _ref;
|
|
3150
|
+
return {
|
|
3151
|
+
x: x2,
|
|
3152
|
+
y: y3
|
|
3153
|
+
};
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
3157
|
+
"mainAxis",
|
|
3158
|
+
"crossAxis",
|
|
3159
|
+
"limiter"
|
|
3160
|
+
]);
|
|
3161
|
+
const coords = {
|
|
3162
|
+
x,
|
|
3163
|
+
y: y2
|
|
3164
|
+
};
|
|
3165
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3166
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
3167
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
3168
|
+
let mainAxisCoord = coords[mainAxis];
|
|
3169
|
+
let crossAxisCoord = coords[crossAxis];
|
|
3170
|
+
if (checkMainAxis) {
|
|
3171
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
3172
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
3173
|
+
const min2 = mainAxisCoord + overflow[minSide];
|
|
3174
|
+
const max2 = mainAxisCoord - overflow[maxSide];
|
|
3175
|
+
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
3176
|
+
}
|
|
3177
|
+
if (checkCrossAxis) {
|
|
3178
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
3179
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
3180
|
+
const min2 = crossAxisCoord + overflow[minSide];
|
|
3181
|
+
const max2 = crossAxisCoord - overflow[maxSide];
|
|
3182
|
+
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
3183
|
+
}
|
|
3184
|
+
const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
|
|
3185
|
+
[mainAxis]: mainAxisCoord,
|
|
3186
|
+
[crossAxis]: crossAxisCoord
|
|
3187
|
+
}));
|
|
3188
|
+
return __spreadProps(__spreadValues({}, limitedCoords), {
|
|
3189
|
+
data: {
|
|
3190
|
+
x: limitedCoords.x - x,
|
|
3191
|
+
y: limitedCoords.y - y2
|
|
3192
|
+
}
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
};
|
|
3196
|
+
};
|
|
3197
|
+
var size = function(options) {
|
|
3198
|
+
if (options === void 0) {
|
|
3199
|
+
options = {};
|
|
3200
|
+
}
|
|
3201
|
+
return {
|
|
3202
|
+
name: "size",
|
|
3203
|
+
options,
|
|
3204
|
+
async fn(state) {
|
|
3205
|
+
const {
|
|
3206
|
+
placement,
|
|
3207
|
+
rects,
|
|
3208
|
+
platform: platform2,
|
|
3209
|
+
elements
|
|
3210
|
+
} = state;
|
|
3211
|
+
const _a = evaluate(options, state), {
|
|
3212
|
+
apply = () => {
|
|
3213
|
+
}
|
|
3214
|
+
} = _a, detectOverflowOptions = __objRest(_a, [
|
|
3215
|
+
"apply"
|
|
3216
|
+
]);
|
|
3217
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3218
|
+
const side2 = getSide(placement);
|
|
3219
|
+
const alignment = getAlignment(placement);
|
|
3220
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
3221
|
+
const {
|
|
3222
|
+
width,
|
|
3223
|
+
height
|
|
3224
|
+
} = rects.floating;
|
|
3225
|
+
let heightSide;
|
|
3226
|
+
let widthSide;
|
|
3227
|
+
if (side2 === "top" || side2 === "bottom") {
|
|
3228
|
+
heightSide = side2;
|
|
3229
|
+
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
3230
|
+
} else {
|
|
3231
|
+
widthSide = side2;
|
|
3232
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
3233
|
+
}
|
|
3234
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
3235
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
3236
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
3237
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
3238
|
+
const noShift = !state.middlewareData.shift;
|
|
3239
|
+
let availableHeight = overflowAvailableHeight;
|
|
3240
|
+
let availableWidth = overflowAvailableWidth;
|
|
3241
|
+
if (isYAxis) {
|
|
3242
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
3243
|
+
} else {
|
|
3244
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
3245
|
+
}
|
|
3246
|
+
if (noShift && !alignment) {
|
|
3247
|
+
const xMin = max(overflow.left, 0);
|
|
3248
|
+
const xMax = max(overflow.right, 0);
|
|
3249
|
+
const yMin = max(overflow.top, 0);
|
|
3250
|
+
const yMax = max(overflow.bottom, 0);
|
|
3251
|
+
if (isYAxis) {
|
|
3252
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
3253
|
+
} else {
|
|
3254
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
await apply(__spreadProps(__spreadValues({}, state), {
|
|
3258
|
+
availableWidth,
|
|
3259
|
+
availableHeight
|
|
3260
|
+
}));
|
|
3261
|
+
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
3262
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
3263
|
+
return {
|
|
3264
|
+
reset: {
|
|
3265
|
+
rects: true
|
|
3266
|
+
}
|
|
3267
|
+
};
|
|
3268
|
+
}
|
|
3269
|
+
return {};
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
};
|
|
3128
3273
|
|
|
3129
3274
|
// node_modules/.pnpm/@floating-ui+utils@0.2.7/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
3130
3275
|
function getNodeName(node) {
|
|
@@ -3662,7 +3807,9 @@ var platform = {
|
|
|
3662
3807
|
isRTL
|
|
3663
3808
|
};
|
|
3664
3809
|
var offset2 = offset;
|
|
3810
|
+
var shift2 = shift;
|
|
3665
3811
|
var flip2 = flip;
|
|
3812
|
+
var size2 = size;
|
|
3666
3813
|
var hide2 = hide;
|
|
3667
3814
|
var arrow2 = arrow;
|
|
3668
3815
|
var computePosition2 = (reference, floating, options) => {
|
|
@@ -3678,7 +3825,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
3678
3825
|
}));
|
|
3679
3826
|
};
|
|
3680
3827
|
|
|
3681
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
3828
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.7_@floating-ui+dom@1.6.10/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
|
|
3682
3829
|
var TOP_START = "top-start";
|
|
3683
3830
|
var TOP = "top";
|
|
3684
3831
|
var TOP_END = "top-end";
|
|
@@ -3755,6 +3902,8 @@ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
|
|
|
3755
3902
|
transform: `rotate(${arrowRotation2}deg)`
|
|
3756
3903
|
});
|
|
3757
3904
|
};
|
|
3905
|
+
var ELEMENT_PADDING = 8;
|
|
3906
|
+
var ARROW_OFFSET = 24;
|
|
3758
3907
|
async function useRecompute(state) {
|
|
3759
3908
|
var _a, _b, _c;
|
|
3760
3909
|
if (!(state == null ? void 0 : state.isShowing))
|
|
@@ -3778,8 +3927,18 @@ async function useRecompute(state) {
|
|
|
3778
3927
|
fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
|
|
3779
3928
|
}),
|
|
3780
3929
|
!(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
|
|
3781
|
-
|
|
3930
|
+
(state == null ? void 0 : state.flip) && shift2({ crossAxis: true }),
|
|
3931
|
+
// shifts the attentionEl to make sure that it stays in view
|
|
3932
|
+
hide2(),
|
|
3782
3933
|
// will hide the attentionEl when it appears detached from the targetEl. Can be called multiple times in the middleware-array if you want to use several strategies. Default strategy is 'referenceHidden'.
|
|
3934
|
+
size2({
|
|
3935
|
+
apply() {
|
|
3936
|
+
Object.assign(attentionEl.style, {
|
|
3937
|
+
paddingRight: `${ELEMENT_PADDING}px`,
|
|
3938
|
+
paddingLeft: `${ELEMENT_PADDING}px`
|
|
3939
|
+
});
|
|
3940
|
+
}
|
|
3941
|
+
})
|
|
3783
3942
|
]
|
|
3784
3943
|
}).then(({ x, y: y2, middlewareData, placement }) => {
|
|
3785
3944
|
state.actualDirection = placement;
|
|
@@ -3795,29 +3954,30 @@ async function useRecompute(state) {
|
|
|
3795
3954
|
visibility: referenceHidden ? "hidden" : ""
|
|
3796
3955
|
});
|
|
3797
3956
|
}
|
|
3798
|
-
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
3799
|
-
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
3800
3957
|
if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
|
|
3801
3958
|
const arrowEl = state == null ? void 0 : state.arrowEl;
|
|
3802
3959
|
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
let bottom = "";
|
|
3806
|
-
let left = "";
|
|
3960
|
+
const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
|
|
3961
|
+
const arrowPlacement = arrowDirection(placement).split("-")[1];
|
|
3962
|
+
let top = "", right = "", bottom = "", left = "";
|
|
3807
3963
|
if (arrowPlacement === "start") {
|
|
3808
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
3809
|
-
top = typeof arrowY === "number" ? `calc(
|
|
3964
|
+
const value = typeof arrowX === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3965
|
+
top = typeof arrowY === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3810
3966
|
right = isRtl ? value : "";
|
|
3811
3967
|
left = isRtl ? "" : value;
|
|
3812
3968
|
} else if (arrowPlacement === "end") {
|
|
3813
|
-
const value = typeof arrowX === "number" ? `calc(
|
|
3969
|
+
const value = typeof arrowX === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3814
3970
|
right = isRtl ? "" : value;
|
|
3815
3971
|
left = isRtl ? value : "";
|
|
3816
|
-
bottom = typeof arrowY === "number" ? `calc(
|
|
3972
|
+
bottom = typeof arrowY === "number" ? `calc(${ARROW_OFFSET}px - ${arrowEl.offsetWidth / 2}px)` : "";
|
|
3817
3973
|
} else {
|
|
3818
3974
|
left = typeof arrowX === "number" ? `${arrowX}px` : "";
|
|
3819
3975
|
top = typeof arrowY === "number" ? `${arrowY}px` : "";
|
|
3820
3976
|
}
|
|
3977
|
+
const { x: shiftX } = middlewareData.shift || {};
|
|
3978
|
+
if (typeof shiftX === "number") {
|
|
3979
|
+
left = typeof arrowX === "number" ? `${arrowX - shiftX}px` : left;
|
|
3980
|
+
}
|
|
3821
3981
|
Object.assign(arrowEl.style, {
|
|
3822
3982
|
top,
|
|
3823
3983
|
right,
|
|
@@ -4300,7 +4460,7 @@ if (!customElements.get("w-box")) {
|
|
|
4300
4460
|
// packages/breadcrumbs/index.js
|
|
4301
4461
|
import { html as html12 } from "lit";
|
|
4302
4462
|
|
|
4303
|
-
// node_modules/.pnpm/@warp-ds+core@1.1.
|
|
4463
|
+
// node_modules/.pnpm/@warp-ds+core@1.1.7_@floating-ui+dom@1.6.10/node_modules/@warp-ds/core/dist/breadcrumbs/index.js
|
|
4304
4464
|
function interleave(array, separator2) {
|
|
4305
4465
|
return array.flatMap((el) => [el, separator2]).slice(0, -1);
|
|
4306
4466
|
}
|