@cntrl-site/sdk-nextjs 1.9.13-0 → 1.9.13-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.
@@ -105,149 +105,136 @@ class InteractionsRegistry {
105
105
  return available;
106
106
  }
107
107
  notifyLoad() {
108
- var _a, _b;
109
- const timestamp = Date.now();
110
- for (const interaction of this.interactions) {
111
- const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
112
- const matchingTrigger = interaction.triggers.find(trigger => 'position' in trigger && trigger.position === 0 && trigger.from === currentStateId);
113
- if (!matchingTrigger)
114
- continue;
115
- const activeStateId = this.getActiveInteractionState(interaction.id);
116
- const isNewStateActive = matchingTrigger.to === activeStateId;
117
- this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
118
- const transitioningItems = (_a = this.stateItemsIdsMap[activeStateId]) !== null && _a !== void 0 ? _a : [];
119
- const state = interaction.states.find((state) => state.id === matchingTrigger.to);
120
- const actions = (_b = state === null || state === void 0 ? void 0 : state.actions) !== null && _b !== void 0 ? _b : [];
121
- for (const action of actions) {
122
- const ctrl = this.ctrls.get(action.itemId);
123
- if (!ctrl)
124
- continue;
125
- ctrl.receiveAction(action.type);
126
- }
127
- this.itemsStages = this.itemsStages.map((stage) => {
128
- if (stage.interactionId !== interaction.id)
129
- return stage;
130
- return {
131
- itemId: stage.itemId,
132
- interactionId: stage.interactionId,
133
- type: 'transitioning',
134
- from: stage.type === 'transitioning' ? stage.to : stage.stateId,
135
- to: matchingTrigger.to,
136
- direction: isNewStateActive ? 'in' : 'out',
137
- updated: timestamp
138
- };
139
- });
140
- const itemsToNotify = new Set(transitioningItems);
141
- for (const trigger of interaction.triggers) {
142
- if (!('itemId' in trigger))
143
- continue;
144
- itemsToNotify.add(trigger.itemId);
145
- }
146
- this.notifyItemCtrlsChange(Array.from(itemsToNotify));
147
- this.notifyTransitionStartForItems(transitioningItems, activeStateId);
148
- }
108
+ // const timestamp = Date.now();
109
+ // for (const interaction of this.interactions) {
110
+ // const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
111
+ // const matchingTrigger = interaction.triggers.find(trigger =>
112
+ // 'position' in trigger && trigger.position === 0 && trigger.from === currentStateId
113
+ // );
114
+ // if (!matchingTrigger) continue;
115
+ // const activeStateId = this.getActiveInteractionState(interaction.id);
116
+ // const isNewStateActive = matchingTrigger.to === activeStateId;
117
+ // this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
118
+ // const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
119
+ // const state = interaction.states.find((state) => state.id === matchingTrigger.to);
120
+ // const actions = state?.actions ?? [];
121
+ // for (const action of actions) {
122
+ // const ctrl = this.ctrls.get(action.itemId);
123
+ // if (!ctrl) continue;
124
+ // ctrl.receiveAction(action.type);
125
+ // }
126
+ // this.itemsStages = this.itemsStages.map((stage) => {
127
+ // if (stage.interactionId !== interaction.id) return stage;
128
+ // return {
129
+ // itemId: stage.itemId,
130
+ // interactionId: stage.interactionId,
131
+ // type: 'transitioning',
132
+ // from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
133
+ // to: matchingTrigger.to,
134
+ // direction: isNewStateActive ? 'in' : 'out',
135
+ // updated: timestamp
136
+ // };
137
+ // });
138
+ // const itemsToNotify = new Set<ItemId>(transitioningItems);
139
+ // for (const trigger of interaction.triggers) {
140
+ // if (!('itemId' in trigger)) continue;
141
+ // itemsToNotify.add(trigger.itemId);
142
+ // }
143
+ // this.notifyItemCtrlsChange(Array.from(itemsToNotify));
144
+ // this.notifyTransitionStartForItems(transitioningItems, activeStateId);
145
+ // }
149
146
  }
