@resee-movies/nuxt-ux 0.15.0 → 0.16.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/module.json
CHANGED
|
@@ -66,7 +66,9 @@ const props = defineProps({
|
|
|
66
66
|
loading: { type: Boolean, required: false, default: false },
|
|
67
67
|
centerAlign: { type: Boolean, required: false, default: false },
|
|
68
68
|
toPageContainerEdge: { type: Boolean, required: false, default: true },
|
|
69
|
-
styleWhenTransiting: { type: String, required: false, default: "right" }
|
|
69
|
+
styleWhenTransiting: { type: String, required: false, default: "right" },
|
|
70
|
+
transitOpacity: { type: Boolean, required: false, default: true },
|
|
71
|
+
transitScale: { type: Boolean, required: false, default: true }
|
|
70
72
|
});
|
|
71
73
|
const slots = defineSlots();
|
|
72
74
|
const ruler = ref();
|
|
@@ -111,43 +113,85 @@ const displayBounds = computed(() => {
|
|
|
111
113
|
bounds.x3_4 = `${bounds.x4 - bounds.x3}px`;
|
|
112
114
|
return bounds;
|
|
113
115
|
});
|
|
114
|
-
|
|
116
|
+
const {
|
|
117
|
+
pause: pauseScrollReset,
|
|
118
|
+
resume: resumeScrollReset
|
|
119
|
+
} = watchDebounced([displayBounds], () => {
|
|
115
120
|
scrollBox.value?.scrollTo({ left: 0, behavior: "instant" });
|
|
116
121
|
}, { debounce: 500 });
|
|
117
122
|
const scrollState = useScroll(scrollBox);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
const {
|
|
124
|
+
pause: pauseStyleChanges,
|
|
125
|
+
resume: resumeStyleChanges
|
|
126
|
+
} = watch([scrollState.x, displayBounds], () => {
|
|
127
|
+
queueStyleChanges(props.styleWhenTransiting, props.transitOpacity, props.transitScale);
|
|
128
|
+
debouncedQueueStyleChanges(props.styleWhenTransiting, props.transitOpacity, props.transitScale);
|
|
121
129
|
}, { flush: "sync" });
|
|
122
|
-
|
|
130
|
+
watch(
|
|
131
|
+
[() => props.transitOpacity, () => props.transitScale],
|
|
132
|
+
([styleOpacity, styleScale]) => {
|
|
133
|
+
const areAnyDisabled = !(styleOpacity && styleScale);
|
|
134
|
+
const areAllDisabled = !(styleOpacity || styleScale);
|
|
135
|
+
if (areAnyDisabled) {
|
|
136
|
+
removeStyleChanges(styleOpacity, styleScale);
|
|
137
|
+
} else {
|
|
138
|
+
debouncedQueueStyleChanges(props.styleWhenTransiting, styleOpacity, styleScale);
|
|
139
|
+
}
|
|
140
|
+
if (areAllDisabled) {
|
|
141
|
+
pauseScrollReset();
|
|
142
|
+
pauseStyleChanges();
|
|
143
|
+
} else {
|
|
144
|
+
resumeScrollReset();
|
|
145
|
+
resumeStyleChanges();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
const debouncedQueueStyleChanges = useDebounceFn(queueStyleChanges, 100);
|
|
123
150
|
let queuedFrame = void 0;
|
|
124
|
-
function queueStyleChanges() {
|
|
151
|
+
function queueStyleChanges(transiting, styleOpacity, styleScale) {
|
|
125
152
|
if (queuedFrame) {
|
|
126
153
|
cancelAnimationFrame(queuedFrame);
|
|
127
154
|
queuedFrame = void 0;
|
|
128
155
|
}
|
|
129
156
|
queuedFrame = requestAnimationFrame(() => {
|
|
130
|
-
applyStyleChanges();
|
|
157
|
+
applyStyleChanges(transiting, styleOpacity, styleScale);
|
|
131
158
|
queuedFrame = void 0;
|
|
132
159
|
});
|
|
133
160
|
}
|
|
134
|
-
function applyStyleChanges() {
|
|
135
|
-
const styleLeft =
|
|
136
|
-
const styleRight =
|
|
161
|
+
function applyStyleChanges(transiting, styleOpacity, styleScale) {
|
|
162
|
+
const styleLeft = transiting === "both" || transiting === "left";
|
|
163
|
+
const styleRight = transiting === "both" || transiting === "right";
|
|
137
164
|
for (const element of scrollItemElements.value) {
|
|
138
165
|
const [percentage, direction] = percentInBounds(element, displayBounds.value);
|
|
139
166
|
if (direction === "none") {
|
|
140
|
-
|
|
141
|
-
|
|
167
|
+
if (styleOpacity) {
|
|
168
|
+
element.style.opacity = "1";
|
|
169
|
+
}
|
|
170
|
+
if (styleScale) {
|
|
171
|
+
element.style.scale = "1";
|
|
172
|
+
}
|
|
142
173
|
} else if (direction === "left" && styleLeft || direction === "right" && styleRight) {
|
|
143
|
-
|
|
144
|
-
|
|
174
|
+
if (styleOpacity) {
|
|
175
|
+
element.style.opacity = percentage.toString();
|
|
176
|
+
}
|
|
177
|
+
if (styleScale && element.firstElementChild instanceof HTMLElement) {
|
|
145
178
|
element.firstElementChild.style.transformOrigin = `center ${direction === "left" ? "right" : "left"}`;
|
|
146
179
|
element.firstElementChild.style.scale = (1 - 0.2 * (1 - percentage)).toString();
|
|
147
180
|
}
|
|
148
181
|
}
|
|
149
182
|
}
|
|
150
183
|
}
|
|
184
|
+
function removeStyleChanges(styleOpacity, styleScale) {
|
|
185
|
+
for (const element of scrollItemElements.value) {
|
|
186
|
+
if (!styleOpacity) {
|
|
187
|
+
element.style.opacity = "";
|
|
188
|
+
}
|
|
189
|
+
if (!styleScale && element.firstElementChild instanceof HTMLElement) {
|
|
190
|
+
element.firstElementChild.style.transformOrigin = "";
|
|
191
|
+
element.firstElementChild.style.scale = "";
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
151
195
|
function percentInBounds(element, { x1, x2, x3, x4 }) {
|
|
152
196
|
const {
|
|
153
197
|
left: elementStart,
|
|
@@ -9,6 +9,8 @@ export type CardScrollerProps<T> = {
|
|
|
9
9
|
centerAlign?: boolean;
|
|
10
10
|
toPageContainerEdge?: boolean;
|
|
11
11
|
styleWhenTransiting?: 'left' | 'right' | 'both';
|
|
12
|
+
transitOpacity?: boolean;
|
|
13
|
+
transitScale?: boolean;
|
|
12
14
|
};
|
|
13
15
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
14
16
|
props: __VLS_PrettifyLocal<CardScrollerProps<T>> & import("vue").PublicProps & (typeof globalThis extends {
|
|
@@ -19,5 +19,5 @@ const props = defineProps({
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<style scoped>
|
|
22
|
-
@reference "tailwindcss";@layer components{:global(:root){--page-column-gutter:calc(var(--spacing)*3);--page-column-pad-y:calc(var(--spacing)*12);--page-column-pad-vista:calc(var(--spacing)*52)}.page-column{margin-left:auto;margin-right:auto;padding:var(--page-column-gutter)}.page-column.layout-main:where(:has(:first-child.page-container)){padding-bottom:0;padding-top:0}.page-column.layout-vista:where(:has(:last-child.page-container)){padding-bottom:0}@variant sm{.page-column{max-width:var(--container-3xl)}.page-column.layout-main{padding-top:var(--page-column-pad-y)}.page-column.layout-main,.page-column.layout-vista{padding-bottom:var(--page-column-pad-y)}}@variant lg{.page-column{max-width:var(--container-5xl)}.page-column.layout-vista{padding-top:var(--page-column-pad-vista)}}@variant portrait{.page-column.layout-vista{padding-top:min(calc(var(--spacing)*52),calc(56.25vw - 110px))}}}
|
|
22
|
+
@reference "tailwindcss";@layer components{:global(:root){--page-column-gutter:calc(var(--spacing)*3);--page-column-pad-y:calc(var(--spacing)*12);--page-column-pad-vista:calc(var(--spacing)*52)}.page-column{margin-left:auto;margin-right:auto;padding:var(--page-column-gutter)}.page-column.layout-main:where(:has(:first-child.page-container)){padding-bottom:0;padding-top:0}.page-column.layout-vista:where(:has(:last-child.page-container)){padding-bottom:0}@variant sm{.page-column{max-width:var(--container-3xl)}.page-column.layout-main{padding-top:var(--page-column-pad-y)}.page-column.layout-main,.page-column.layout-vista{padding-bottom:var(--page-column-pad-y)}}@variant lg{.page-column{max-width:var(--container-5xl)}.page-column.layout-vista{padding-top:var(--page-column-pad-vista)}}:global(.page-column-xl){@variant xl{.page-column{max-width:var(--container-7xl)}}}@variant portrait{.page-column.layout-vista{padding-top:min(calc(var(--spacing)*52),calc(56.25vw - 110px))}}}
|
|
23
23
|
</style>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
<PrimeForm
|
|
24
24
|
v-slot = "$form"
|
|
25
|
+
v-bind = "$attrs"
|
|
25
26
|
ref = "form"
|
|
26
27
|
novalidate = "true"
|
|
27
28
|
:validate-on-mount = "true"
|
|
@@ -59,6 +60,9 @@ import LazySuccessSplash from "../SuccessSplash.vue";
|
|
|
59
60
|
import LazyMessage from "../Message.vue";
|
|
60
61
|
import { useReactiveObjectsSync } from "../../composables/use-reactive-objects-sync";
|
|
61
62
|
import { provideFormInstance, getValuesFromFormState } from "../../utils/form";
|
|
63
|
+
defineOptions({
|
|
64
|
+
inheritAttrs: false
|
|
65
|
+
});
|
|
62
66
|
const props = defineProps({
|
|
63
67
|
disabled: { type: Boolean, required: false, default: false },
|
|
64
68
|
onSubmit: { type: [Function, Array], required: false, default: void 0 },
|
package/package.json
CHANGED