@wix/interact 1.92.0 → 1.93.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.
Files changed (41) hide show
  1. package/dist/cjs/InteractElement.js +1 -0
  2. package/dist/cjs/InteractElement.js.map +1 -1
  3. package/dist/cjs/__tests__/interact.spec.js +164 -0
  4. package/dist/cjs/__tests__/interact.spec.js.map +1 -1
  5. package/dist/cjs/core/add.js +12 -8
  6. package/dist/cjs/core/add.js.map +1 -1
  7. package/dist/cjs/handlers/animationEnd.js +4 -0
  8. package/dist/cjs/handlers/animationEnd.js.map +1 -1
  9. package/dist/cjs/handlers/click.js +9 -3
  10. package/dist/cjs/handlers/click.js.map +1 -1
  11. package/dist/cjs/handlers/hover.js +9 -3
  12. package/dist/cjs/handlers/hover.js.map +1 -1
  13. package/dist/cjs/handlers/viewEnter.js +4 -0
  14. package/dist/cjs/handlers/viewEnter.js.map +1 -1
  15. package/dist/cjs/handlers/viewProgress.js +22 -8
  16. package/dist/cjs/handlers/viewProgress.js.map +1 -1
  17. package/dist/cjs/types.js.map +1 -1
  18. package/dist/cjs/utils.js +34 -4
  19. package/dist/cjs/utils.js.map +1 -1
  20. package/dist/esm/InteractElement.js +1 -0
  21. package/dist/esm/InteractElement.js.map +1 -1
  22. package/dist/esm/__tests__/interact.spec.js +165 -0
  23. package/dist/esm/__tests__/interact.spec.js.map +1 -1
  24. package/dist/esm/core/add.js +13 -9
  25. package/dist/esm/core/add.js.map +1 -1
  26. package/dist/esm/handlers/animationEnd.js +4 -0
  27. package/dist/esm/handlers/animationEnd.js.map +1 -1
  28. package/dist/esm/handlers/click.js +9 -3
  29. package/dist/esm/handlers/click.js.map +1 -1
  30. package/dist/esm/handlers/hover.js +9 -3
  31. package/dist/esm/handlers/hover.js.map +1 -1
  32. package/dist/esm/handlers/viewEnter.js +4 -0
  33. package/dist/esm/handlers/viewEnter.js.map +1 -1
  34. package/dist/esm/handlers/viewProgress.js +22 -8
  35. package/dist/esm/handlers/viewProgress.js.map +1 -1
  36. package/dist/esm/types.js.map +1 -1
  37. package/dist/esm/utils.js +33 -4
  38. package/dist/esm/utils.js.map +1 -1
  39. package/dist/types/types.d.ts +3 -1
  40. package/dist/types/utils.d.ts +2 -1
  41. package/package.json +2 -2
package/dist/esm/utils.js CHANGED
@@ -1,4 +1,15 @@
1
1
  import { getEasing } from '@wix/motion';