150
147
  notifyScroll(position) {
151
- var _a, _b, _c;
152
- const timestamp = Date.now();
153
- for (const interaction of this.interactions) {
154
- const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
155
- const activeStateId = (_a = interaction.states.find((state) => state.id !== interaction.startStateId)) === null || _a === void 0 ? void 0 : _a.id;
156
- const matchingTrigger = interaction.triggers.find((trigger) => {
157
- if (!('position' in trigger) || trigger.position === 0)
158
- return false;
159
- const triggerPosition = trigger.position * window.innerWidth;
160
- const isScrolledPastTrigger = triggerPosition < position;
161
- if (!isScrolledPastTrigger && !trigger.isReverse)
162
- return false;
163
- const stateId = isScrolledPastTrigger ? trigger.from : trigger.to;
164
- return stateId === currentStateId;
165
- });
166
- if (!matchingTrigger || !('position' in matchingTrigger) || !activeStateId)
167
- continue;
168
- const triggerPosition = matchingTrigger.position * window.innerWidth;
169
- const isScrolledPastTrigger = triggerPosition < position;
170
- const targetStateId = isScrolledPastTrigger ? matchingTrigger.to : matchingTrigger.from;
171
- this.setCurrentStateForInteraction(interaction.id, targetStateId);
172
- const transitioningItems = (_b = this.stateItemsIdsMap[activeStateId]) !== null && _b !== void 0 ? _b : [];
173
- const state = interaction.states.find((state) => state.id === targetStateId);
174
- const actions = (_c = state === null || state === void 0 ? void 0 : state.actions) !== null && _c !== void 0 ? _c : [];
175
- for (const action of actions) {
176
- const ctrl = this.ctrls.get(action.itemId);
177
- if (!ctrl)
178
- continue;
179
- ctrl.receiveAction(action.type);
180
- }
181
- const itemsStages = this.itemsStages.map((stage) => {
182
- if (stage.interactionId !== interaction.id)
183
- return stage;
184
- const newStage = {
185
- itemId: stage.itemId,
186
- interactionId: stage.interactionId,
187
- type: 'transitioning',
188
- from: stage.type === 'transitioning' ? stage.to : stage.stateId,
189
- to: targetStateId,
190
- direction: targetStateId === activeStateId ? 'in' : 'out',
191
- updated: timestamp
192
- };
193
- return newStage;
194
- });
195
- this.itemsStages = itemsStages;
196
- const itemsToNotify = new Set(transitioningItems);
197
- for (const trigger of interaction.triggers) {
198
- if (!('itemId' in trigger))
199
- continue;
200
- itemsToNotify.add(trigger.itemId);
201
- }
202
- this.notifyItemCtrlsChange(Array.from(itemsToNotify));
203
- this.notifyTransitionStartForItems(transitioningItems, activeStateId);
204
- }
148
+ // const timestamp = Date.now();
149
+ // for (const interaction of this.interactions) {
150
+ // const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
151
+ // const activeStateId = interaction.states.find((state) => state.id !== interaction.startStateId)?.id;
152
+ // const matchingTrigger = interaction.triggers.find((trigger) => {
153
+ // if (!('position' in trigger) || trigger.position === 0) return false;
154
+ // const triggerPosition = trigger.position * window.innerWidth;
155
+ // const isScrolledPastTrigger = triggerPosition < position;
156
+ // if (!isScrolledPastTrigger && !trigger.isReverse) return false;
157
+ // const stateId = isScrolledPastTrigger ? trigger.from : trigger.to;
158
+ // return stateId === currentStateId;
159
+ // });
160
+ // if (!matchingTrigger || !('position' in matchingTrigger) || !activeStateId) continue;
161
+ // const triggerPosition = matchingTrigger.position * window.innerWidth;
162
+ // const isScrolledPastTrigger = triggerPosition < position;
163
+ // const targetStateId = isScrolledPastTrigger ? matchingTrigger.to : matchingTrigger.from;
164
+ // this.setCurrentStateForInteraction(interaction.id, targetStateId);
165
+ // const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
166
+ // const state = interaction.states.find((state) => state.id === targetStateId);
167
+ // const actions = state?.actions ?? [];
168
+ // for (const action of actions) {
169
+ // const ctrl = this.ctrls.get(action.itemId);
170
+ // if (!ctrl) continue;
171
+ // ctrl.receiveAction(action.type);
172
+ // }
173
+ // const itemsStages = this.itemsStages.map((stage) => {
174
+ // if (stage.interactionId !== interaction.id) return stage;
175
+ // const newStage = {
176
+ // itemId: stage.itemId,
177
+ // interactionId: stage.interactionId,
178
+ // type: 'transitioning' as const,
179
+ // from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
180
+ // to: targetStateId,
181
+ // direction: targetStateId === activeStateId ? 'in' as const : 'out' as const,
182
+ // updated: timestamp
183
+ // };
184
+ // return newStage;
185
+ // });
186
+ // this.itemsStages = itemsStages;
187
+ // const itemsToNotify = new Set<ItemId>(transitioningItems);
188
+ // for (const trigger of interaction.triggers) {
189
+ // if (!('itemId' in trigger)) continue;
190
+ // itemsToNotify.add(trigger.itemId);
191
+ // }
192
+ // this.notifyItemCtrlsChange(Array.from(itemsToNotify));
193
+ // this.notifyTransitionStartForItems(transitioningItems, activeStateId);
194
+ // }
205
195
  }
