@syntrologie/adapt-overlays 2.16.0 → 2.17.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/chunk-VHAA22YE.js +14 -0
- package/dist/chunk-VHAA22YE.js.map +7 -0
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +2596 -354
- package/dist/runtime.js.map +7 -0
- package/dist/schema.d.ts +90 -21
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +440 -151
- package/dist/schema.js.map +7 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -22
- package/dist/WorkflowTracker.d.ts +0 -10
- package/dist/WorkflowTracker.d.ts.map +0 -1
- package/dist/WorkflowTracker.js +0 -19
- package/dist/WorkflowWidget.d.ts +0 -70
- package/dist/WorkflowWidget.d.ts.map +0 -1
- package/dist/WorkflowWidget.js +0 -330
- package/dist/WorkflowWidgetLit.js +0 -617
- package/dist/cdn.d.ts +0 -35
- package/dist/cdn.d.ts.map +0 -1
- package/dist/cdn.js +0 -39
- package/dist/celebrations/__tests__/engine.test.js +0 -130
- package/dist/celebrations/__tests__/executor.test.js +0 -102
- package/dist/celebrations/__tests__/reduced-motion.test.js +0 -97
- package/dist/celebrations/effects/__tests__/confetti.test.js +0 -89
- package/dist/celebrations/effects/__tests__/emoji-rain.test.js +0 -88
- package/dist/celebrations/effects/__tests__/fireworks.test.js +0 -87
- package/dist/celebrations/effects/__tests__/sparkles.test.js +0 -79
- package/dist/celebrations/effects/confetti.js +0 -80
- package/dist/celebrations/effects/emoji-rain.js +0 -73
- package/dist/celebrations/effects/fireworks.js +0 -69
- package/dist/celebrations/effects/sparkles.js +0 -83
- package/dist/celebrations/engine.js +0 -93
- package/dist/celebrations/index.js +0 -73
- package/dist/celebrations/types.js +0 -1
- package/dist/editor.d.ts +0 -27
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js +0 -22
- package/dist/executors/tour.js +0 -335
- package/dist/highlight.js +0 -180
- package/dist/modal.js +0 -218
- package/dist/overlay-editor-state.d.ts +0 -41
- package/dist/overlay-editor-state.d.ts.map +0 -1
- package/dist/overlay-editor-state.js +0 -131
- package/dist/overlay-editor-ui.d.ts +0 -9
- package/dist/overlay-editor-ui.d.ts.map +0 -1
- package/dist/overlay-editor-ui.js +0 -306
- package/dist/runtime-lit.d.ts +0 -94
- package/dist/runtime-lit.d.ts.map +0 -1
- package/dist/runtime-lit.js +0 -402
- package/dist/sanitizer.js +0 -84
- package/dist/summarize.js +0 -86
- package/dist/tooltip.js +0 -279
- package/dist/tour-types.js +0 -7
- package/dist/types.js +0 -7
- package/dist/workflow-types.js +0 -1
- package/node_modules/@syntro/design-system/README.md +0 -335
- package/node_modules/@syntro/design-system/dist/assets/syntrologie-logo.svg +0 -21
- package/node_modules/@syntro/design-system/dist/assets/syntrologie-logomark.svg +0 -10
- package/node_modules/@syntro/design-system/dist/index.d.ts +0 -8
- package/node_modules/@syntro/design-system/dist/index.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/index.js +0 -7
- package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts +0 -19
- package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tailwind-preset.js +0 -455
- package/node_modules/@syntro/design-system/dist/tokens/colors.css +0 -464
- package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts +0 -874
- package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/colors.js +0 -564
- package/node_modules/@syntro/design-system/dist/tokens/effects.css +0 -43
- package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts +0 -139
- package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/effects.js +0 -121
- package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +0 -12
- package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/index.js +0 -11
- package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts +0 -93
- package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts.map +0 -1
- package/node_modules/@syntro/design-system/dist/tokens/panel-shell.js +0 -72
- package/node_modules/@syntro/design-system/package.json +0 -55
- package/node_modules/@syntro/design-system/src/assets/syntrologie-logo.svg +0 -21
- package/node_modules/@syntro/design-system/src/assets/syntrologie-logomark.svg +0 -10
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -161
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +0 -84
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +0 -323
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +0 -55
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +0 -118
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +0 -32
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +0 -68
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +0 -57
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +0 -13
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +0 -31
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +0 -36
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +0 -102
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +0 -20
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +0 -48
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +0 -16
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +0 -66
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +0 -87
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -390
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +0 -66
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +0 -528
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +0 -41
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +0 -63
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +0 -55
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +0 -92
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +0 -90
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +0 -242
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +0 -12
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +0 -21
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +0 -21
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +0 -28
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +0 -121
- package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +0 -110
- package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +0 -481
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -36
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -26
- package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +0 -14
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -33
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -68
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
- package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -55
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
const defaultConfig = {
|
|
3
|
-
duration: 3000,
|
|
4
|
-
intensity: 'medium',
|
|
5
|
-
colors: ['#ffd700', '#ffffff', '#fffacd'],
|
|
6
|
-
};
|
|
7
|
-
describe('sparkles effect', () => {
|
|
8
|
-
describe('init', () => {
|
|
9
|
-
it('creates particles at random positions across the screen', async () => {
|
|
10
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
11
|
-
const particles = sparklesEffect.init(800, 600, defaultConfig);
|
|
12
|
-
expect(particles.length).toBeGreaterThan(0);
|
|
13
|
-
// Particles should be spread across the viewport
|
|
14
|
-
const xs = particles.map((p) => p.x);
|
|
15
|
-
const minX = Math.min(...xs);
|
|
16
|
-
const maxX = Math.max(...xs);
|
|
17
|
-
expect(maxX - minX).toBeGreaterThan(100);
|
|
18
|
-
});
|
|
19
|
-
it('scales count with intensity', async () => {
|
|
20
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
21
|
-
const light = sparklesEffect.init(800, 600, { ...defaultConfig, intensity: 'light' });
|
|
22
|
-
const heavy = sparklesEffect.init(800, 600, { ...defaultConfig, intensity: 'heavy' });
|
|
23
|
-
expect(heavy.length).toBeGreaterThan(light.length);
|
|
24
|
-
});
|
|
25
|
-
it('uses colors from config', async () => {
|
|
26
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
27
|
-
const particles = sparklesEffect.init(800, 600, defaultConfig);
|
|
28
|
-
for (const p of particles) {
|
|
29
|
-
expect(defaultConfig.colors).toContain(p.color);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe('update', () => {
|
|
34
|
-
it('moves particles upward (vy is negative)', async () => {
|
|
35
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
36
|
-
const particles = sparklesEffect.init(800, 600, defaultConfig);
|
|
37
|
-
const initialY = particles[0].y;
|
|
38
|
-
sparklesEffect.update(particles, 16, 16);
|
|
39
|
-
expect(particles[0].y).toBeLessThan(initialY);
|
|
40
|
-
});
|
|
41
|
-
it('returns true while particles are visible', async () => {
|
|
42
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
43
|
-
const particles = sparklesEffect.init(800, 600, defaultConfig);
|
|
44
|
-
expect(sparklesEffect.update(particles, 16, 16)).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
it('returns false when all particles have faded', async () => {
|
|
47
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
48
|
-
const particles = sparklesEffect.init(800, 600, defaultConfig);
|
|
49
|
-
for (const p of particles) {
|
|
50
|
-
p.opacity = 0;
|
|
51
|
-
if (p.data)
|
|
52
|
-
p.data.baseOpacity = 0;
|
|
53
|
-
}
|
|
54
|
-
expect(sparklesEffect.update(particles, 16, 5000)).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('render', () => {
|
|
58
|
-
it('draws to canvas context', async () => {
|
|
59
|
-
const { sparklesEffect } = await import('../sparkles');
|
|
60
|
-
const particles = sparklesEffect.init(800, 600, defaultConfig);
|
|
61
|
-
const ctx = {
|
|
62
|
-
save: vi.fn(),
|
|
63
|
-
restore: vi.fn(),
|
|
64
|
-
translate: vi.fn(),
|
|
65
|
-
rotate: vi.fn(),
|
|
66
|
-
beginPath: vi.fn(),
|
|
67
|
-
moveTo: vi.fn(),
|
|
68
|
-
lineTo: vi.fn(),
|
|
69
|
-
closePath: vi.fn(),
|
|
70
|
-
fill: vi.fn(),
|
|
71
|
-
globalAlpha: 1,
|
|
72
|
-
fillStyle: '',
|
|
73
|
-
};
|
|
74
|
-
sparklesEffect.render(ctx, particles);
|
|
75
|
-
expect(ctx.save).toHaveBeenCalled();
|
|
76
|
-
expect(ctx.restore).toHaveBeenCalled();
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const INTENSITY_COUNTS = { light: 50, medium: 100, heavy: 200 };
|
|
2
|
-
const DEFAULT_COLORS = [
|
|
3
|
-
'#ff0000',
|
|
4
|
-
'#00ff00',
|
|
5
|
-
'#0000ff',
|
|
6
|
-
'#ffff00',
|
|
7
|
-
'#ff00ff',
|
|
8
|
-
'#00ffff',
|
|
9
|
-
'#ff8800',
|
|
10
|
-
'#8800ff',
|
|
11
|
-
];
|
|
12
|
-
export const confettiEffect = {
|
|
13
|
-
init(width, height, config) {
|
|
14
|
-
const count = INTENSITY_COUNTS[config.intensity];
|
|
15
|
-
const colors = config.colors.length > 0 ? config.colors : DEFAULT_COLORS;
|
|
16
|
-
const particles = [];
|
|
17
|
-
for (let i = 0; i < count; i++) {
|
|
18
|
-
particles.push({
|
|
19
|
-
x: Math.random() * width,
|
|
20
|
-
y: Math.random() * -height * 0.3,
|
|
21
|
-
vx: (Math.random() - 0.5) * 4,
|
|
22
|
-
vy: Math.random() * 2 + 1,
|
|
23
|
-
rotation: Math.random() * Math.PI * 2,
|
|
24
|
-
rotationSpeed: (Math.random() - 0.5) * 0.2,
|
|
25
|
-
size: Math.random() * 6 + 4,
|
|
26
|
-
color: colors[Math.floor(Math.random() * colors.length)],
|
|
27
|
-
opacity: 1,
|
|
28
|
-
shape: Math.random() > 0.5 ? 'rect' : 'circle',
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return particles;
|
|
32
|
-
},
|
|
33
|
-
update(particles, _dt, _elapsed) {
|
|
34
|
-
let anyVisible = false;
|
|
35
|
-
for (const p of particles) {
|
|
36
|
-
// Gravity
|
|
37
|
-
p.vy += 0.15;
|
|
38
|
-
// Air resistance
|
|
39
|
-
p.vx *= 0.99;
|
|
40
|
-
// Movement
|
|
41
|
-
p.x += p.vx;
|
|
42
|
-
p.y += p.vy;
|
|
43
|
-
// Rotation
|
|
44
|
-
p.rotation += p.rotationSpeed;
|
|
45
|
-
// Fade when past 80% of a typical viewport height (use a reasonable default)
|
|
46
|
-
if (p.y > 0 && p.opacity > 0) {
|
|
47
|
-
// Gradually fade based on how far the particle has traveled
|
|
48
|
-
if (p.y > 500) {
|
|
49
|
-
p.opacity -= 0.02;
|
|
50
|
-
if (p.opacity < 0)
|
|
51
|
-
p.opacity = 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (p.opacity > 0.01) {
|
|
55
|
-
anyVisible = true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return anyVisible;
|
|
59
|
-
},
|
|
60
|
-
render(ctx, particles) {
|
|
61
|
-
for (const p of particles) {
|
|
62
|
-
if (p.opacity < 0.01)
|
|
63
|
-
continue;
|
|
64
|
-
ctx.save();
|
|
65
|
-
ctx.globalAlpha = p.opacity;
|
|
66
|
-
ctx.fillStyle = p.color;
|
|
67
|
-
ctx.translate(p.x, p.y);
|
|
68
|
-
ctx.rotate(p.rotation);
|
|
69
|
-
if (p.shape === 'circle') {
|
|
70
|
-
ctx.beginPath();
|
|
71
|
-
ctx.arc(0, 0, p.size / 2, 0, Math.PI * 2);
|
|
72
|
-
ctx.fill();
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
ctx.fillRect(-p.size / 2, -p.size / 2, p.size, p.size * 0.6);
|
|
76
|
-
}
|
|
77
|
-
ctx.restore();
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const INTENSITY_COUNTS = { light: 20, medium: 40, heavy: 80 };
|
|
2
|
-
const DEFAULT_EMOJI = '🎉';
|
|
3
|
-
export const emojiRainEffect = {
|
|
4
|
-
init(width, _height, config) {
|
|
5
|
-
const count = INTENSITY_COUNTS[config.intensity];
|
|
6
|
-
const emoji = typeof config.props?.emoji === 'string' ? config.props.emoji : DEFAULT_EMOJI;
|
|
7
|
-
const particles = [];
|
|
8
|
-
for (let i = 0; i < count; i++) {
|
|
9
|
-
particles.push({
|
|
10
|
-
x: Math.random() * width,
|
|
11
|
-
y: Math.random() * -200,
|
|
12
|
-
vx: 0,
|
|
13
|
-
vy: Math.random() * 1.5 + 1,
|
|
14
|
-
rotation: 0,
|
|
15
|
-
rotationSpeed: 0,
|
|
16
|
-
size: Math.random() * 12 + 16,
|
|
17
|
-
color: '#000000',
|
|
18
|
-
opacity: 1,
|
|
19
|
-
shape: 'emoji',
|
|
20
|
-
emoji,
|
|
21
|
-
data: {
|
|
22
|
-
/** Phase offset for horizontal wobble */
|
|
23
|
-
wobblePhase: Math.random() * Math.PI * 2,
|
|
24
|
-
/** Amplitude of horizontal wobble */
|
|
25
|
-
wobbleAmp: Math.random() * 1.5 + 0.5,
|
|
26
|
-
/** Original x for wobble base */
|
|
27
|
-
originX: 0,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
// Store originX after x is set
|
|
32
|
-
for (const p of particles) {
|
|
33
|
-
if (p.data)
|
|
34
|
-
p.data.originX = p.x;
|
|
35
|
-
}
|
|
36
|
-
return particles;
|
|
37
|
-
},
|
|
38
|
-
update(particles, _dt, elapsed) {
|
|
39
|
-
let anyVisible = false;
|
|
40
|
-
for (const p of particles) {
|
|
41
|
-
// Fall downward
|
|
42
|
-
p.y += p.vy;
|
|
43
|
-
// Horizontal wobble via sine wave
|
|
44
|
-
const phase = p.data?.wobblePhase ?? 0;
|
|
45
|
-
const amp = p.data?.wobbleAmp ?? 1;
|
|
46
|
-
const originX = p.data?.originX ?? p.x;
|
|
47
|
-
p.x = originX + Math.sin(elapsed * 0.003 + phase) * amp * 20;
|
|
48
|
-
// Fade when past bottom of viewport
|
|
49
|
-
if (p.y > 600) {
|
|
50
|
-
p.opacity -= 0.02;
|
|
51
|
-
if (p.opacity < 0)
|
|
52
|
-
p.opacity = 0;
|
|
53
|
-
}
|
|
54
|
-
if (p.opacity > 0.01) {
|
|
55
|
-
anyVisible = true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return anyVisible;
|
|
59
|
-
},
|
|
60
|
-
render(ctx, particles) {
|
|
61
|
-
for (const p of particles) {
|
|
62
|
-
if (p.opacity < 0.01 || !p.emoji)
|
|
63
|
-
continue;
|
|
64
|
-
ctx.save();
|
|
65
|
-
ctx.globalAlpha = p.opacity;
|
|
66
|
-
ctx.font = `${p.size}px serif`;
|
|
67
|
-
ctx.textAlign = 'center';
|
|
68
|
-
ctx.textBaseline = 'middle';
|
|
69
|
-
ctx.fillText(p.emoji, p.x, p.y);
|
|
70
|
-
ctx.restore();
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
const PARTICLES_PER_BURST = { light: 20, medium: 40, heavy: 80 };
|
|
2
|
-
const BURST_COUNTS = { light: 3, medium: 4, heavy: 5 };
|
|
3
|
-
export const fireworksEffect = {
|
|
4
|
-
init(width, height, config) {
|
|
5
|
-
const perBurst = PARTICLES_PER_BURST[config.intensity];
|
|
6
|
-
const burstCount = BURST_COUNTS[config.intensity];
|
|
7
|
-
const colors = config.colors.length > 0 ? config.colors : ['#ff4444', '#44ff44', '#4444ff'];
|
|
8
|
-
const particles = [];
|
|
9
|
-
for (let b = 0; b < burstCount; b++) {
|
|
10
|
-
const cx = Math.random() * width * 0.8 + width * 0.1;
|
|
11
|
-
const cy = Math.random() * height * 0.6;
|
|
12
|
-
const burstColor = colors[Math.floor(Math.random() * colors.length)];
|
|
13
|
-
for (let i = 0; i < perBurst; i++) {
|
|
14
|
-
const angle = (Math.PI * 2 * i) / perBurst + (Math.random() - 0.5) * 0.3;
|
|
15
|
-
const speed = Math.random() * 3 + 2;
|
|
16
|
-
particles.push({
|
|
17
|
-
x: cx,
|
|
18
|
-
y: cy,
|
|
19
|
-
vx: Math.cos(angle) * speed,
|
|
20
|
-
vy: Math.sin(angle) * speed,
|
|
21
|
-
rotation: 0,
|
|
22
|
-
rotationSpeed: 0,
|
|
23
|
-
size: Math.random() * 3 + 2,
|
|
24
|
-
color: burstColor,
|
|
25
|
-
opacity: 1,
|
|
26
|
-
shape: 'circle',
|
|
27
|
-
data: { centerX: cx, centerY: cy },
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return particles;
|
|
32
|
-
},
|
|
33
|
-
update(particles, _dt, _elapsed) {
|
|
34
|
-
let anyVisible = false;
|
|
35
|
-
for (const p of particles) {
|
|
36
|
-
// Deceleration
|
|
37
|
-
p.vx *= 0.97;
|
|
38
|
-
p.vy *= 0.97;
|
|
39
|
-
// Slight gravity
|
|
40
|
-
p.vy += 0.03;
|
|
41
|
-
// Movement
|
|
42
|
-
p.x += p.vx;
|
|
43
|
-
p.y += p.vy;
|
|
44
|
-
// Fade over time
|
|
45
|
-
p.opacity -= 0.008;
|
|
46
|
-
if (p.opacity < 0)
|
|
47
|
-
p.opacity = 0;
|
|
48
|
-
if (p.opacity > 0.01) {
|
|
49
|
-
anyVisible = true;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return anyVisible;
|
|
53
|
-
},
|
|
54
|
-
render(ctx, particles) {
|
|
55
|
-
for (const p of particles) {
|
|
56
|
-
if (p.opacity < 0.01)
|
|
57
|
-
continue;
|
|
58
|
-
ctx.save();
|
|
59
|
-
ctx.globalAlpha = p.opacity;
|
|
60
|
-
ctx.fillStyle = p.color;
|
|
61
|
-
ctx.shadowBlur = 12;
|
|
62
|
-
ctx.shadowColor = p.color;
|
|
63
|
-
ctx.beginPath();
|
|
64
|
-
ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
|
|
65
|
-
ctx.fill();
|
|
66
|
-
ctx.restore();
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const INTENSITY_COUNTS = { light: 30, medium: 60, heavy: 120 };
|
|
2
|
-
export const sparklesEffect = {
|
|
3
|
-
init(width, height, config) {
|
|
4
|
-
const count = INTENSITY_COUNTS[config.intensity];
|
|
5
|
-
const colors = config.colors.length > 0 ? config.colors : ['#ffd700', '#ffffff', '#fffacd'];
|
|
6
|
-
const particles = [];
|
|
7
|
-
for (let i = 0; i < count; i++) {
|
|
8
|
-
particles.push({
|
|
9
|
-
x: Math.random() * width,
|
|
10
|
-
y: Math.random() * height,
|
|
11
|
-
vx: (Math.random() - 0.5) * 0.3,
|
|
12
|
-
vy: -(Math.random() * 0.5 + 0.2),
|
|
13
|
-
rotation: Math.random() * Math.PI * 2,
|
|
14
|
-
rotationSpeed: (Math.random() - 0.5) * 0.1,
|
|
15
|
-
size: Math.random() * 4 + 2,
|
|
16
|
-
color: colors[Math.floor(Math.random() * colors.length)],
|
|
17
|
-
opacity: Math.random() * 0.5 + 0.5,
|
|
18
|
-
shape: 'circle',
|
|
19
|
-
data: {
|
|
20
|
-
/** Phase offset for sine-wave twinkle */
|
|
21
|
-
phase: Math.random() * Math.PI * 2,
|
|
22
|
-
/** Base opacity before twinkle modulation */
|
|
23
|
-
baseOpacity: Math.random() * 0.5 + 0.5,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return particles;
|
|
28
|
-
},
|
|
29
|
-
update(particles, _dt, elapsed) {
|
|
30
|
-
let anyVisible = false;
|
|
31
|
-
for (const p of particles) {
|
|
32
|
-
// Gentle upward float
|
|
33
|
-
p.x += p.vx;
|
|
34
|
-
p.y += p.vy;
|
|
35
|
-
p.rotation += p.rotationSpeed;
|
|
36
|
-
// Gradually fade out over lifetime
|
|
37
|
-
if (p.data) {
|
|
38
|
-
p.data.baseOpacity = (p.data.baseOpacity ?? 1) - 0.001;
|
|
39
|
-
if (p.data.baseOpacity < 0)
|
|
40
|
-
p.data.baseOpacity = 0;
|
|
41
|
-
}
|
|
42
|
-
// Twinkle — oscillate opacity with sine wave
|
|
43
|
-
const phase = p.data?.phase ?? 0;
|
|
44
|
-
const baseOpacity = p.data?.baseOpacity ?? 1;
|
|
45
|
-
if (baseOpacity <= 0.01) {
|
|
46
|
-
p.opacity = 0;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const twinkle = Math.sin(elapsed * 0.005 + phase) * 0.4 + 0.6;
|
|
50
|
-
p.opacity = baseOpacity * twinkle;
|
|
51
|
-
}
|
|
52
|
-
if (p.opacity > 0.01) {
|
|
53
|
-
anyVisible = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return anyVisible;
|
|
57
|
-
},
|
|
58
|
-
render(ctx, particles) {
|
|
59
|
-
for (const p of particles) {
|
|
60
|
-
if (p.opacity < 0.01)
|
|
61
|
-
continue;
|
|
62
|
-
ctx.save();
|
|
63
|
-
ctx.globalAlpha = p.opacity;
|
|
64
|
-
ctx.fillStyle = p.color;
|
|
65
|
-
ctx.translate(p.x, p.y);
|
|
66
|
-
ctx.rotate(p.rotation);
|
|
67
|
-
// Draw a 4-point diamond/star shape
|
|
68
|
-
const s = p.size;
|
|
69
|
-
ctx.beginPath();
|
|
70
|
-
ctx.moveTo(0, -s);
|
|
71
|
-
ctx.lineTo(s * 0.3, -s * 0.3);
|
|
72
|
-
ctx.lineTo(s, 0);
|
|
73
|
-
ctx.lineTo(s * 0.3, s * 0.3);
|
|
74
|
-
ctx.lineTo(0, s);
|
|
75
|
-
ctx.lineTo(-s * 0.3, s * 0.3);
|
|
76
|
-
ctx.lineTo(-s, 0);
|
|
77
|
-
ctx.lineTo(-s * 0.3, -s * 0.3);
|
|
78
|
-
ctx.closePath();
|
|
79
|
-
ctx.fill();
|
|
80
|
-
ctx.restore();
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export class CelebrationEngine {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.canvas = null;
|
|
4
|
-
this.ctx = null;
|
|
5
|
-
this.rafId = null;
|
|
6
|
-
this.particles = [];
|
|
7
|
-
this.startTime = 0;
|
|
8
|
-
this.lastFrame = 0;
|
|
9
|
-
this.duration = 0;
|
|
10
|
-
this.effect = null;
|
|
11
|
-
this.container = null;
|
|
12
|
-
}
|
|
13
|
-
start(container, effect, config) {
|
|
14
|
-
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
15
|
-
if (prefersReducedMotion) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
this.container = container;
|
|
19
|
-
this.effect = effect;
|
|
20
|
-
this.duration = config.duration;
|
|
21
|
-
// Create fullscreen canvas
|
|
22
|
-
const canvas = document.createElement('canvas');
|
|
23
|
-
canvas.setAttribute('data-syntro-celebrate', '');
|
|
24
|
-
Object.assign(canvas.style, {
|
|
25
|
-
position: 'fixed',
|
|
26
|
-
inset: '0',
|
|
27
|
-
pointerEvents: 'none',
|
|
28
|
-
zIndex: '2147483646',
|
|
29
|
-
});
|
|
30
|
-
const dpr = window.devicePixelRatio || 1;
|
|
31
|
-
const width = window.innerWidth;
|
|
32
|
-
const height = window.innerHeight;
|
|
33
|
-
canvas.width = width * dpr;
|
|
34
|
-
canvas.height = height * dpr;
|
|
35
|
-
canvas.style.width = `${width}px`;
|
|
36
|
-
canvas.style.height = `${height}px`;
|
|
37
|
-
const ctx = canvas.getContext('2d');
|
|
38
|
-
if (!ctx) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
ctx.scale(dpr, dpr);
|
|
42
|
-
this.canvas = canvas;
|
|
43
|
-
this.ctx = ctx;
|
|
44
|
-
container.appendChild(canvas);
|
|
45
|
-
// Initialize particles
|
|
46
|
-
this.particles = effect.init(width, height, config);
|
|
47
|
-
this.startTime = performance.now();
|
|
48
|
-
this.lastFrame = this.startTime;
|
|
49
|
-
// Start animation loop
|
|
50
|
-
this.tick = this.tick.bind(this);
|
|
51
|
-
this.rafId = requestAnimationFrame(this.tick);
|
|
52
|
-
}
|
|
53
|
-
stop() {
|
|
54
|
-
if (this.rafId !== null) {
|
|
55
|
-
cancelAnimationFrame(this.rafId);
|
|
56
|
-
this.rafId = null;
|
|
57
|
-
}
|
|
58
|
-
if (this.canvas && this.container) {
|
|
59
|
-
this.canvas.remove();
|
|
60
|
-
this.canvas = null;
|
|
61
|
-
}
|
|
62
|
-
this.ctx = null;
|
|
63
|
-
this.effect = null;
|
|
64
|
-
this.container = null;
|
|
65
|
-
this.particles = [];
|
|
66
|
-
}
|
|
67
|
-
tick(now) {
|
|
68
|
-
if (!this.ctx || !this.canvas || !this.effect)
|
|
69
|
-
return;
|
|
70
|
-
const elapsed = now - this.startTime;
|
|
71
|
-
const dt = now - this.lastFrame;
|
|
72
|
-
this.lastFrame = now;
|
|
73
|
-
// Auto-stop after duration
|
|
74
|
-
if (elapsed >= this.duration) {
|
|
75
|
-
this.stop();
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
// Clear canvas
|
|
79
|
-
const width = this.canvas.width / (window.devicePixelRatio || 1);
|
|
80
|
-
const height = this.canvas.height / (window.devicePixelRatio || 1);
|
|
81
|
-
this.ctx.clearRect(0, 0, width, height);
|
|
82
|
-
// Update physics — stop if all particles are done
|
|
83
|
-
const alive = this.effect.update(this.particles, dt, elapsed);
|
|
84
|
-
if (!alive) {
|
|
85
|
-
this.stop();
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
// Render
|
|
89
|
-
this.effect.render(this.ctx, this.particles);
|
|
90
|
-
// Next frame
|
|
91
|
-
this.rafId = requestAnimationFrame(this.tick);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { confettiEffect } from './effects/confetti';
|
|
2
|
-
import { emojiRainEffect } from './effects/emoji-rain';
|
|
3
|
-
import { fireworksEffect } from './effects/fireworks';
|
|
4
|
-
import { sparklesEffect } from './effects/sparkles';
|
|
5
|
-
import { CelebrationEngine } from './engine';
|
|
6
|
-
const FALLBACK_COLORS = [
|
|
7
|
-
'#ff0000',
|
|
8
|
-
'#00ff00',
|
|
9
|
-
'#0000ff',
|
|
10
|
-
'#ffff00',
|
|
11
|
-
'#ff00ff',
|
|
12
|
-
'#00ffff',
|
|
13
|
-
'#ff8800',
|
|
14
|
-
'#8800ff',
|
|
15
|
-
];
|
|
16
|
-
/**
|
|
17
|
-
* Build a celebration palette from the theme's primary/hover colors.
|
|
18
|
-
* Returns 6 color variants (solid, transparent, white accent) for visual variety.
|
|
19
|
-
*/
|
|
20
|
-
function buildThemePalette(primary, hover) {
|
|
21
|
-
return [primary, hover, `${primary}cc`, `${hover}cc`, '#ffffff', `${primary}80`];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Read --sc-color-primary and --sc-color-primary-hover from the overlay root.
|
|
25
|
-
* Returns a theme palette if both are available, otherwise null.
|
|
26
|
-
*/
|
|
27
|
-
function readThemeColors(overlayRoot) {
|
|
28
|
-
try {
|
|
29
|
-
const styles = getComputedStyle(overlayRoot);
|
|
30
|
-
const primary = styles.getPropertyValue('--sc-color-primary')?.trim();
|
|
31
|
-
const hover = styles.getPropertyValue('--sc-color-primary-hover')?.trim();
|
|
32
|
-
if (primary?.startsWith('#') && primary.length >= 7) {
|
|
33
|
-
return buildThemePalette(primary, hover || primary);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
/* fallback */
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
const effectRegistry = new Map([
|
|
42
|
-
['confetti', confettiEffect],
|
|
43
|
-
['fireworks', fireworksEffect],
|
|
44
|
-
['sparkles', sparklesEffect],
|
|
45
|
-
['emoji-rain', emojiRainEffect],
|
|
46
|
-
]);
|
|
47
|
-
export const executeCelebrate = async (action, context) => {
|
|
48
|
-
const effect = effectRegistry.get(action.effect);
|
|
49
|
-
if (!effect) {
|
|
50
|
-
console.warn(`[adaptive-overlays] Unknown celebration effect: "${action.effect}". Available: ${[...effectRegistry.keys()].join(', ')}`);
|
|
51
|
-
return { cleanup: () => { } };
|
|
52
|
-
}
|
|
53
|
-
// Colors priority: action.colors > theme palette > hardcoded fallback
|
|
54
|
-
const colors = action.colors ?? readThemeColors(context.overlayRoot) ?? FALLBACK_COLORS;
|
|
55
|
-
const config = {
|
|
56
|
-
duration: action.duration ?? 3000,
|
|
57
|
-
intensity: action.intensity ?? 'medium',
|
|
58
|
-
colors,
|
|
59
|
-
props: action.props,
|
|
60
|
-
};
|
|
61
|
-
const engine = new CelebrationEngine();
|
|
62
|
-
engine.start(context.overlayRoot, effect, config);
|
|
63
|
-
context.publishEvent('action.applied', {
|
|
64
|
-
id: context.generateId(),
|
|
65
|
-
kind: 'overlays:celebrate',
|
|
66
|
-
effect: action.effect,
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
cleanup: () => {
|
|
70
|
-
engine.stop();
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/editor.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adaptive Overlays - Editor Module (barrel)
|
|
3
|
-
*
|
|
4
|
-
* Re-exports from the split modules for backward compatibility.
|
|
5
|
-
* - State/helpers: overlay-editor-state.ts
|
|
6
|
-
* - UI component: overlay-editor-ui.tsx
|
|
7
|
-
*/
|
|
8
|
-
import { OverlaysEditor } from './overlay-editor-ui';
|
|
9
|
-
export { OverlaysEditor };
|
|
10
|
-
/**
|
|
11
|
-
* Editor module configuration.
|
|
12
|
-
*/
|
|
13
|
-
export declare const editor: {
|
|
14
|
-
panel: {
|
|
15
|
-
title: string;
|
|
16
|
-
icon: string;
|
|
17
|
-
description: string;
|
|
18
|
-
};
|
|
19
|
-
component: typeof OverlaysEditor;
|
|
20
|
-
};
|
|
21
|
-
export declare const editorPanel: {
|
|
22
|
-
title: string;
|
|
23
|
-
icon: string;
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
26
|
-
export default OverlaysEditor;
|
|
27
|
-
//# sourceMappingURL=editor.d.ts.map
|
package/dist/editor.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAAe,CAAC;AAExC,eAAe,cAAc,CAAC"}
|
package/dist/editor.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adaptive Overlays - Editor Module (barrel)
|
|
3
|
-
*
|
|
4
|
-
* Re-exports from the split modules for backward compatibility.
|
|
5
|
-
* - State/helpers: overlay-editor-state.ts
|
|
6
|
-
* - UI component: overlay-editor-ui.tsx
|
|
7
|
-
*/
|
|
8
|
-
import { OverlaysEditor } from './overlay-editor-ui';
|
|
9
|
-
export { OverlaysEditor };
|
|
10
|
-
/**
|
|
11
|
-
* Editor module configuration.
|
|
12
|
-
*/
|
|
13
|
-
export const editor = {
|
|
14
|
-
panel: {
|
|
15
|
-
title: 'Overlays',
|
|
16
|
-
icon: '\u{1f4ac}',
|
|
17
|
-
description: 'Tooltips, highlights, and visual overlays',
|
|
18
|
-
},
|
|
19
|
-
component: OverlaysEditor,
|
|
20
|
-
};
|
|
21
|
-
export const editorPanel = editor.panel;
|
|
22
|
-
export default OverlaysEditor;
|