2
+ /**
3
+ * Applies a selector condition predicate to a base selector.
4
+ * - If `&` is in the predicate, replace `&` with the base selector
5
+ * - If no `&`, assume `&<predicate>` (append predicate to base selector)
6
+ */
7
+ function applySelectorCondition(baseSelector, predicate) {
8
+ if (predicate.includes('&')) {
9
+ return predicate.replace(/&/g, baseSelector);
10
+ }
11
+ return `${baseSelector}${predicate}`;
12
+ }
2
13
  export function generateId() {
3
14
  return 'wi-12343210'.replace(/\d/g, c => String.fromCharCode((+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4) + 97) // 97 for "a"
4
15
  );
@@ -10,7 +21,8 @@ export function createTransitionCSS(_ref) {
10
21
  effectId,
11
22
  transition,
12
23
  properties,
13
- childSelector = '> :first-child'
24
+ childSelector = '> :first-child',
25
+ selectorCondition
14
26
  } = _ref;
15
27
  let transitions = [];
16
28
  if (transition != null && transition.styleProperties) {
@@ -35,13 +47,21 @@ export function createTransitionCSS(_ref) {
35
47
  }
36
48
  const styleProperties = ((_properties2 = properties) == null ? void 0 : _properties2.map(property => `${property.name}: ${property.value};`)) || [];
37
49
  const escapedKey = key.replace(/"/g, "'");
38
- const result = [`:is(:state(${effectId}), :--${effectId}) ${childSelector},
39
- [data-interact-effect~="${effectId}"] ${childSelector} {
50
+
51
+ // Build selectors, applying condition if present
52
+ const stateSelector = `:is(:state(${effectId}), :--${effectId}) ${childSelector}`;
53
+ const dataAttrSelector = `[data-interact-effect~="${effectId}"] ${childSelector}`;
54
+ const finalStateSelector = selectorCondition ? applySelectorCondition(stateSelector, selectorCondition) : stateSelector;
55
+ const finalDataAttrSelector = selectorCondition ? applySelectorCondition(dataAttrSelector, selectorCondition) : dataAttrSelector;
56
+ const result = [`${finalStateSelector},
57
+ ${finalDataAttrSelector} {
40
58
  ${styleProperties.join(`
41
59
  `)}
42
60
  }`];
43
61
  if (transitions.length) {
44
- result.push(`@media (prefers-reduced-motion: no-preference) { [data-interact-key="${escapedKey}"] ${childSelector} {
62
+ const transitionSelector = `[data-interact-key="${escapedKey}"] ${childSelector}`;
63
+ const finalTransitionSelector = selectorCondition ? applySelectorCondition(transitionSelector, selectorCondition) : transitionSelector;
64
+ result.push(`@media (prefers-reduced-motion: no-preference) { ${finalTransitionSelector} {
45
65
  transition: ${transitions.join(', ')};
46
66
  } }`);
47
67
  }
@@ -60,4 +80,13 @@ export function getMediaQuery(conditionNames, conditions) {
60
80
  return mql;
61
81
  }
62
82
  }
83
+ export function getSelectorCondition(conditionNames, conditions) {
84
+ for (const name of conditionNames || []) {
85
+ const condition = conditions[name];
86
+ if ((condition == null ? void 0 : condition.type) === 'selector' && condition.predicate) {
87
+ return condition.predicate;
88
+ }
89
+ }
90
+ return;
91
+ }
63
92
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getEasing","generateId","replace","c","String","fromCharCode","crypto","getRandomValues","Uint8Array","createTransitionCSS","_ref","_properties2","key","effectId","transition","properties","childSelector","transitions","styleProperties","duration","easing","delay","hasCustomPropertiesTransition","some","styleProperty","name","startsWith","map","_properties","filter","property","value","escapedKey","result","join","length","push","getMediaQuery","conditionNames","conditions","conditionContent","conditionName","_conditions$condition","type","predicate","condition","mql","window","matchMedia"],"sources":["../../src/utils.ts"],"sourcesContent":["import { getEasing } from '@wix/motion';\nimport type { Condition, CreateTransitionCSSParams } from './types';\n\nexport function generateId() {\n return 'wi-12343210'.replace(\n /\\d/g,\n (c) =>\n String.fromCharCode(\n (+c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))) +\n 97,\n ), // 97 for \"a\"\n );\n}\n\nexport function createTransitionCSS({\n key,\n effectId,\n transition,\n properties,\n childSelector = '> :first-child',\n}: CreateTransitionCSSParams): string[] {\n let transitions: string[] = [];\n\n if (transition?.styleProperties) {\n const { duration, easing, delay } = transition;\n\n if (duration) {\n const hasCustomPropertiesTransition = transition.styleProperties.some(\n (styleProperty) => styleProperty.name.startsWith('--'),\n );\n\n if (hasCustomPropertiesTransition) {\n // If there are custom properties in the transition, we need to fall back to Viewer's legacy implementation\n transitions = [\n `all ${duration}ms ${getEasing(easing || 'ease')}${\n delay ? ` ${delay}ms` : ''\n }`,\n 'visibility 0s',\n ];\n } else {\n transitions = transition.styleProperties.map(\n (styleProperty) =>\n `${styleProperty.name} ${duration}ms ${getEasing(\n easing || 'ease',\n )}${delay ? ` ${delay}ms` : ''}`,\n );\n }\n }\n\n properties = transition.styleProperties;\n } else {\n transitions =\n properties\n ?.filter((property) => property.duration)\n .map(\n (property) =>\n `${property.name} ${property.duration}ms ${\n getEasing(property.easing) || 'ease'\n }${property.delay ? ` ${property.delay}ms` : ''}`,\n ) || [];\n }\n\n const styleProperties =\n properties?.map((property) => `${property.name}: ${property.value};`) || [];\n const escapedKey = key.replace(/\"/g, \"'\");\n\n const result = [\n `:is(:state(${effectId}), :--${effectId}) ${childSelector},\n [data-interact-effect~=\"${effectId}\"] ${childSelector} {\n ${styleProperties.join(`\n `)}\n }`,\n ];\n\n if (transitions.length) {\n result.push(`@media (prefers-reduced-motion: no-preference) { [data-interact-key=\"${escapedKey}\"] ${childSelector} {\n transition: ${transitions.join(', ')};\n } }`);\n }\n return result;\n}\n\nexport function getMediaQuery(\n conditionNames: string[] | undefined,\n conditions: Record<string, Condition>,\n) {\n const conditionContent = (conditionNames || [])\n .filter((conditionName) => {\n return (\n conditions[conditionName]?.type === 'media' &&\n conditions[conditionName].predicate\n );\n })\n .map((conditionName) => {\n return conditions[conditionName].predicate;\n })\n .join(') and (');\n\n const condition = conditionContent && `(${conditionContent})`;\n const mql = condition && window.matchMedia(cond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C;EACA,MAAMC,gBAAgB,GAAG,CAACF,cAAc,IAAI,EAAE,EAC3CT,MAAM,CAAEY,aAAa,IAAK;IAAA,IAAAC,qBAAA;IACzB,OACE,EAAAA,qBAAA,GAAAH,UAAU,CAACE,aAAa,CAAC,qBAAzBC,qBAAA,CAA2BC,IAAI,MAAK,OAAO,IAC3CJ,UAAU,CAACE,aAAa,CAAC,CAACG,SAAS;EAEvC,CAAC,CAAC,CACDjB,GAAG,CAAEc,aAAa,IAAK;IACtB,OAAOF,UAAU,CAACE,aAAa,CAAC,CAACG,SAAS;EAC5C,CAAC,CAAC,CACDV,IAAI,CAAC,SAAS,CAAC;EAElB,MAAMW,SAAS,GAAGL,gBAAgB,IAAI,IAAIA,gBAAgB,GAAG;EAC7D,MAAMM,GAAG,GAAGD,SAAS,IAAIE,MAAM,CAACC,UAAU,CAACH,SAAS,CAAC;EAErD,IAAIC,GAAG,EAAE;IACP,OAAOA,GAAG;EACZ;AACF","ignoreList":[]}
1
+ {"version":3,"names":["getEasing","applySelectorCondition","baseSelector","predicate","includes","replace","generateId","c","String","fromCharCode","crypto","getRandomValues","Uint8Array","createTransitionCSS","_ref","_properties2","key","effectId","transition","properties","childSelector","selectorCondition","transitions","styleProperties","duration","easing","delay","hasCustomPropertiesTransition","some","styleProperty","name","startsWith","map","_properties","filter","property","value","escapedKey","stateSelector","dataAttrSelector","finalStateSelector","finalDataAttrSelector","result","join","length","transitionSelector","finalTransitionSelector","push","getMediaQuery","conditionNames","conditions","conditionContent","conditionName","_conditions$condition","type","condition","mql","window","matchMedia","getSelectorCondition"],"sources":["../../src/utils.ts"],"sourcesContent":["import { getEasing } from '@wix/motion';\nimport type { Condition, CreateTransitionCSSParams } from './types';\n\n/**\n * Applies a selector condition predicate to a base selector.\n * - If `&` is in the predicate, replace `&` with the base selector\n * - If no `&`, assume `&<predicate>` (append predicate to base selector)\n */\nfunction applySelectorCondition(\n baseSelector: string,\n predicate: string,\n): string {\n if (predicate.includes('&')) {\n return predicate.replace(/&/g, baseSelector);\n }\n return `${baseSelector}${predicate}`;\n}\n\nexport function generateId() {\n return 'wi-12343210'.replace(\n /\\d/g,\n (c) =>\n String.fromCharCode(\n (+c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))) +\n 97,\n ), // 97 for \"a\"\n );\n}\n\nexport function createTransitionCSS({\n key,\n effectId,\n transition,\n properties,\n childSelector = '> :first-child',\n selectorCondition,\n}: CreateTransitionCSSParams): string[] {\n let transitions: string[] = [];\n\n if (transition?.styleProperties) {\n const { duration, easing, delay } = transition;\n\n if (duration) {\n const hasCustomPropertiesTransition = transition.styleProperties.some(\n (styleProperty) => styleProperty.name.startsWith('--'),\n );\n\n if (hasCustomPropertiesTransition) {\n // If there are custom properties in the transition, we need to fall back to Viewer's legacy implementation\n transitions = [\n `all ${duration}ms ${getEasing(easing || 'ease')}${\n delay ? ` ${delay}ms` : ''\n }`,\n 'visibility 0s',\n ];\n } else {\n transitions = transition.styleProperties.map(\n (styleProperty) =>\n `${styleProperty.name} ${duration}ms ${getEasing(\n easing || 'ease',\n )}${delay ? ` ${delay}ms` : ''}`,\n );\n }\n }\n\n properties = transition.styleProperties;\n } else {\n transitions =\n properties\n ?.filter((property) => property.duration)\n .map(\n (property) =>\n `${property.name} ${property.duration}ms ${\n getEasing(property.easing) || 'ease'\n }${property.delay ? ` ${property.delay}ms` : ''}`,\n ) || [];\n }\n\n const styleProperties =\n properties?.map((property) => `${property.name}: ${property.value};`) || [];\n const escapedKey = key.replace(/\"/g, \"'\");\n\n // Build selectors, applying condition if present\n const stateSelector = `:is(:state(${effectId}), :--${effectId}) ${childSelector}`;\n const dataAttrSelector = `[data-interact-effect~=\"${effectId}\"] ${childSelector}`;\n\n const finalStateSelector = selectorCondition\n ? applySelectorCondition(stateSelector, selectorCondition)\n : stateSelector;\n const finalDataAttrSelector = selectorCondition\n ? applySelectorCondition(dataAttrSelector, selectorCondition)\n : dataAttrSelector;\n\n const result = [\n `${finalStateSelector},\n ${finalDataAttrSelector} {\n ${styleProperties.join(`\n `)}\n }`,\n ];\n\n if (transitions.length) {\n const transitionSelector = `[data-interact-key=\"${escapedKey}\"] ${childSelector}`;\n const finalTransitionSelector = selectorCondition\n ? applySelectorCondition(transitionSelector, selectorCondition)\n : transitionSelector;\n result.push(`@media (prefers-reduced-motion: no-preference) { ${finalTransitionSelector} {\n transition: ${transitions.join(', ')};\n } }`);\n }\n return result;\n}\n\nexport function getMediaQuery(\n conditionNames: string[] | undefined,\n conditions: Record<string, Condition>,\n) {\n const conditionContent = (conditionNames || [])\n .filter((conditionName) => {\n return (\n conditions[conditionName]?.type === 'media' &&\n conditions[conditionName].predicate\n );\n })\n .map((conditionName) => {\n return conditions[conditionName].predicate;\n })\n .join(') and (');\n\n const condition = conditionContent && `(${conditionContent})`;\n const mql = condition && window.matchMedia(condition);\n\n if (mql) {\n return mql;\n }\n}\n\nexport function getSelectorCondition(\n conditionNames: string[] | undefined,\n conditions: Record<string, Condition>,\n): string | undefined {\n for (const name of conditionNames || []) {\n const condition = conditions[name];\n if (condition?.type === 'selector' && condition.predicate) {\n return condition.predicate;\n }\n }\n return;\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAGvC;AACA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAC7BC,YAAoB,EACpBC,SAAiB,EACT;EACR,IAAIA,SAAS,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IAC3B,OAAOD,SAAS,CAACE,OAAO,CAAC,IAAI,EAAEH,YAAY,CAAC;EAC9C;EACA,OAAO,GAAGA,YAAY,GAAGC,SAAS,EAAE;AACtC;AAEA,OAAO,SAASG,UAAUA,CAAA,EAAG;EAC3B,OAAO,aAAa,CAACD,OAAO,CAC1B,KAAK,EACJE,CAAC,IACAC,MAAM,CAACC,YAAY,CACjB,CAAC,CAACF,CAAC,GACAG,MAAM,CAACC,eAAe,CAAC,IAAIC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,C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& (TimeEffect | ScrubEffect | TransitionEffect);
99
99
  export type Condition = {
100
- type: 'media' | 'container';
100
+ type: 'media' | 'container' | 'selector';
101
101
  predicate?: string;
102
102
  };
103
103
  export type InteractionTrigger = {
@@ -149,6 +149,7 @@ export type InteractionParamsTypes = {
149
149
  export type InteractionGlobalOptions = {
150
150
  reducedMotion?: boolean;
151
151
  allowA11yTriggers?: boolean;
152
+ selectorCondition?: string;
152
153
  };
153
154
  export type InteractionHandlerModule<T extends TriggerType> = {
154
155
  registerOptionsGetter?: (getter: () => any) => void;
@@ -192,5 +193,6 @@ export type CreateTransitionCSSParams = {
192
193
  transition?: TransitionEffect['transition'];
193
194
  properties?: TransitionProperty[];
194
195
  childSelector?: string;
196
+ selectorCondition?: string;
195
197
  };
196
198
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { Condition, CreateTransitionCSSParams } from './types';
2
2
  export declare function generateId(): string;
3
- export declare function createTransitionCSS({ key, effectId, transition, properties, childSelector, }: CreateTransitionCSSParams): string[];
3
+ export declare function createTransitionCSS({ key, effectId, transition, properties, childSelector, selectorCondition, }: CreateTransitionCSSParams): string[];
4
4
  export declare function getMediaQuery(conditionNames: string[] | undefined, conditions: Record<string, Condition>): MediaQueryList | undefined;
5
+ export declare function getSelectorCondition(conditionNames: string[] | undefined, conditions: Record<string, Condition>): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/interact",
3
- "version": "1.92.0",
3
+ "version": "1.93.0",
4
4
  "author": {
5
5
  "name": "wow!Team",
6
6
  "email": "wow-dev@wix.com"
@@ -69,5 +69,5 @@
69
69
  "wallaby": {
70
70
  "autoDetect": true
71
71
  },
72
- "falconPackageHash": "15a6a8530daad78c07301d9f63e179ba743e8f8968e44aafaa9b27b3"
72
+ "falconPackageHash": "6b4071ff75035af06326865108012e422c9f4adbbfed6828d778e157"
73
73
  }