206
196
  notifyItemTrigger(itemId, triggerType) {
207
- var _a, _b;
208
- const timestamp = Date.now();
209
- for (const interaction of this.interactions) {
210
- const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
211
- const matchingTrigger = interaction.triggers.find((trigger) => 'triggerEvent' in trigger
212
- && trigger.itemId === itemId
213
- && trigger.from === currentStateId
214
- && trigger.triggerEvent === triggerType);
215
- if (!matchingTrigger)
216
- continue;
217
- const activeStateId = this.getActiveInteractionState(interaction.id);
218
- const isNewStateActive = matchingTrigger.to === activeStateId;
219
- this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
220
- const transitioningItems = (_a = this.stateItemsIdsMap[activeStateId]) !== null && _a !== void 0 ? _a : [];
221
- const state = interaction.states.find((state) => state.id === matchingTrigger.to);
222
- const actions = (_b = state === null || state === void 0 ? void 0 : state.actions) !== null && _b !== void 0 ? _b : [];
223
- for (const action of actions) {
224
- const ctrl = this.ctrls.get(action.itemId);
225
- if (!ctrl)
226
- continue;
227
- ctrl.receiveAction(action.type);
228
- }
229
- this.itemsStages = this.itemsStages.map((stage) => {
230
- if (stage.interactionId !== interaction.id)
231
- return stage;
232
- return {
233
- itemId: stage.itemId,
234
- interactionId: stage.interactionId,
235
- type: 'transitioning',
236
- from: stage.type === 'transitioning' ? stage.to : stage.stateId,
237
- to: matchingTrigger.to,
238
- direction: isNewStateActive ? 'in' : 'out',
239
- updated: timestamp
240
- };
241
- });
242
- const itemsToNotify = new Set(transitioningItems);
243
- for (const trigger of interaction.triggers) {
244
- if (!('itemId' in trigger))
245
- continue;
246
- itemsToNotify.add(trigger.itemId);
247
- }
248
- this.notifyItemCtrlsChange(Array.from(itemsToNotify));
249
- this.notifyTransitionStartForItems(transitioningItems, activeStateId);
250
- }
197
+ // const timestamp = Date.now();
198
+ // for (const interaction of this.interactions) {
199
+ // const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
200
+ // const matchingTrigger = interaction.triggers.find((trigger) =>
201
+ // 'triggerEvent' in trigger
202
+ // && trigger.itemId === itemId
203
+ // && trigger.from === currentStateId
204
+ // && trigger.triggerEvent === triggerType
205
+ // );
206
+ // if (!matchingTrigger) continue;
207
+ // const activeStateId = this.getActiveInteractionState(interaction.id);
208
+ // const isNewStateActive = matchingTrigger.to === activeStateId;
209
+ // this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
210
+ // const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
211
+ // const state = interaction.states.find((state) => state.id === matchingTrigger.to);
212
+ // const actions = state?.actions ?? [];
213
+ // for (const action of actions) {
214
+ // const ctrl = this.ctrls.get(action.itemId);
215
+ // if (!ctrl) continue;
216
+ // ctrl.receiveAction(action.type);
217
+ // }
218
+ // this.itemsStages = this.itemsStages.map((stage) => {
219
+ // if (stage.interactionId !== interaction.id) return stage;
220
+ // return {
221
+ // itemId: stage.itemId,
222
+ // interactionId: stage.interactionId,
223
+ // type: 'transitioning',
224
+ // from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
225
+ // to: matchingTrigger.to,
226
+ // direction: isNewStateActive ? 'in' : 'out',
227
+ // updated: timestamp
228
+ // };
229
+ // });
230
+ // const itemsToNotify = new Set<ItemId>(transitioningItems);
231
+ // for (const trigger of interaction.triggers) {
232
+ // if (!('itemId' in trigger)) continue;
233
+ // itemsToNotify.add(trigger.itemId);
234
+ // }
235
+ // this.notifyItemCtrlsChange(Array.from(itemsToNotify));
236
+ // this.notifyTransitionStartForItems(transitioningItems, activeStateId);
237
+ // }
251
238
  }
