nuvox 0.1.5 → 0.1.6
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/BUILDING-COMPONENTS.md +555 -553
- package/CHANGELOG.md +15 -0
- package/dist/{chunk-NC2NEPPE.js → chunk-HAMPWL7I.js} +549 -5
- package/dist/chunk-HAMPWL7I.js.map +1 -0
- package/dist/index.cjs +247 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -1
- package/dist/{rich-text-DpGtEsdl.d.cts → pdf-viewer-CF7o-73J.d.cts} +313 -2
- package/dist/{rich-text-DpGtEsdl.d.ts → pdf-viewer-CF7o-73J.d.ts} +313 -2
- package/dist/react/index.cjs +8019 -4368
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.css +1648 -67
- package/dist/react/index.css.map +1 -1
- package/dist/react/index.d.cts +344 -5
- package/dist/react/index.d.ts +344 -5
- package/dist/react/index.js +8523 -5275
- package/dist/react/index.js.map +1 -1
- package/dist/themes/generated.css +55 -55
- package/package.json +2 -2
- package/dist/chunk-NC2NEPPE.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
|
+
|
|
4
5
|
Format loosely follows [Keep a Changelog](https://keepachangelog.com/).
|
|
5
6
|
|
|
7
|
+
## [0.1.6]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Added new components: `Kanban`, `SearchBar`, `Image`, `Gallery`, `Lightbox`, `VideoPlayer`, `AudioPlayer`, `PDFViewer`, `ScrollArea`, and `StepWizard`.
|
|
12
|
+
* Expanded the component library to 55+ components.
|
|
13
|
+
* Expanded the icon library to 500+ icons.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
* Fixed various CSS and theming issues across multiple components.
|
|
18
|
+
* Fixed styling and behavior issues in `Tabs`, `Sidebar`, and `DropdownMenu`.
|
|
19
|
+
* Improved consistency and reliability across components and themes.
|
|
20
|
+
|
|
6
21
|
## [0.1.5]
|
|
7
22
|
|
|
8
23
|
### Added
|
|
@@ -155,7 +155,7 @@ var light = defineTheme({
|
|
|
155
155
|
"2xl": "0 28px 56px rgba(0,0,0,0.16)",
|
|
156
156
|
inner: "inset 0 1px 2px rgba(0,0,0,0.05)"
|
|
157
157
|
},
|
|
158
|
-
elevation: { dropdown:
|
|
158
|
+
elevation: { dropdown: 1050, popover: 1060, modal: 1e3, toast: 1200, tooltip: 1100 },
|
|
159
159
|
motion: {
|
|
160
160
|
durationFast: "120ms",
|
|
161
161
|
durationNormal: "200ms",
|
|
@@ -228,7 +228,7 @@ var dark = defineTheme({
|
|
|
228
228
|
"2xl": "0 28px 56px rgba(0,0,0,0.65)",
|
|
229
229
|
inner: "inset 0 1px 2px rgba(0,0,0,0.4)"
|
|
230
230
|
},
|
|
231
|
-
elevation: { dropdown:
|
|
231
|
+
elevation: { dropdown: 1050, popover: 1060, modal: 1e3, toast: 1200, tooltip: 1100 },
|
|
232
232
|
motion: {
|
|
233
233
|
durationFast: "120ms",
|
|
234
234
|
durationNormal: "200ms",
|
|
@@ -312,7 +312,7 @@ var glass = defineTheme({
|
|
|
312
312
|
"2xl": "0 32px 80px rgba(0,0,0,0.18)",
|
|
313
313
|
inner: "inset 0 1px 0 rgba(255,255,255,0.4)"
|
|
314
314
|
},
|
|
315
|
-
elevation: { dropdown:
|
|
315
|
+
elevation: { dropdown: 1050, popover: 1060, modal: 1e3, toast: 1200, tooltip: 1100 },
|
|
316
316
|
motion: {
|
|
317
317
|
// Slightly slower/softer than light/dark — matches "everything floats".
|
|
318
318
|
durationFast: "160ms",
|
|
@@ -1089,6 +1089,132 @@ function getSelectAllState(totalCount, selectedCount) {
|
|
|
1089
1089
|
return "some";
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
|
+
// src/core/kanban.ts
|
|
1093
|
+
var DRAG_START_THRESHOLD_PX = 4;
|
|
1094
|
+
function resolveKanbanState(props) {
|
|
1095
|
+
return { compact: props.compact ?? false };
|
|
1096
|
+
}
|
|
1097
|
+
function getBoardClasses(state, className) {
|
|
1098
|
+
return ["nx-kanban", state.compact && "nx-kanban--compact", className].filter(Boolean).join(" ");
|
|
1099
|
+
}
|
|
1100
|
+
function getColumnClasses(isDropTarget, isDragging, className) {
|
|
1101
|
+
return [
|
|
1102
|
+
"nx-kanban__column",
|
|
1103
|
+
isDropTarget && "nx-kanban__column--drop-target",
|
|
1104
|
+
isDragging && "nx-kanban__column--dragging",
|
|
1105
|
+
className
|
|
1106
|
+
].filter(Boolean).join(" ");
|
|
1107
|
+
}
|
|
1108
|
+
function getColumnCountClasses(overLimit) {
|
|
1109
|
+
return ["nx-kanban__column-count", overLimit && "nx-kanban__column-count--over-limit"].filter(Boolean).join(" ");
|
|
1110
|
+
}
|
|
1111
|
+
function getCardWrapperClasses(opts, className) {
|
|
1112
|
+
return [
|
|
1113
|
+
"nx-kanban__card",
|
|
1114
|
+
opts.isPointerDragging && "nx-kanban__card--dragging",
|
|
1115
|
+
opts.isPickedUp && "nx-kanban__card--picked-up",
|
|
1116
|
+
opts.disabled && "nx-kanban__card--disabled",
|
|
1117
|
+
className
|
|
1118
|
+
].filter(Boolean).join(" ");
|
|
1119
|
+
}
|
|
1120
|
+
function findCardLocation(value, cardId) {
|
|
1121
|
+
for (const column of value.columns) {
|
|
1122
|
+
const index = column.cardIds.indexOf(cardId);
|
|
1123
|
+
if (index !== -1) return { columnId: column.id, index };
|
|
1124
|
+
}
|
|
1125
|
+
return null;
|
|
1126
|
+
}
|
|
1127
|
+
function removeCard(value, cardId) {
|
|
1128
|
+
const location = findCardLocation(value, cardId);
|
|
1129
|
+
if (!location) return value;
|
|
1130
|
+
return {
|
|
1131
|
+
columns: value.columns.map(
|
|
1132
|
+
(column) => column.id === location.columnId ? { ...column, cardIds: column.cardIds.filter((id) => id !== cardId) } : column
|
|
1133
|
+
)
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
function moveCard(value, target) {
|
|
1137
|
+
const location = findCardLocation(value, target.cardId);
|
|
1138
|
+
const destExists = value.columns.some((column) => column.id === target.toColumnId);
|
|
1139
|
+
if (!location || !destExists) return value;
|
|
1140
|
+
const withoutCard = value.columns.map(
|
|
1141
|
+
(column) => column.cardIds.includes(target.cardId) ? { ...column, cardIds: column.cardIds.filter((id) => id !== target.cardId) } : column
|
|
1142
|
+
);
|
|
1143
|
+
return {
|
|
1144
|
+
columns: withoutCard.map((column) => {
|
|
1145
|
+
if (column.id !== target.toColumnId) return column;
|
|
1146
|
+
const clampedIndex = Math.max(0, Math.min(target.toIndex, column.cardIds.length));
|
|
1147
|
+
const cardIds = [...column.cardIds];
|
|
1148
|
+
cardIds.splice(clampedIndex, 0, target.cardId);
|
|
1149
|
+
return { ...column, cardIds };
|
|
1150
|
+
})
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
function getAdjacentColumnId(value, columnId, direction) {
|
|
1154
|
+
const index = value.columns.findIndex((column) => column.id === columnId);
|
|
1155
|
+
if (index === -1) return null;
|
|
1156
|
+
return value.columns[index + direction]?.id ?? null;
|
|
1157
|
+
}
|
|
1158
|
+
function getKeyboardMoveTarget(value, cardId, direction) {
|
|
1159
|
+
const location = findCardLocation(value, cardId);
|
|
1160
|
+
if (!location) return null;
|
|
1161
|
+
const column = value.columns.find((c) => c.id === location.columnId);
|
|
1162
|
+
if (!column) return null;
|
|
1163
|
+
if (direction === "up" || direction === "down") {
|
|
1164
|
+
const toIndex2 = direction === "up" ? location.index - 1 : location.index + 1;
|
|
1165
|
+
if (toIndex2 < 0 || toIndex2 > column.cardIds.length - 1) return null;
|
|
1166
|
+
return { cardId, toColumnId: location.columnId, toIndex: toIndex2 };
|
|
1167
|
+
}
|
|
1168
|
+
const adjacentColumnId = getAdjacentColumnId(value, location.columnId, direction === "prev" ? -1 : 1);
|
|
1169
|
+
if (!adjacentColumnId) return null;
|
|
1170
|
+
const destColumn = value.columns.find((c) => c.id === adjacentColumnId);
|
|
1171
|
+
if (!destColumn) return null;
|
|
1172
|
+
const toIndex = Math.min(location.index, destColumn.cardIds.length);
|
|
1173
|
+
return { cardId, toColumnId: adjacentColumnId, toIndex };
|
|
1174
|
+
}
|
|
1175
|
+
function computeDropIndex(pointerY, cardRects) {
|
|
1176
|
+
for (let i = 0; i < cardRects.length; i++) {
|
|
1177
|
+
const midpoint = (cardRects[i].top + cardRects[i].bottom) / 2;
|
|
1178
|
+
if (pointerY < midpoint) return i;
|
|
1179
|
+
}
|
|
1180
|
+
return cardRects.length;
|
|
1181
|
+
}
|
|
1182
|
+
function computeDropColumn(pointerX, pointerY, columns) {
|
|
1183
|
+
for (const column of columns) {
|
|
1184
|
+
if (pointerX >= column.left && pointerX <= column.right && pointerY >= column.top && pointerY <= column.bottom) {
|
|
1185
|
+
return column.id;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return null;
|
|
1189
|
+
}
|
|
1190
|
+
function moveColumn(value, target) {
|
|
1191
|
+
const fromIndex = value.columns.findIndex((c) => c.id === target.columnId);
|
|
1192
|
+
if (fromIndex === -1) return value;
|
|
1193
|
+
const columns = [...value.columns];
|
|
1194
|
+
const [moved] = columns.splice(fromIndex, 1);
|
|
1195
|
+
const clampedIndex = Math.max(0, Math.min(target.toIndex, columns.length));
|
|
1196
|
+
columns.splice(clampedIndex, 0, moved);
|
|
1197
|
+
return { columns };
|
|
1198
|
+
}
|
|
1199
|
+
function removeColumn(value, columnId) {
|
|
1200
|
+
if (!value.columns.some((c) => c.id === columnId)) return value;
|
|
1201
|
+
return { columns: value.columns.filter((c) => c.id !== columnId) };
|
|
1202
|
+
}
|
|
1203
|
+
function getColumnKeyboardMoveTarget(value, columnId, direction) {
|
|
1204
|
+
const fromIndex = value.columns.findIndex((c) => c.id === columnId);
|
|
1205
|
+
if (fromIndex === -1) return null;
|
|
1206
|
+
const toIndex = direction === "prev" ? fromIndex - 1 : fromIndex + 1;
|
|
1207
|
+
if (toIndex < 0 || toIndex > value.columns.length - 1) return null;
|
|
1208
|
+
return { columnId, toIndex };
|
|
1209
|
+
}
|
|
1210
|
+
function computeColumnDropIndex(pointerX, columnRects) {
|
|
1211
|
+
for (let i = 0; i < columnRects.length; i++) {
|
|
1212
|
+
const midpoint = (columnRects[i].left + columnRects[i].right) / 2;
|
|
1213
|
+
if (pointerX < midpoint) return i;
|
|
1214
|
+
}
|
|
1215
|
+
return columnRects.length;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1092
1218
|
// src/core/code-highlight.ts
|
|
1093
1219
|
function tokenizeFlat(source, grammar) {
|
|
1094
1220
|
const tokens = [];
|
|
@@ -1829,6 +1955,358 @@ function getRichTextEditorClasses(state) {
|
|
|
1829
1955
|
].filter(Boolean).join(" ");
|
|
1830
1956
|
}
|
|
1831
1957
|
|
|
1958
|
+
// src/core/gallery.ts
|
|
1959
|
+
function resolveGalleryState(props) {
|
|
1960
|
+
return {
|
|
1961
|
+
layout: props.layout ?? "grid",
|
|
1962
|
+
columns: props.columns ?? 3,
|
|
1963
|
+
gap: props.gap,
|
|
1964
|
+
targetRowHeight: props.targetRowHeight ?? 220
|
|
1965
|
+
};
|
|
1966
|
+
}
|
|
1967
|
+
function getGalleryClasses(state, className) {
|
|
1968
|
+
return ["nx-gallery", `nx-gallery--${state.layout}`, className].filter(Boolean).join(" ");
|
|
1969
|
+
}
|
|
1970
|
+
function getGalleryStyle(state) {
|
|
1971
|
+
const style = {};
|
|
1972
|
+
if (state.gap) style.gap = state.gap;
|
|
1973
|
+
if (state.layout === "grid" || state.layout === "masonry") {
|
|
1974
|
+
style["--nx-gallery-columns"] = String(state.columns);
|
|
1975
|
+
}
|
|
1976
|
+
return style;
|
|
1977
|
+
}
|
|
1978
|
+
function aspectRatioFromDims(width, height) {
|
|
1979
|
+
if (!width || !height || width <= 0 || height <= 0) return 1;
|
|
1980
|
+
return width / height;
|
|
1981
|
+
}
|
|
1982
|
+
function computeJustifiedRows(aspectRatios, containerWidth, targetRowHeight, gap) {
|
|
1983
|
+
if (aspectRatios.length === 0 || containerWidth <= 0 || targetRowHeight <= 0) return [];
|
|
1984
|
+
const rows = [];
|
|
1985
|
+
let rowIndices = [];
|
|
1986
|
+
let rowNaturalWidths = [];
|
|
1987
|
+
let rowWidthSum = 0;
|
|
1988
|
+
function flushRow(scale) {
|
|
1989
|
+
if (rowIndices.length === 0) return;
|
|
1990
|
+
const gapsWidth = gap * (rowIndices.length - 1);
|
|
1991
|
+
const availableWidth = containerWidth - gapsWidth;
|
|
1992
|
+
const naturalTotal = rowWidthSum;
|
|
1993
|
+
const scaleFactor = scale ? availableWidth / naturalTotal : 1;
|
|
1994
|
+
rows.push({
|
|
1995
|
+
indices: rowIndices,
|
|
1996
|
+
height: targetRowHeight * scaleFactor,
|
|
1997
|
+
widths: rowNaturalWidths.map((w) => w * scaleFactor)
|
|
1998
|
+
});
|
|
1999
|
+
rowIndices = [];
|
|
2000
|
+
rowNaturalWidths = [];
|
|
2001
|
+
rowWidthSum = 0;
|
|
2002
|
+
}
|
|
2003
|
+
for (let i = 0; i < aspectRatios.length; i++) {
|
|
2004
|
+
const naturalWidth = aspectRatios[i] * targetRowHeight;
|
|
2005
|
+
const gapsWidth = gap * rowIndices.length;
|
|
2006
|
+
if (rowIndices.length > 0 && rowWidthSum + naturalWidth + gapsWidth > containerWidth) {
|
|
2007
|
+
flushRow(true);
|
|
2008
|
+
}
|
|
2009
|
+
rowIndices.push(i);
|
|
2010
|
+
rowNaturalWidths.push(naturalWidth);
|
|
2011
|
+
rowWidthSum += naturalWidth;
|
|
2012
|
+
}
|
|
2013
|
+
const finalGapsWidth = gap * (rowIndices.length - 1);
|
|
2014
|
+
const overflows = rowWidthSum + finalGapsWidth > containerWidth;
|
|
2015
|
+
flushRow(overflows);
|
|
2016
|
+
return rows;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
// src/core/slider.ts
|
|
2020
|
+
function isRangeValue(value) {
|
|
2021
|
+
return Array.isArray(value);
|
|
2022
|
+
}
|
|
2023
|
+
function toThumbs(value) {
|
|
2024
|
+
return isRangeValue(value) ? [value[0], value[1]] : [value];
|
|
2025
|
+
}
|
|
2026
|
+
function fromThumbs(thumbs, like) {
|
|
2027
|
+
return isRangeValue(like) ? [thumbs[0], thumbs[1]] : thumbs[0];
|
|
2028
|
+
}
|
|
2029
|
+
function resolveSliderState(props) {
|
|
2030
|
+
return {
|
|
2031
|
+
// ?? not || (CONTRACT.md Rule 3) — an explicit min={0} must not
|
|
2032
|
+
// be discarded (it already is the default, but a future
|
|
2033
|
+
// negative-range default would make this the exact bug Rule 3
|
|
2034
|
+
// guards against).
|
|
2035
|
+
min: props.min ?? 0,
|
|
2036
|
+
max: props.max ?? 100,
|
|
2037
|
+
step: props.step ?? 1,
|
|
2038
|
+
isDisabled: props.disabled ?? false,
|
|
2039
|
+
size: props.size ?? "md"
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
function clampAndSnap(value, state) {
|
|
2043
|
+
const { min, max, step } = state;
|
|
2044
|
+
const clamped = Math.min(Math.max(value, min), max);
|
|
2045
|
+
if (step <= 0) return clamped;
|
|
2046
|
+
const steps = Math.round((clamped - min) / step);
|
|
2047
|
+
const snapped = min + steps * step;
|
|
2048
|
+
return Math.min(Math.max(snapped, min), max);
|
|
2049
|
+
}
|
|
2050
|
+
function valueToPercent(value, min, max) {
|
|
2051
|
+
if (max === min) return 0;
|
|
2052
|
+
return (value - min) / (max - min) * 100;
|
|
2053
|
+
}
|
|
2054
|
+
function percentToValue(percent, min, max) {
|
|
2055
|
+
return min + percent / 100 * (max - min);
|
|
2056
|
+
}
|
|
2057
|
+
function clampRangeThumb(thumbs, index, next, minGap = 0) {
|
|
2058
|
+
if (index === 0) return Math.min(next, thumbs[1] - minGap);
|
|
2059
|
+
return Math.max(next, thumbs[0] + minGap);
|
|
2060
|
+
}
|
|
2061
|
+
function nearestThumbIndex(thumbs, targetValue) {
|
|
2062
|
+
const distLow = Math.abs(thumbs[0] - targetValue);
|
|
2063
|
+
const distHigh = Math.abs(thumbs[1] - targetValue);
|
|
2064
|
+
return distHigh < distLow ? 1 : 0;
|
|
2065
|
+
}
|
|
2066
|
+
var STEP_KEYS_UP = /* @__PURE__ */ new Set(["ArrowRight", "ArrowUp"]);
|
|
2067
|
+
var STEP_KEYS_DOWN = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowDown"]);
|
|
2068
|
+
function getKeyboardValue(key, current, state) {
|
|
2069
|
+
const bigStep = Math.min(state.step * 10, state.max - state.min);
|
|
2070
|
+
if (STEP_KEYS_UP.has(key)) return clampAndSnap(current + state.step, state);
|
|
2071
|
+
if (STEP_KEYS_DOWN.has(key)) return clampAndSnap(current - state.step, state);
|
|
2072
|
+
if (key === "PageUp") return clampAndSnap(current + bigStep, state);
|
|
2073
|
+
if (key === "PageDown") return clampAndSnap(current - bigStep, state);
|
|
2074
|
+
if (key === "Home") return state.min;
|
|
2075
|
+
if (key === "End") return state.max;
|
|
2076
|
+
return null;
|
|
2077
|
+
}
|
|
2078
|
+
function getRootClasses(state, isRange, showValueLabel, className) {
|
|
2079
|
+
return [
|
|
2080
|
+
"nx-slider",
|
|
2081
|
+
`nx-slider--${state.size}`,
|
|
2082
|
+
isRange && "nx-slider--range",
|
|
2083
|
+
state.isDisabled && "nx-slider--disabled",
|
|
2084
|
+
// The value-label bubble floats above the thumb (see
|
|
2085
|
+
// Slider.css) — with no room reserved for it, it overflows
|
|
2086
|
+
// .nx-slider's own box and lands on whatever's above it in
|
|
2087
|
+
// .nx-field, which for a slider with a `label` is the label
|
|
2088
|
+
// text itself. This adds the top margin the bubble actually
|
|
2089
|
+
// needs instead of relying on .nx-field's generic 4px gap.
|
|
2090
|
+
showValueLabel && "nx-slider--with-value-label",
|
|
2091
|
+
className
|
|
2092
|
+
].filter(Boolean).join(" ");
|
|
2093
|
+
}
|
|
2094
|
+
function getThumbAriaProps(input) {
|
|
2095
|
+
return {
|
|
2096
|
+
role: "slider",
|
|
2097
|
+
"aria-valuemin": input.min,
|
|
2098
|
+
"aria-valuemax": input.max,
|
|
2099
|
+
"aria-valuenow": input.value,
|
|
2100
|
+
"aria-valuetext": input.valueText,
|
|
2101
|
+
"aria-orientation": "horizontal",
|
|
2102
|
+
"aria-disabled": input.isDisabled || void 0,
|
|
2103
|
+
"aria-labelledby": input.labelledBy,
|
|
2104
|
+
tabIndex: input.isDisabled ? -1 : 0
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
// src/core/media.ts
|
|
2109
|
+
var PLAYBACK_RATES = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
|
2110
|
+
function formatMediaTime(seconds) {
|
|
2111
|
+
if (!Number.isFinite(seconds) || seconds < 0) return "0:00";
|
|
2112
|
+
const total = Math.floor(seconds);
|
|
2113
|
+
const h = Math.floor(total / 3600);
|
|
2114
|
+
const m = Math.floor(total % 3600 / 60);
|
|
2115
|
+
const s = total % 60;
|
|
2116
|
+
const paddedS = String(s).padStart(2, "0");
|
|
2117
|
+
if (h > 0) return `${h}:${String(m).padStart(2, "0")}:${paddedS}`;
|
|
2118
|
+
return `${m}:${paddedS}`;
|
|
2119
|
+
}
|
|
2120
|
+
function clampVolume(volume) {
|
|
2121
|
+
return clampAndSnap(volume, { min: 0, max: 1, step: 0 });
|
|
2122
|
+
}
|
|
2123
|
+
function positionToTime(clientX, trackRect, duration) {
|
|
2124
|
+
if (trackRect.width <= 0 || !Number.isFinite(duration) || duration <= 0) return 0;
|
|
2125
|
+
const rawPercent = (clientX - trackRect.left) / trackRect.width * 100;
|
|
2126
|
+
const percent = clampAndSnap(rawPercent, { min: 0, max: 100, step: 0 });
|
|
2127
|
+
return percentToValue(percent, 0, duration);
|
|
2128
|
+
}
|
|
2129
|
+
function positionToRatio(clientX, trackRect) {
|
|
2130
|
+
return clampVolume(positionToTime(clientX, trackRect, 1));
|
|
2131
|
+
}
|
|
2132
|
+
function getBufferedPercent(bufferedEnd, duration) {
|
|
2133
|
+
if (!Number.isFinite(duration) || duration <= 0) return 0;
|
|
2134
|
+
return clampAndSnap(bufferedEnd / duration * 100, { min: 0, max: 100, step: 0 });
|
|
2135
|
+
}
|
|
2136
|
+
function getProgressPercent(currentTime, duration) {
|
|
2137
|
+
return getBufferedPercent(currentTime, duration);
|
|
2138
|
+
}
|
|
2139
|
+
function recoverDuration(media, restoreTo, onDuration, giveUpMs = 4e3, pollMs = 100) {
|
|
2140
|
+
function isKnown(duration) {
|
|
2141
|
+
return Number.isFinite(duration) && duration > 0;
|
|
2142
|
+
}
|
|
2143
|
+
if (isKnown(media.duration)) {
|
|
2144
|
+
onDuration(media.duration);
|
|
2145
|
+
return () => {
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
let settled = false;
|
|
2149
|
+
let pollHandle;
|
|
2150
|
+
let giveUpHandle;
|
|
2151
|
+
function cleanup() {
|
|
2152
|
+
media.removeEventListener("timeupdate", handleResolved);
|
|
2153
|
+
media.removeEventListener("seeked", handleResolved);
|
|
2154
|
+
media.removeEventListener("durationchange", handleResolved);
|
|
2155
|
+
media.removeEventListener("error", handleError);
|
|
2156
|
+
if (pollHandle !== void 0) clearInterval(pollHandle);
|
|
2157
|
+
if (giveUpHandle !== void 0) clearTimeout(giveUpHandle);
|
|
2158
|
+
}
|
|
2159
|
+
function finish(resolvedDuration, restore) {
|
|
2160
|
+
if (settled) return;
|
|
2161
|
+
settled = true;
|
|
2162
|
+
cleanup();
|
|
2163
|
+
if (restore) media.currentTime = restoreTo;
|
|
2164
|
+
onDuration(resolvedDuration);
|
|
2165
|
+
}
|
|
2166
|
+
function handleResolved() {
|
|
2167
|
+
if (isKnown(media.duration)) finish(media.duration, true);
|
|
2168
|
+
}
|
|
2169
|
+
function handleError() {
|
|
2170
|
+
finish(0, false);
|
|
2171
|
+
}
|
|
2172
|
+
media.addEventListener("timeupdate", handleResolved);
|
|
2173
|
+
media.addEventListener("seeked", handleResolved);
|
|
2174
|
+
media.addEventListener("durationchange", handleResolved);
|
|
2175
|
+
media.addEventListener("error", handleError);
|
|
2176
|
+
pollHandle = setInterval(() => {
|
|
2177
|
+
if (isKnown(media.duration)) finish(media.duration, true);
|
|
2178
|
+
}, pollMs);
|
|
2179
|
+
giveUpHandle = setTimeout(() => finish(0, false), giveUpMs);
|
|
2180
|
+
media.currentTime = 1e101;
|
|
2181
|
+
return cleanup;
|
|
2182
|
+
}
|
|
2183
|
+
function getSeekAriaProps(currentTime, duration) {
|
|
2184
|
+
return {
|
|
2185
|
+
role: "slider",
|
|
2186
|
+
"aria-label": "Seek",
|
|
2187
|
+
"aria-valuemin": 0,
|
|
2188
|
+
"aria-valuemax": Math.max(duration, 0),
|
|
2189
|
+
"aria-valuenow": Math.min(Math.max(currentTime, 0), Math.max(duration, 0)),
|
|
2190
|
+
"aria-valuetext": formatMediaTime(currentTime)
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
function getVolumeAriaProps(volume, muted) {
|
|
2194
|
+
const pct = Math.round(clampVolume(volume) * 100);
|
|
2195
|
+
return {
|
|
2196
|
+
role: "slider",
|
|
2197
|
+
"aria-label": "Volume",
|
|
2198
|
+
"aria-valuemin": 0,
|
|
2199
|
+
"aria-valuemax": 100,
|
|
2200
|
+
"aria-valuenow": muted ? 0 : pct,
|
|
2201
|
+
"aria-valuetext": muted ? "Muted" : `${pct}%`
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
function getPlayButtonAriaProps(isPlaying) {
|
|
2205
|
+
return { "aria-label": isPlaying ? "Pause" : "Play" };
|
|
2206
|
+
}
|
|
2207
|
+
function getMuteButtonAriaProps(isMuted) {
|
|
2208
|
+
return { "aria-label": isMuted ? "Unmute" : "Mute", "aria-pressed": isMuted };
|
|
2209
|
+
}
|
|
2210
|
+
function isEffectivelyMuted(volume, muted) {
|
|
2211
|
+
return muted || volume <= 0;
|
|
2212
|
+
}
|
|
2213
|
+
var SKIP_SECONDS = 10;
|
|
2214
|
+
var LABELED_SKIP_SECONDS = [5, 10, 15, 30];
|
|
2215
|
+
function hasLabeledSkipIcon(seconds) {
|
|
2216
|
+
return LABELED_SKIP_SECONDS.includes(seconds);
|
|
2217
|
+
}
|
|
2218
|
+
function resolveSkipSeconds(skipSeconds) {
|
|
2219
|
+
if (skipSeconds === void 0) return SKIP_SECONDS;
|
|
2220
|
+
if (!Number.isFinite(skipSeconds) || skipSeconds <= 0) return SKIP_SECONDS;
|
|
2221
|
+
return skipSeconds;
|
|
2222
|
+
}
|
|
2223
|
+
function skipTime(currentTime, duration, deltaSeconds) {
|
|
2224
|
+
const max = Number.isFinite(duration) && duration > 0 ? duration : Infinity;
|
|
2225
|
+
return Math.min(Math.max(currentTime + deltaSeconds, 0), max);
|
|
2226
|
+
}
|
|
2227
|
+
function getSkipButtonAriaProps(deltaSeconds) {
|
|
2228
|
+
return { "aria-label": deltaSeconds < 0 ? `Back ${Math.abs(deltaSeconds)} seconds` : `Forward ${deltaSeconds} seconds` };
|
|
2229
|
+
}
|
|
2230
|
+
function resolveMediaTransport(props) {
|
|
2231
|
+
const showNext = props.onNext !== void 0;
|
|
2232
|
+
const showPrevious = props.onPrevious !== void 0;
|
|
2233
|
+
return {
|
|
2234
|
+
skipSeconds: resolveSkipSeconds(props.skipSeconds),
|
|
2235
|
+
showNext,
|
|
2236
|
+
showPrevious,
|
|
2237
|
+
nextDisabled: showNext && (props.hasNext ?? true) === false,
|
|
2238
|
+
previousDisabled: showPrevious && (props.hasPrevious ?? true) === false
|
|
2239
|
+
};
|
|
2240
|
+
}
|
|
2241
|
+
function getTrackButtonAriaProps(direction) {
|
|
2242
|
+
return { "aria-label": direction === "next" ? "Next track" : "Previous track" };
|
|
2243
|
+
}
|
|
2244
|
+
function getMediaKeyAction(key) {
|
|
2245
|
+
switch (key) {
|
|
2246
|
+
case " ":
|
|
2247
|
+
case "Spacebar":
|
|
2248
|
+
return "toggle-play";
|
|
2249
|
+
case "ArrowLeft":
|
|
2250
|
+
return "seek-back";
|
|
2251
|
+
case "ArrowRight":
|
|
2252
|
+
return "seek-forward";
|
|
2253
|
+
case "ArrowUp":
|
|
2254
|
+
return "volume-up";
|
|
2255
|
+
case "ArrowDown":
|
|
2256
|
+
return "volume-down";
|
|
2257
|
+
default:
|
|
2258
|
+
return null;
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
// src/core/pdf-viewer.ts
|
|
2263
|
+
function resolvePdfViewerState(props) {
|
|
2264
|
+
return {
|
|
2265
|
+
initialPage: props.initialPage ?? 1,
|
|
2266
|
+
initialScale: props.initialScale ?? "auto",
|
|
2267
|
+
minScale: props.minScale ?? 0.5,
|
|
2268
|
+
maxScale: props.maxScale ?? 3,
|
|
2269
|
+
scaleStep: props.scaleStep ?? 0.25
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
function getPdfViewerClasses(className) {
|
|
2273
|
+
return ["nx-pdf-viewer", className].filter(Boolean).join(" ");
|
|
2274
|
+
}
|
|
2275
|
+
function clampPage(page) {
|
|
2276
|
+
return Math.max(Math.round(page), 1);
|
|
2277
|
+
}
|
|
2278
|
+
function clampScale(scale, min, max) {
|
|
2279
|
+
return Math.min(Math.max(scale, min), max);
|
|
2280
|
+
}
|
|
2281
|
+
function resolveZoomBase(scale, fitScale) {
|
|
2282
|
+
return scale === "auto" ? fitScale : scale;
|
|
2283
|
+
}
|
|
2284
|
+
function zoomIn(scale, step, max, fitScale = 1) {
|
|
2285
|
+
return clampScale(resolveZoomBase(scale, fitScale) + step, 0, max);
|
|
2286
|
+
}
|
|
2287
|
+
function zoomOut(scale, step, min, fitScale = 1) {
|
|
2288
|
+
return clampScale(resolveZoomBase(scale, fitScale) - step, min, Infinity);
|
|
2289
|
+
}
|
|
2290
|
+
function isZoomAtMin(scale, min) {
|
|
2291
|
+
return scale !== "auto" && scale <= min;
|
|
2292
|
+
}
|
|
2293
|
+
function isZoomAtMax(scale, max) {
|
|
2294
|
+
return scale !== "auto" && scale >= max;
|
|
2295
|
+
}
|
|
2296
|
+
function estimateFitScale(iframeWidthPx, pageWidthPt = 612) {
|
|
2297
|
+
if (iframeWidthPx <= 0 || pageWidthPt <= 0) return 1;
|
|
2298
|
+
const pageWidthPx = pageWidthPt * (96 / 72);
|
|
2299
|
+
return iframeWidthPx / pageWidthPx;
|
|
2300
|
+
}
|
|
2301
|
+
function formatZoomPercent(scale) {
|
|
2302
|
+
return scale === "auto" ? "Fit" : `${Math.round(scale * 100)}%`;
|
|
2303
|
+
}
|
|
2304
|
+
function buildPdfSrc(src, page, scale) {
|
|
2305
|
+
const base = src.split("#")[0];
|
|
2306
|
+
const zoomParam = scale === "auto" ? "page-width" : Math.round(scale * 100);
|
|
2307
|
+
return `${base}#page=${clampPage(page)}&zoom=${zoomParam}`;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
1832
2310
|
export {
|
|
1833
2311
|
defineTheme,
|
|
1834
2312
|
TOKEN_CATEGORIES,
|
|
@@ -1895,6 +2373,23 @@ export {
|
|
|
1895
2373
|
getNextSortDirection,
|
|
1896
2374
|
getSortAriaProps,
|
|
1897
2375
|
getSelectAllState,
|
|
2376
|
+
DRAG_START_THRESHOLD_PX,
|
|
2377
|
+
resolveKanbanState,
|
|
2378
|
+
getBoardClasses,
|
|
2379
|
+
getColumnClasses,
|
|
2380
|
+
getColumnCountClasses,
|
|
2381
|
+
getCardWrapperClasses,
|
|
2382
|
+
findCardLocation,
|
|
2383
|
+
removeCard,
|
|
2384
|
+
moveCard,
|
|
2385
|
+
getAdjacentColumnId,
|
|
2386
|
+
getKeyboardMoveTarget,
|
|
2387
|
+
computeDropIndex,
|
|
2388
|
+
computeDropColumn,
|
|
2389
|
+
moveColumn,
|
|
2390
|
+
removeColumn,
|
|
2391
|
+
getColumnKeyboardMoveTarget,
|
|
2392
|
+
computeColumnDropIndex,
|
|
1898
2393
|
LANGUAGE_LABELS,
|
|
1899
2394
|
normalizeLanguage,
|
|
1900
2395
|
nuvoxHighlight,
|
|
@@ -1908,6 +2403,55 @@ export {
|
|
|
1908
2403
|
undoHistory,
|
|
1909
2404
|
redoHistory,
|
|
1910
2405
|
resolveRichTextEditorState,
|
|
1911
|
-
getRichTextEditorClasses
|
|
2406
|
+
getRichTextEditorClasses,
|
|
2407
|
+
resolveGalleryState,
|
|
2408
|
+
getGalleryClasses,
|
|
2409
|
+
getGalleryStyle,
|
|
2410
|
+
aspectRatioFromDims,
|
|
2411
|
+
computeJustifiedRows,
|
|
2412
|
+
isRangeValue,
|
|
2413
|
+
toThumbs,
|
|
2414
|
+
fromThumbs,
|
|
2415
|
+
resolveSliderState,
|
|
2416
|
+
clampAndSnap,
|
|
2417
|
+
valueToPercent,
|
|
2418
|
+
percentToValue,
|
|
2419
|
+
clampRangeThumb,
|
|
2420
|
+
nearestThumbIndex,
|
|
2421
|
+
getKeyboardValue,
|
|
2422
|
+
getRootClasses,
|
|
2423
|
+
getThumbAriaProps,
|
|
2424
|
+
PLAYBACK_RATES,
|
|
2425
|
+
formatMediaTime,
|
|
2426
|
+
clampVolume,
|
|
2427
|
+
positionToTime,
|
|
2428
|
+
positionToRatio,
|
|
2429
|
+
getBufferedPercent,
|
|
2430
|
+
getProgressPercent,
|
|
2431
|
+
recoverDuration,
|
|
2432
|
+
getSeekAriaProps,
|
|
2433
|
+
getVolumeAriaProps,
|
|
2434
|
+
getPlayButtonAriaProps,
|
|
2435
|
+
getMuteButtonAriaProps,
|
|
2436
|
+
isEffectivelyMuted,
|
|
2437
|
+
SKIP_SECONDS,
|
|
2438
|
+
LABELED_SKIP_SECONDS,
|
|
2439
|
+
hasLabeledSkipIcon,
|
|
2440
|
+
resolveSkipSeconds,
|
|
2441
|
+
skipTime,
|
|
2442
|
+
getSkipButtonAriaProps,
|
|
2443
|
+
resolveMediaTransport,
|
|
2444
|
+
getTrackButtonAriaProps,
|
|
2445
|
+
getMediaKeyAction,
|
|
2446
|
+
resolvePdfViewerState,
|
|
2447
|
+
getPdfViewerClasses,
|
|
2448
|
+
clampPage,
|
|
2449
|
+
zoomIn,
|
|
2450
|
+
zoomOut,
|
|
2451
|
+
isZoomAtMin,
|
|
2452
|
+
isZoomAtMax,
|
|
2453
|
+
estimateFitScale,
|
|
2454
|
+
formatZoomPercent,
|
|
2455
|
+
buildPdfSrc
|
|
1912
2456
|
};
|
|
1913
|
-
//# sourceMappingURL=chunk-
|
|
2457
|
+
//# sourceMappingURL=chunk-HAMPWL7I.js.map
|