@wix/site-service-interactions 1.0.34 → 1.0.36
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/cjs/build/implementations/coreInteractions.js +38 -10
- package/cjs/build/implementations/coreInteractions.js.map +1 -1
- package/cjs/build/implementations/v2/BundledInteractions.d.ts +8 -0
- package/cjs/build/implementations/v2/BundledInteractions.js +69 -0
- package/cjs/build/implementations/v2/BundledInteractions.js.map +1 -0
- package/cjs/build/implementations/v2/ConfigStyleSheet.d.ts +17 -0
- package/cjs/build/implementations/v2/{ClickTriggerStyleSheet.js → ConfigStyleSheet.js} +8 -7
- package/cjs/build/implementations/v2/ConfigStyleSheet.js.map +1 -0
- package/cjs/build/implementations/v2/InteractionsScriptElement.d.ts +1 -1
- package/cjs/build/implementations/v2/InteractionsScriptElement.js +3 -3
- package/cjs/build/implementations/v2/InteractionsScriptElement.js.map +1 -1
- package/cjs/build/implementations/v2/backgroundScrollCss.d.ts +2 -0
- package/cjs/build/implementations/v2/backgroundScrollCss.js +169 -0
- package/cjs/build/implementations/v2/backgroundScrollCss.js.map +1 -0
- package/cjs/build/implementations/v2/configCss.d.ts +2 -0
- package/cjs/build/implementations/v2/configCss.js +11 -6
- package/cjs/build/implementations/v2/configCss.js.map +1 -1
- package/dist/implementations/coreInteractions.js +39 -11
- package/dist/implementations/coreInteractions.js.map +1 -1
- package/dist/implementations/v2/BundledInteractions.d.ts +8 -0
- package/dist/implementations/v2/BundledInteractions.js +32 -0
- package/dist/implementations/v2/BundledInteractions.js.map +1 -0
- package/dist/implementations/v2/ConfigStyleSheet.d.ts +17 -0
- package/dist/implementations/v2/{ClickTriggerStyleSheet.js → ConfigStyleSheet.js} +6 -5
- package/dist/implementations/v2/ConfigStyleSheet.js.map +1 -0
- package/dist/implementations/v2/InteractionsScriptElement.d.ts +1 -1
- package/dist/implementations/v2/InteractionsScriptElement.js +3 -3
- package/dist/implementations/v2/InteractionsScriptElement.js.map +1 -1
- package/dist/implementations/v2/backgroundScrollCss.d.ts +2 -0
- package/dist/implementations/v2/backgroundScrollCss.js +165 -0
- package/dist/implementations/v2/backgroundScrollCss.js.map +1 -0
- package/dist/implementations/v2/configCss.d.ts +2 -0
- package/dist/implementations/v2/configCss.js +8 -3
- package/dist/implementations/v2/configCss.js.map +1 -1
- package/package.json +2 -2
- package/src/implementations/coreInteractions.ts +48 -11
- package/src/implementations/v2/BundledInteractions.tsx +36 -0
- package/src/implementations/v2/{ClickTriggerStyleSheet.tsx → ConfigStyleSheet.tsx} +5 -4
- package/src/implementations/v2/InteractionsScriptElement.tsx +3 -3
- package/src/implementations/v2/backgroundScrollCss.ts +208 -0
- package/src/implementations/v2/configCss.ts +9 -3
- package/cjs/build/implementations/v2/ClickTriggerStyleSheet.d.ts +0 -16
- package/cjs/build/implementations/v2/ClickTriggerStyleSheet.js.map +0 -1
- package/dist/implementations/v2/ClickTriggerStyleSheet.d.ts +0 -16
- package/dist/implementations/v2/ClickTriggerStyleSheet.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import type { FunctionComponent } from 'react'
|
|
3
|
+
import type { InteractConfig } from '../../definition'
|
|
4
|
+
import { Interact } from './configCss'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The page's interactions with the bundled runtime, for the editor, which renders pages only in the browser: the CSS
|
|
8
|
+
* the server would send in the head renders with the page, so its first paint already animates, and the instances are
|
|
9
|
+
* the page's own.
|
|
10
|
+
*/
|
|
11
|
+
export const createBundledV2Interactions =
|
|
12
|
+
(configs: InteractConfig[], isReducedMotion: boolean, css: string): FunctionComponent =>
|
|
13
|
+
() => {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
Interact.forceReducedMotion = isReducedMotion
|
|
16
|
+
Interact.setup({
|
|
17
|
+
scrollOptionsGetter: () => document.getElementById('site-root'),
|
|
18
|
+
allowA11yTriggers: true,
|
|
19
|
+
viewEnter: {
|
|
20
|
+
useSafeViewEnter: true,
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
// The editor's config can be mid-edit: a config that fails is skipped rather than taking the page down with it
|
|
24
|
+
const instances = configs.flatMap((config) => {
|
|
25
|
+
try {
|
|
26
|
+
return [Interact.create(config)]
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Failed running an interactions config', error)
|
|
29
|
+
return []
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
return () => instances.forEach((instance) => instance.destroy())
|
|
33
|
+
}, [])
|
|
34
|
+
|
|
35
|
+
return <style>{css}</style>
|
|
36
|
+
}
|
|
@@ -37,11 +37,12 @@ export const adoptMissingStyleSheet = (
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* The server sends the
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* The server sends the rules it derives from the config (click-trigger cursors, background scroll
|
|
41
|
+
* sizing) in the head only for what it rendered, so content rendered on the client (client-side
|
|
42
|
+
* navigation, password-protected / members-only pages, a host that renders only on the client) never
|
|
43
|
+
* gets them. Adopt the missing ones while the page is mounted and remove them when navigating away.
|
|
43
44
|
*/
|
|
44
|
-
export const
|
|
45
|
+
export const ConfigStyleSheet: FunctionComponent<{ rules: Array<string> }> = ({ rules }) => {
|
|
45
46
|
useEffect(() => adoptMissingStyleSheet(rules), [rules])
|
|
46
47
|
|
|
47
48
|
return null
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
3
|
import type { InteractConfig } from '@wix/interact'
|
|
4
4
|
import { reviveScriptElement } from '../reviveScriptElement'
|
|
5
|
-
import {
|
|
5
|
+
import { ConfigStyleSheet } from './ConfigStyleSheet'
|
|
6
6
|
import { getV2InteractionsScriptContent } from './interactionsScriptContent'
|
|
7
7
|
|
|
8
8
|
const DANGEROUSLY_SET_INNER_HTML = ['dangerously', 'Set', 'Inner', 'HTML']
|
|
@@ -19,7 +19,7 @@ export const createV2InteractionsScriptElement =
|
|
|
19
19
|
config: InteractConfig | InteractConfig[],
|
|
20
20
|
isReducedMotion: boolean,
|
|
21
21
|
pageId: string,
|
|
22
|
-
|
|
22
|
+
configCss: Array<string> = []
|
|
23
23
|
): FunctionComponent =>
|
|
24
24
|
() => {
|
|
25
25
|
// This ID is also interpolated into raw module-script text. Percent-encoding removes
|
|
@@ -38,7 +38,7 @@ export const createV2InteractionsScriptElement =
|
|
|
38
38
|
<>
|
|
39
39
|
<script type="application/json" id={configId} {...configProps} />
|
|
40
40
|
<script type="module" id={`interactions-loader-${safePageId}`} ref={reviveScriptElement} {...loaderProps} />
|
|
41
|
-
{
|
|
41
|
+
{configCss.length > 0 && <ConfigStyleSheet rules={configCss} />}
|
|
42
42
|
</>
|
|
43
43
|
)
|
|
44
44
|
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { Condition, Effect, InteractConfig } from '@wix/interact'
|
|
2
|
+
import { LEGACY_PREFIX } from './motionPresets'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The legacy background scroll presets, which the reactions config names with the `LEGACY_` prefix, animate the
|
|
6
|
+
* parts of a background, `BG_MEDIA` and `BG_IMG`, and expect them sized for the effect first: a media layer tall
|
|
7
|
+
* enough to travel, a sticky image that imitates a fixed background. Thunderbolt renders that sizing from the page
|
|
8
|
+
* data (thunderbolt-catharsis-extensions motionCss, viewer branch); nothing in the interact config says it, so a
|
|
9
|
+
* host without Thunderbolt plays these presets on unsized parts. These are the same rules, computed from the config.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
type Style = Record<string, string>
|
|
13
|
+
type NamedEffect = { type: string; [param: string]: unknown }
|
|
14
|
+
|
|
15
|
+
const BG_SKEW_ANGLE = 20
|
|
16
|
+
const BG_ROTATE_ANGLE = 22
|
|
17
|
+
const BG_PAN_SPEED = 0.2
|
|
18
|
+
const IMAGE_PARALLAX_SPEED = 1.5
|
|
19
|
+
|
|
20
|
+
// Mimics `position: fixed` with sticky positioning, which keeps working inside a transform or an overflow.
|
|
21
|
+
const FIXED_MEDIA_STYLE: Style = {
|
|
22
|
+
'will-change': 'var(--motion-bgreveal-will-change)',
|
|
23
|
+
height: 'calc(100% + 200lvh)',
|
|
24
|
+
'margin-top': '-100lvh',
|
|
25
|
+
overflow: 'clip',
|
|
26
|
+
// a media rendered as a background image needs its own stacking context in some browsers
|
|
27
|
+
isolation: 'isolate',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const FIXED_IMG_STYLE: Style = {
|
|
31
|
+
position: 'sticky',
|
|
32
|
+
height: 'max(100lvh, calc(100% - 200lvh))',
|
|
33
|
+
width: '100%',
|
|
34
|
+
top: '0px',
|
|
35
|
+
'margin-bottom': 'calc(100lvh - max(100lvh, var(--motion-comp-height, 100%)))',
|
|
36
|
+
display: 'block',
|
|
37
|
+
padding: '0px',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const FILL_STYLE: Style = { height: '100%', width: '100%', position: 'absolute' }
|
|
41
|
+
|
|
42
|
+
// Firefox breaks the sticky imitation without it, https://bugzilla.mozilla.org/show_bug.cgi?id=1791232. It only
|
|
43
|
+
// defines the variable the fixed media style reads, so it is always rendered.
|
|
44
|
+
const FIREFOX_CSS = '@supports (-moz-appearance: none) {\nbody {\n--motion-bgreveal-will-change: transform;\n}\n}'
|
|
45
|
+
|
|
46
|
+
const toRadians = (degrees: number) => (degrees * Math.PI) / 180
|
|
47
|
+
const numberParam = (namedEffect: NamedEffect, name: string, fallback: number) =>
|
|
48
|
+
typeof namedEffect[name] === 'number' && namedEffect[name] ? (namedEffect[name] as number) : fallback
|
|
49
|
+
|
|
50
|
+
const isFixedStyle = (namedEffect: NamedEffect) =>
|
|
51
|
+
(namedEffect.type === 'BgZoom' && namedEffect.direction === 'in') ||
|
|
52
|
+
['BgReveal', 'BgParallax', 'BgFake3D'].includes(namedEffect.type)
|
|
53
|
+
|
|
54
|
+
const MEDIA_STYLES: Record<string, (namedEffect: NamedEffect) => Style> = {
|
|
55
|
+
BgParallax: () => FIXED_MEDIA_STYLE,
|
|
56
|
+
BgReveal: () => FIXED_MEDIA_STYLE,
|
|
57
|
+
BgFake3D: () => FIXED_MEDIA_STYLE,
|
|
58
|
+
BgSkew: (namedEffect) => {
|
|
59
|
+
const tan = Math.tan(toRadians(numberParam(namedEffect, 'angle', BG_SKEW_ANGLE)))
|
|
60
|
+
return { 'padding-bottom': `${(100 * tan).toFixed(3)}%`, 'margin-top': `${(-50 * tan).toFixed(3)}%` }
|
|
61
|
+
},
|
|
62
|
+
BgRotate: (namedEffect) => {
|
|
63
|
+
const angle = toRadians(numberParam(namedEffect, 'angle', BG_ROTATE_ANGLE))
|
|
64
|
+
const cos = (100 * Math.cos(angle)).toFixed(3)
|
|
65
|
+
const sin = (100 * Math.sin(angle)).toFixed(3)
|
|
66
|
+
return {
|
|
67
|
+
width: `max(100%, calc(${cos}cqw + ${sin}cqh))`,
|
|
68
|
+
height: `max(100%, calc(${sin}cqw + ${cos}cqh))`,
|
|
69
|
+
translate: 'calc(50cqw - 50%) calc(50cqh - 50%)',
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
BgPan: (namedEffect) => {
|
|
73
|
+
const speed = numberParam(namedEffect, 'speed', BG_PAN_SPEED)
|
|
74
|
+
return { position: 'relative', width: `${100 * (1 + speed)}%`, left: `-${50 * speed}%` }
|
|
75
|
+
},
|
|
76
|
+
BgZoom: (namedEffect) =>
|
|
77
|
+
isFixedStyle(namedEffect)
|
|
78
|
+
? FIXED_MEDIA_STYLE
|
|
79
|
+
: { position: 'relative', width: '115%', height: '115%', left: '-7.5%', top: '-7.5%' },
|
|
80
|
+
ImageParallax: (namedEffect) => ({
|
|
81
|
+
height: `${100 * numberParam(namedEffect, 'speed', IMAGE_PARALLAX_SPEED)}%`,
|
|
82
|
+
position: 'relative',
|
|
83
|
+
}),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const IMG_STYLES: Record<string, (namedEffect: NamedEffect) => Style> = {
|
|
87
|
+
BgParallax: () => FIXED_IMG_STYLE,
|
|
88
|
+
BgReveal: () => FIXED_IMG_STYLE,
|
|
89
|
+
BgFake3D: () => FIXED_IMG_STYLE,
|
|
90
|
+
BgZoom: (namedEffect) => (isFixedStyle(namedEffect) ? FIXED_IMG_STYLE : {}),
|
|
91
|
+
BgSkew: () => FILL_STYLE,
|
|
92
|
+
ImageParallax: () => FILL_STYLE,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const BACKGROUND_SCROLL_EFFECTS = new Set([
|
|
96
|
+
'BgCloseUp',
|
|
97
|
+
'BgFade',
|
|
98
|
+
'BgFadeBack',
|
|
99
|
+
'BgPullBack',
|
|
100
|
+
...Object.keys(MEDIA_STYLES),
|
|
101
|
+
...Object.keys(IMG_STYLES),
|
|
102
|
+
])
|
|
103
|
+
|
|
104
|
+
const escapeCssAttr = (value: string): string => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
|
|
105
|
+
|
|
106
|
+
const rule = (selector: string, style: Style): string =>
|
|
107
|
+
`${selector} {\n${Object.entries(style)
|
|
108
|
+
.map(([property, value]) => `${property}: ${value};`)
|
|
109
|
+
.join('\n')}\n}`
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Keys are comp paths, so the last segment is the comp id. A part carries `<PART> <comp id>`, and a repeated
|
|
113
|
+
* comp's id carries its item, `<comp id>__<item>`, on the root and on its parts alike.
|
|
114
|
+
*/
|
|
115
|
+
const getSelectors = (key: string, selectorConditions: string) => {
|
|
116
|
+
const compId = escapeCssAttr(key.slice(key.lastIndexOf('/') + 1))
|
|
117
|
+
const root = `:is([id="${compId}"], [id^="${compId}__"])${selectorConditions}`
|
|
118
|
+
const part = (name: string) =>
|
|
119
|
+
`:is([data-motion-part="${name} ${compId}"], [data-motion-part^="${name} ${compId}__"])`
|
|
120
|
+
// Every part is matched under the root, as Thunderbolt does, so a root that is itself the layer is not matched.
|
|
121
|
+
return {
|
|
122
|
+
layer: `${root} ${part('BG_LAYER')}`,
|
|
123
|
+
media: `${root} ${part('BG_MEDIA')}`,
|
|
124
|
+
image: `${root}:not([data-show-canvas]) ${part('BG_IMG')}, ${root}[data-has-alpha="true"] canvas`,
|
|
125
|
+
imageXMedia: `${root}[data-testid="imageX"] ${part('BG_MEDIA')}`,
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const getEffectRules = (namedEffect: NamedEffect, key: string, selectorConditions: string): string[] => {
|
|
130
|
+
const selectors = getSelectors(key, selectorConditions)
|
|
131
|
+
const mediaStyle = MEDIA_STYLES[namedEffect.type]?.(namedEffect)
|
|
132
|
+
const imgStyle = IMG_STYLES[namedEffect.type]?.(namedEffect)
|
|
133
|
+
const isRotate = namedEffect.type === 'BgRotate'
|
|
134
|
+
const rules = [
|
|
135
|
+
...(mediaStyle ? [rule(selectors.media, mediaStyle)] : []),
|
|
136
|
+
...(imgStyle && Object.keys(imgStyle).length ? [rule(selectors.image, imgStyle)] : []),
|
|
137
|
+
rule(selectors.layer, { overflow: 'clip', contain: 'layout', ...(isRotate && { 'container-type': 'size' }) }),
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
if (isRotate) {
|
|
141
|
+
const angle = toRadians(numberParam(namedEffect, 'angle', BG_ROTATE_ANGLE))
|
|
142
|
+
const grow = (100 * (Math.sqrt(1 + Math.tan(angle) ** 2) - 1)).toFixed(3)
|
|
143
|
+
const sin = (100 * Math.sin(angle)).toFixed(3)
|
|
144
|
+
rules.push(
|
|
145
|
+
`@container (min-aspect-ratio: ${Math.tan(Math.PI / 2 - angle).toFixed(3)}) {\n${rule(selectors.media, {
|
|
146
|
+
width: `calc(100% + min(${grow}%, ${sin}cqh))`,
|
|
147
|
+
})}\n}`,
|
|
148
|
+
`@container (max-aspect-ratio: ${Math.tan(angle).toFixed(3)}) {\n${rule(selectors.media, {
|
|
149
|
+
height: `calc(100% + min(${grow}%, ${sin}cqw))`,
|
|
150
|
+
})}\n}`
|
|
151
|
+
)
|
|
152
|
+
} else if (isFixedStyle(namedEffect)) {
|
|
153
|
+
// Safari has a bug like Firefox's for an ImageX media; a transform solves it
|
|
154
|
+
rules.push(rule(selectors.imageXMedia, { transform: 'translate3d(0,0,0)' }))
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return rules
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const getConditions = (interact: InteractConfig, conditionIds: readonly string[]) => {
|
|
161
|
+
const conditions = [...new Set(conditionIds)]
|
|
162
|
+
.map((id) => interact.conditions?.[id])
|
|
163
|
+
.filter((condition): condition is Condition => Boolean(condition?.predicate))
|
|
164
|
+
const predicatesOf = (type: Condition['type']) =>
|
|
165
|
+
conditions.filter((condition) => condition.type === type).map(({ predicate }) => predicate)
|
|
166
|
+
const media = predicatesOf('media')
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
media: media.length ? `(${media.join(') and (')})` : '',
|
|
170
|
+
selector: predicatesOf('selector')
|
|
171
|
+
.map((predicate) => `:is(${predicate})`)
|
|
172
|
+
.join(''),
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const toMediaBlock = ([media, rules]: [string, Set<string>]): string =>
|
|
177
|
+
media ? `@media ${media} {\n${[...rules].join('\n')}\n}` : [...rules].join('\n')
|
|
178
|
+
|
|
179
|
+
export const getBackgroundScrollCss = (interact: InteractConfig): string => {
|
|
180
|
+
const rulesByMedia = new Map<string, Set<string>>()
|
|
181
|
+
|
|
182
|
+
for (const interaction of interact.interactions) {
|
|
183
|
+
// sequences don't play scrub animations, so a background scroll preset is only ever an interaction's effect
|
|
184
|
+
for (const inlineEffect of interaction.effects ?? []) {
|
|
185
|
+
// an effectId points at interact.effects; the inline fields override it, as interact reads them
|
|
186
|
+
const effect = {
|
|
187
|
+
...(inlineEffect.effectId ? interact.effects?.[inlineEffect.effectId] : undefined),
|
|
188
|
+
...inlineEffect,
|
|
189
|
+
} as Effect
|
|
190
|
+
const { namedEffect } = effect as { namedEffect?: NamedEffect }
|
|
191
|
+
const key = effect.key ?? interaction.key
|
|
192
|
+
const type = namedEffect?.type?.startsWith(LEGACY_PREFIX)
|
|
193
|
+
? namedEffect.type.slice(LEGACY_PREFIX.length)
|
|
194
|
+
: undefined
|
|
195
|
+
if (!namedEffect || !type || !BACKGROUND_SCROLL_EFFECTS.has(type) || !key) {
|
|
196
|
+
continue
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const params = { ...namedEffect, type }
|
|
200
|
+
const conditions = getConditions(interact, [...(interaction.conditions ?? []), ...(effect.conditions ?? [])])
|
|
201
|
+
const rules = rulesByMedia.get(conditions.media) ?? new Set<string>()
|
|
202
|
+
getEffectRules(params, key, conditions.selector).forEach((css) => rules.add(css))
|
|
203
|
+
rulesByMedia.set(conditions.media, rules)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return `@media (prefers-reduced-motion: no-preference) {\n${[...[...rulesByMedia].map(toMediaBlock), FIREFOX_CSS].join('\n')}\n}`
|
|
208
|
+
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as allLegacyPresets from '@wix/wix-motion-presets'
|
|
2
2
|
import * as allPresets from '@wix/motion-presets'
|
|
3
|
-
|
|
3
|
+
// Through the namespace: web.js only re-exports the core and installs `Interact.defineInteractElement`, which
|
|
4
|
+
// `Interact.create` needs to run on `<interact-element>`. With named imports, a bundler that trusts the package's
|
|
5
|
+
// `sideEffects: false` links them past web.js to the core and drops it.
|
|
6
|
+
import * as interactWeb from '@wix/interact/web'
|
|
4
7
|
import type { InteractConfig } from '@wix/interact'
|
|
5
8
|
import { getClickTriggerCss } from './clickTriggerCss'
|
|
6
9
|
import { LEGACY_PREFIX } from './motionPresets'
|
|
7
10
|
|
|
11
|
+
const { generate } = interactWeb
|
|
12
|
+
export const { Interact } = interactWeb
|
|
13
|
+
|
|
8
14
|
type PresetRegistry = Parameters<typeof Interact.registerEffects>[0]
|
|
9
15
|
|
|
10
16
|
type EffectModule = {
|
|
@@ -32,8 +38,8 @@ export const motionPresets: Record<string, EffectModule> = {
|
|
|
32
38
|
...getPresetModules(allLegacyPresets, LEGACY_PREFIX),
|
|
33
39
|
}
|
|
34
40
|
|
|
35
|
-
// Interact's registry is process-global.
|
|
36
|
-
//
|
|
41
|
+
// Interact's registry is process-global. Only the server's bundle and the editor's pull this module in (`process.env`
|
|
42
|
+
// DCE), so both namespaces are registered once per Node process or document.
|
|
37
43
|
Interact.registerEffects(motionPresets as unknown as PresetRegistry)
|
|
38
44
|
|
|
39
45
|
/** Emit animation FOUC CSS and click-trigger cursor rules. */
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'react';
|
|
2
|
-
type StyleSheetDocument = Pick<Document, 'adoptedStyleSheets' | 'querySelectorAll'>;
|
|
3
|
-
/**
|
|
4
|
-
* Adopts the rules the server did not already send as a constructable stylesheet, and returns a
|
|
5
|
-
* function that removes that sheet again.
|
|
6
|
-
*/
|
|
7
|
-
export declare const adoptMissingStyleSheet: (rules: Array<string>, document?: StyleSheetDocument | undefined) => () => void;
|
|
8
|
-
/**
|
|
9
|
-
* The server sends the click-trigger cursor rules in the head only for what it rendered, so content
|
|
10
|
-
* rendered on the client (client-side navigation, password-protected / members-only pages) never gets
|
|
11
|
-
* them. Adopt the missing ones while the page is mounted and remove them when navigating away.
|
|
12
|
-
*/
|
|
13
|
-
export declare const ClickTriggerStyleSheet: FunctionComponent<{
|
|
14
|
-
rules: Array<string>;
|
|
15
|
-
}>;
|
|
16
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickTriggerStyleSheet.js","sourceRoot":"","sources":["../../../../src/implementations/v2/ClickTriggerStyleSheet.tsx"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,qEAA8D;AAI9D,MAAM,oBAAoB,GAAG,CAAC,QAA4B,EAAU,EAAE,CACrE,KAAK,CAAC,IAAI,CAAC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AAG,EAAE,CAAC,IAAA,QAAA,sBAAsB,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEvD,OAAO,IAAI,CAAA;AACZ,CAAC,CAAA;AAJY,QAAA,sBAAsB,GAAtB,sBAAsB,CAIlC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'react';
|
|
2
|
-
type StyleSheetDocument = Pick<Document, 'adoptedStyleSheets' | 'querySelectorAll'>;
|
|
3
|
-
/**
|
|
4
|
-
* Adopts the rules the server did not already send as a constructable stylesheet, and returns a
|
|
5
|
-
* function that removes that sheet again.
|
|
6
|
-
*/
|
|
7
|
-
export declare const adoptMissingStyleSheet: (rules: Array<string>, document?: StyleSheetDocument | undefined) => () => void;
|
|
8
|
-
/**
|
|
9
|
-
* The server sends the click-trigger cursor rules in the head only for what it rendered, so content
|
|
10
|
-
* rendered on the client (client-side navigation, password-protected / members-only pages) never gets
|
|
11
|
-
* them. Adopt the missing ones while the page is mounted and remove them when navigating away.
|
|
12
|
-
*/
|
|
13
|
-
export declare const ClickTriggerStyleSheet: FunctionComponent<{
|
|
14
|
-
rules: Array<string>;
|
|
15
|
-
}>;
|
|
16
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickTriggerStyleSheet.js","sourceRoot":"","sources":["../../../src/implementations/v2/ClickTriggerStyleSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAI9D,MAAM,oBAAoB,GAAG,CAAC,QAA4B,EAAU,EAAE,CACrE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,mBAAmB,GAAG,CAAC,CAAC;KACpE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;KACvC,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