252
239
  notifyTransitionStartForItems(itemsIds, activeStateId) {
253
240
  var _a, _b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.9.13-0",
3
+ "version": "1.9.13-2",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -113,140 +113,140 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
113
113
  }
114
114
 
115
115
  notifyLoad() {
116
- const timestamp = Date.now();
117
- for (const interaction of this.interactions) {
118
- const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
119
- const matchingTrigger = interaction.triggers.find(trigger =>
120
- 'position' in trigger && trigger.position === 0 && trigger.from === currentStateId
121
- );
122
- if (!matchingTrigger) continue;
123
- const activeStateId = this.getActiveInteractionState(interaction.id);
124
- const isNewStateActive = matchingTrigger.to === activeStateId;
125
- this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
126
- const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
127
- const state = interaction.states.find((state) => state.id === matchingTrigger.to);
128
- const actions = state?.actions ?? [];
129
- for (const action of actions) {
130
- const ctrl = this.ctrls.get(action.itemId);
131
- if (!ctrl) continue;
132
- ctrl.receiveAction(action.type);
133
- }
116
+ // const timestamp = Date.now();
117
+ // for (const interaction of this.interactions) {
118
+ // const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
119
+ // const matchingTrigger = interaction.triggers.find(trigger =>
120
+ // 'position' in trigger && trigger.position === 0 && trigger.from === currentStateId
121
+ // );
122
+ // if (!matchingTrigger) continue;
123
+ // const activeStateId = this.getActiveInteractionState(interaction.id);
124
+ // const isNewStateActive = matchingTrigger.to === activeStateId;
125
+ // this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
126
+ // const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
127
+ // const state = interaction.states.find((state) => state.id === matchingTrigger.to);
128
+ // const actions = state?.actions ?? [];
129
+ // for (const action of actions) {
130
+ // const ctrl = this.ctrls.get(action.itemId);
131
+ // if (!ctrl) continue;
132
+ // ctrl.receiveAction(action.type);
133
+ // }
134
134
 
135
- this.itemsStages = this.itemsStages.map((stage) => {
136
- if (stage.interactionId !== interaction.id) return stage;
137
- return {
138
- itemId: stage.itemId,
139
- interactionId: stage.interactionId,
140
- type: 'transitioning',
141
- from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
142
- to: matchingTrigger.to,
143
- direction: isNewStateActive ? 'in' : 'out',
144
- updated: timestamp
145
- };
146
- });
135
+ // this.itemsStages = this.itemsStages.map((stage) => {
136
+ // if (stage.interactionId !== interaction.id) return stage;
137
+ // return {
138
+ // itemId: stage.itemId,
139
+ // interactionId: stage.interactionId,
140
+ // type: 'transitioning',
141
+ // from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
142
+ // to: matchingTrigger.to,
143
+ // direction: isNewStateActive ? 'in' : 'out',
144
+ // updated: timestamp
145
+ // };
146
+ // });
147
147
 
148
- const itemsToNotify = new Set<ItemId>(transitioningItems);
149
- for (const trigger of interaction.triggers) {
150
- if (!('itemId' in trigger)) continue;
151
- itemsToNotify.add(trigger.itemId);
152
- }
153
- this.notifyItemCtrlsChange(Array.from(itemsToNotify));
154
- this.notifyTransitionStartForItems(transitioningItems, activeStateId);
155
- }
148
+ // const itemsToNotify = new Set<ItemId>(transitioningItems);
149
+ // for (const trigger of interaction.triggers) {
150
+ // if (!('itemId' in trigger)) continue;
151
+ // itemsToNotify.add(trigger.itemId);
152
+ // }
153
+ // this.notifyItemCtrlsChange(Array.from(itemsToNotify));
154
+ // this.notifyTransitionStartForItems(transitioningItems, activeStateId);
155
+ // }
156
156
  }
157
157
 
158
158
  notifyScroll(position: number) {
159
- const timestamp = Date.now();
160
- for (const interaction of this.interactions) {
161
- const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
162
- const activeStateId = interaction.states.find((state) => state.id !== interaction.startStateId)?.id;
163
- const matchingTrigger = interaction.triggers.find((trigger) => {
164
- if (!('position' in trigger) || trigger.position === 0) return false;
165
- const triggerPosition = trigger.position * window.innerWidth;
166
- const isScrolledPastTrigger = triggerPosition < position;
167
- if (!isScrolledPastTrigger && !trigger.isReverse) return false;
168
- const stateId = isScrolledPastTrigger ? trigger.from : trigger.to;
169
- return stateId === currentStateId;
170
- });
171
- if (!matchingTrigger || !('position' in matchingTrigger) || !activeStateId) continue;
172
- const triggerPosition = matchingTrigger.position * window.innerWidth;
173
- const isScrolledPastTrigger = triggerPosition < position;
174
- const targetStateId = isScrolledPastTrigger ? matchingTrigger.to : matchingTrigger.from;
175
- this.setCurrentStateForInteraction(interaction.id, targetStateId);
176
- const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
177
- const state = interaction.states.find((state) => state.id === targetStateId);
178
- const actions = state?.actions ?? [];
179
- for (const action of actions) {
180
- const ctrl = this.ctrls.get(action.itemId);
181
- if (!ctrl) continue;
182
- ctrl.receiveAction(action.type);
183
- }
184
- const itemsStages = this.itemsStages.map((stage) => {
185
- if (stage.interactionId !== interaction.id) return stage;
186
- const newStage = {
187
- itemId: stage.itemId,
188
- interactionId: stage.interactionId,
189
- type: 'transitioning' as const,
190
- from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
191
- to: targetStateId,
192
- direction: targetStateId === activeStateId ? 'in' as const : 'out' as const,
193
- updated: timestamp
194
- };
195
- return newStage;
196
- });
197
- this.itemsStages = itemsStages;
198
- const itemsToNotify = new Set<ItemId>(transitioningItems);
199
- for (const trigger of interaction.triggers) {
200
- if (!('itemId' in trigger)) continue;
201
- itemsToNotify.add(trigger.itemId);
202
- }
203
- this.notifyItemCtrlsChange(Array.from(itemsToNotify));
204
- this.notifyTransitionStartForItems(transitioningItems, activeStateId);
205
- }
159
+ // const timestamp = Date.now();
160
+ // for (const interaction of this.interactions) {
161
+ // const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
162
+ // const activeStateId = interaction.states.find((state) => state.id !== interaction.startStateId)?.id;
163
+ // const matchingTrigger = interaction.triggers.find((trigger) => {
164
+ // if (!('position' in trigger) || trigger.position === 0) return false;
165
+ // const triggerPosition = trigger.position * window.innerWidth;
166
+ // const isScrolledPastTrigger = triggerPosition < position;
167
+ // if (!isScrolledPastTrigger && !trigger.isReverse) return false;
168
+ // const stateId = isScrolledPastTrigger ? trigger.from : trigger.to;
169
+ // return stateId === currentStateId;
170
+ // });
171
+ // if (!matchingTrigger || !('position' in matchingTrigger) || !activeStateId) continue;
172
+ // const triggerPosition = matchingTrigger.position * window.innerWidth;
173
+ // const isScrolledPastTrigger = triggerPosition < position;
174
+ // const targetStateId = isScrolledPastTrigger ? matchingTrigger.to : matchingTrigger.from;
175
+ // this.setCurrentStateForInteraction(interaction.id, targetStateId);
176
+ // const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
177
+ // const state = interaction.states.find((state) => state.id === targetStateId);
178
+ // const actions = state?.actions ?? [];
179
+ // for (const action of actions) {
180
+ // const ctrl = this.ctrls.get(action.itemId);
181
+ // if (!ctrl) continue;
182
+ // ctrl.receiveAction(action.type);
183
+ // }
184
+ // const itemsStages = this.itemsStages.map((stage) => {
185
+ // if (stage.interactionId !== interaction.id) return stage;
186
+ // const newStage = {
187
+ // itemId: stage.itemId,
188
+ // interactionId: stage.interactionId,
189
+ // type: 'transitioning' as const,
190
+ // from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
191
+ // to: targetStateId,
192
+ // direction: targetStateId === activeStateId ? 'in' as const : 'out' as const,
193
+ // updated: timestamp
194
+ // };
195
+ // return newStage;
196
+ // });
197
+ // this.itemsStages = itemsStages;
198
+ // const itemsToNotify = new Set<ItemId>(transitioningItems);
199
+ // for (const trigger of interaction.triggers) {
200
+ // if (!('itemId' in trigger)) continue;
201
+ // itemsToNotify.add(trigger.itemId);
202
+ // }
203
+ // this.notifyItemCtrlsChange(Array.from(itemsToNotify));
204
+ // this.notifyTransitionStartForItems(transitioningItems, activeStateId);
205
+ // }
206
206
  }
207
207
 
208
208
  notifyItemTrigger(itemId: string, triggerType: TriggerType): void {
209
- const timestamp = Date.now();
210
- for (const interaction of this.interactions) {
211
- const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
212
- const matchingTrigger = interaction.triggers.find((trigger) =>
213
- 'triggerEvent' in trigger
214
- && trigger.itemId === itemId
215
- && trigger.from === currentStateId
216
- && trigger.triggerEvent === triggerType
217
- );
218
- if (!matchingTrigger) continue;
219
- const activeStateId = this.getActiveInteractionState(interaction.id);
220
- const isNewStateActive = matchingTrigger.to === activeStateId;
221
- this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
222
- const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
223
- const state = interaction.states.find((state) => state.id === matchingTrigger.to);
224
- const actions = state?.actions ?? [];
225
- for (const action of actions) {
226
- const ctrl = this.ctrls.get(action.itemId);
227
- if (!ctrl) continue;
228
- ctrl.receiveAction(action.type);
229
- }
230
- this.itemsStages = this.itemsStages.map((stage) => {
231
- if (stage.interactionId !== interaction.id) return stage;
232
- return {
233
- itemId: stage.itemId,
234
- interactionId: stage.interactionId,
235
- type: 'transitioning',
236
- from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
237
- to: matchingTrigger.to,
238
- direction: isNewStateActive ? 'in' : 'out',
239
- updated: timestamp
240
- };
241
- });
242
- const itemsToNotify = new Set<ItemId>(transitioningItems);
243
- for (const trigger of interaction.triggers) {
244
- if (!('itemId' in trigger)) continue;
245
- itemsToNotify.add(trigger.itemId);
246
- }
247
- this.notifyItemCtrlsChange(Array.from(itemsToNotify));
248
- this.notifyTransitionStartForItems(transitioningItems, activeStateId);
249
- }
209
+ // const timestamp = Date.now();
210
+ // for (const interaction of this.interactions) {
211
+ // const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
212
+ // const matchingTrigger = interaction.triggers.find((trigger) =>
213
+ // 'triggerEvent' in trigger
214
+ // && trigger.itemId === itemId
215
+ // && trigger.from === currentStateId
216
+ // && trigger.triggerEvent === triggerType
217
+ // );
218
+ // if (!matchingTrigger) continue;
219
+ // const activeStateId = this.getActiveInteractionState(interaction.id);
220
+ // const isNewStateActive = matchingTrigger.to === activeStateId;
221
+ // this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
222
+ // const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
223
+ // const state = interaction.states.find((state) => state.id === matchingTrigger.to);
224
+ // const actions = state?.actions ?? [];
225
+ // for (const action of actions) {
226
+ // const ctrl = this.ctrls.get(action.itemId);
227
+ // if (!ctrl) continue;
228
+ // ctrl.receiveAction(action.type);
229
+ // }
230
+ // this.itemsStages = this.itemsStages.map((stage) => {
231
+ // if (stage.interactionId !== interaction.id) return stage;
232
+ // return {
233
+ // itemId: stage.itemId,
234
+ // interactionId: stage.interactionId,
235
+ // type: 'transitioning',
236
+ // from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
237
+ // to: matchingTrigger.to,
238
+ // direction: isNewStateActive ? 'in' : 'out',
239
+ // updated: timestamp
240
+ // };
241
+ // });
242
+ // const itemsToNotify = new Set<ItemId>(transitioningItems);
243
+ // for (const trigger of interaction.triggers) {
244
+ // if (!('itemId' in trigger)) continue;
245
+ // itemsToNotify.add(trigger.itemId);
246
+ // }
247
+ // this.notifyItemCtrlsChange(Array.from(itemsToNotify));
248
+ // this.notifyTransitionStartForItems(transitioningItems, activeStateId);
249
+ // }
250
250
  }
251
251
 
252
252
  notifyTransitionStartForItems(itemsIds: string[], activeStateId: string) {