@handysolver/festive 0.1.0 → 0.2.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.
@@ -0,0 +1,289 @@
1
+ export const css = `
2
+ [class^="hsx-"]{box-sizing:border-box}
3
+ .hsx-backdrop{position:fixed;inset:0;z-index:0;overflow:hidden;pointer-events:none}
4
+ .hsx-header-backdrop{position:absolute;inset:0;z-index:-10;pointer-events:none;clip-path:inset(0)}
5
+ .hsx-surface{display:block;position:absolute;inset:0;width:100%;height:100%;max-width:none;border-radius:inherit;pointer-events:none}
6
+ .hsx-behind{z-index:-10}
7
+ .hsx-bloom{position:fixed;inset:0;pointer-events:none;transition:opacity 1s cubic-bezier(.4,0,.2,1)}
8
+ .hsx-bloom-light{position:absolute;left:0;right:0;top:-40px;height:300px;filter:blur(64px)}
9
+ .hsx-fill{position:absolute;inset:0}
10
+ .hsx-garland{position:absolute;left:20px;right:20px;top:100%;margin-top:-2px;height:3px;pointer-events:none}
11
+ .hsx-runner{position:absolute;inset:0;border-radius:9999px}
12
+ .hsx-strand{position:absolute;left:0;right:0;top:0}
13
+ .hsx-wire{display:block;position:absolute;left:0;top:0;max-width:none;overflow:visible}
14
+ .hsx-wire-bulb{stroke:oklch(37.8% .077 168.94)}
15
+ .hsx-wire-marigold{stroke:oklch(45.3% .124 130.933)}
16
+ html[data-festive-theme=dark] .hsx-wire-bulb{stroke:oklch(50.8% .118 165.612)}
17
+ html[data-festive-theme=dark] .hsx-wire-marigold{stroke:oklch(64.8% .2 131.684)}
18
+ .hsx-hang{position:absolute;width:0;transform-origin:top}
19
+ .hsx-diyas{position:absolute;left:4%;right:4%;top:-1px;display:flex;justify-content:space-between;line-height:24px}
20
+ .hsx-diya{display:block;width:17px;height:17px;overflow:visible}
21
+ .hsx-block{display:block}
22
+ .hsx-wide-only{display:none}
23
+ .hsx-badge{position:relative;display:flex;align-items:center;gap:4px;flex-shrink:0;padding:4px 6px 4px 10px;border:2px solid var(--hsx-border);border-radius:9999px;
24
+ background-color:rgb(255 255 255 / .95);color:oklch(20.8% .042 265.755);box-shadow:0 20px 25px -5px var(--hsx-shadow),0 8px 10px -6px var(--hsx-shadow);
25
+ backdrop-filter:blur(24px);font-size:14px;line-height:20px;font-weight:600;white-space:nowrap}
26
+ html[data-festive-theme=dark] .hsx-badge{background-color:oklch(20.8% .042 265.755 / .95);color:oklch(96.8% .007 247.896)}
27
+ .hsx-badge button{margin:0;border:0;background:transparent;color:inherit;font:inherit;letter-spacing:inherit;text-transform:none;cursor:pointer;box-shadow:none;min-width:0;min-height:0}
28
+ .hsx-badge .hsx-celebrate{position:relative;display:flex;align-items:center;gap:10px;padding:2px 0;border-radius:9999px;transition:transform .15s cubic-bezier(.4,0,.2,1)}
29
+ .hsx-celebrate:focus-visible{outline:2px solid currentColor}
30
+ .hsx-celebrate:active{scale:.97}
31
+ .hsx-motif{font-size:16px;line-height:1}
32
+ .hsx-flag{width:20px;height:14px;border-radius:3px;box-shadow:0 0 0 1px rgb(0 0 0 / .2);background:linear-gradient(#f97316 33%,#fff 33% 67%,#16a34a 67%)}
33
+ .hsx-greeting,.hsx-chip{display:none}
34
+ .hsx-chip{padding:2px 8px;border-radius:9999px;font-size:12px;line-height:16px;background-color:oklch(20.8% .042 265.755 / .05);transition:background-color .15s cubic-bezier(.4,0,.2,1)}
35
+ .hsx-celebrate:hover .hsx-chip{background-color:oklch(20.8% .042 265.755 / .1)}
36
+ html[data-festive-theme=dark] .hsx-chip{background-color:rgb(255 255 255 / .1)}
37
+ html[data-festive-theme=dark] .hsx-celebrate:hover .hsx-chip{background-color:rgb(255 255 255 / .2)}
38
+ .hsx-badge .hsx-dismiss{position:relative;padding:6px;border-radius:9999px;opacity:.6;transition:color .15s,background-color .15s}
39
+ .hsx-badge .hsx-dismiss:hover{opacity:1;background-color:rgb(0 0 0 / .1)}
40
+ html[data-festive-theme=dark] .hsx-badge .hsx-dismiss:hover{background-color:rgb(255 255 255 / .15)}
41
+ .hsx-dismiss svg{display:block;width:14px;height:14px}
42
+ @media (min-width:640px){.hsx-wide-only{display:block}}
43
+ @media (min-width:1024px){.hsx-badge{padding-left:16px}.hsx-greeting{display:inline}}
44
+ @media (min-width:1280px){.hsx-chip{display:inline}}
45
+ @media print{.hsx-backdrop,.hsx-header-backdrop,.hsx-surface,.hsx-garland{display:none}}
46
+ .hsx-aurora {
47
+ animation: hsx-breathe 4s ease-in-out 3;
48
+ }
49
+ /* Softens where the sidebar's part of the celebration begins and ends */
50
+ .festive-fade {
51
+ mask-image: linear-gradient(transparent, #000 40px, #000 calc(100% - 40px), transparent);
52
+ }
53
+ .hsx-star {
54
+ position: absolute;
55
+ clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
56
+ opacity: 0.35;
57
+ animation: hsx-twinkle 6s ease-in-out infinite;
58
+ }
59
+
60
+ /* The line under the top bar */
61
+ .hsx-runner[data-garland='diyas'] {
62
+ box-shadow: 0 1px 10px 1px rgb(245 158 11 / 0.75);
63
+ }
64
+ .hsx-runner::after {
65
+ content: '';
66
+ position: absolute;
67
+ inset: 0;
68
+ border-radius: 9999px;
69
+ }
70
+ .hsx-runner[data-garland='diyas']::after {
71
+ box-shadow: 0 0 24px 6px rgb(249 115 22 / 0.8);
72
+ animation: hsx-glow 2.6s ease-in-out infinite;
73
+ }
74
+ .hsx-runner[data-garland='shimmer'] {
75
+ box-shadow: 0 1px 8px rgb(202 138 4 / 0.45);
76
+ }
77
+ .hsx-runner[data-garland='shimmer'],
78
+ .hsx-runner[data-garland='iridescent'] {
79
+ overflow: hidden;
80
+ }
81
+ .hsx-runner[data-garland='shimmer']::after {
82
+ width: 25%;
83
+ background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.9), transparent);
84
+ transform: translateX(-110%);
85
+ animation: hsx-glint 4s ease-in-out infinite;
86
+ }
87
+ .hsx-runner[data-garland='iridescent'] {
88
+ box-shadow: 0 1px 8px rgb(236 72 153 / 0.35);
89
+ }
90
+ /* The colours run twice across double the width, so every position shows the whole range */
91
+ .hsx-runner[data-garland='iridescent']::after {
92
+ width: 200%;
93
+ background: linear-gradient(90deg, #f472b6, #fbbf24, #22d3ee, #a78bfa, #f472b6, #fbbf24, #22d3ee, #a78bfa, #f472b6);
94
+ animation: hsx-shift 8s linear infinite;
95
+ }
96
+
97
+ /* Fairy lights: --lit (0 to 1) is set by the pointer. Centred on the wire, which has no width */
98
+ .hsx-bulb,
99
+ .hsx-marigold {
100
+ position: absolute;
101
+ left: 0;
102
+ translate: -50% 0;
103
+ }
104
+ .hsx-bulb {
105
+ top: 2px;
106
+ width: 7px;
107
+ height: 10px;
108
+ border-radius: 42% 42% 50% 50%;
109
+ background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 0.85), transparent 45%), currentColor;
110
+ filter: drop-shadow(0 0 7px currentColor);
111
+ animation: hsx-breathe-light 2.4s ease-in-out infinite;
112
+ }
113
+ html:not([data-festive-theme=dark]) .hsx-bulb {
114
+ box-shadow: inset 0 0 0 0.75px rgb(15 23 42 / 0.28);
115
+ }
116
+ .hsx-bulb::before {
117
+ content: '';
118
+ position: absolute;
119
+ left: 50%;
120
+ top: -2.5px;
121
+ width: 3.5px;
122
+ height: 3.5px;
123
+ margin-left: -1.75px;
124
+ border-radius: 1px;
125
+ background: #14532d;
126
+ }
127
+ .hsx-bulb::after {
128
+ content: '';
129
+ position: absolute;
130
+ inset: 0;
131
+ border-radius: inherit;
132
+ background: radial-gradient(circle, #fff, transparent 75%);
133
+ box-shadow: 0 0 14px 5px currentColor;
134
+ opacity: var(--lit, 0);
135
+ }
136
+ .hsx-marigold {
137
+ top: -1px;
138
+ width: 11px;
139
+ height: 11px;
140
+ border-radius: 50%;
141
+ background: radial-gradient(circle, #fde047 0 18%, #f59e0b 20% 48%, #ea580c 52% 62%, #f97316 64%);
142
+ box-shadow: 0 1px 4px rgb(194 65 12 / 0.5), 0 0 calc(var(--lit, 0) * 14px) calc(var(--lit, 0) * 4px) #f59e0b;
143
+ }
144
+ /* Every third is a pair of mango leaves */
145
+ span:nth-child(3n) > .hsx-marigold {
146
+ top: 1px;
147
+ width: 6px;
148
+ height: 13px;
149
+ border-radius: 0 100% 0 100%;
150
+ rotate: 45deg;
151
+ background: linear-gradient(135deg, #4d7c0f, #84cc16);
152
+ }
153
+
154
+ .hsx-diya {
155
+ filter: drop-shadow(0 0 5px rgb(245 158 11 / 0.9));
156
+ }
157
+ .hsx-diya-flame {
158
+ transform-box: fill-box;
159
+ transform-origin: 50% 100%;
160
+ animation: hsx-flicker 1.5s ease-in-out infinite;
161
+ }
162
+
163
+ /* A band of silk: a wave cut out of the tricolour, drifting, with a highlight passing over it */
164
+ .hsx-silk {
165
+ position: absolute;
166
+ inset: -3px 0 auto;
167
+ height: 10px;
168
+ filter: drop-shadow(0 1px 1px rgb(15 23 42 / 0.35)) drop-shadow(0 2px 5px rgb(249 115 22 / 0.3));
169
+ }
170
+ .hsx-silk {
171
+ overflow: hidden;
172
+ }
173
+ /* The cut-out drifts one wavelength while the cloth inside moves back by as much, so the colours stay put */
174
+ .hsx-silk-wave {
175
+ position: absolute;
176
+ inset: 0 0 0 -120px;
177
+ overflow: hidden;
178
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='10'%3E%3Cpath d='M-30 5 Q0 1 30 5 T90 5 T150 5' fill='none' stroke='%23000' stroke-width='5'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 10px;
179
+ animation: hsx-wave 5s linear infinite;
180
+ }
181
+ .hsx-silk-cloth {
182
+ position: absolute;
183
+ inset: 0 0 0 120px;
184
+ overflow: visible;
185
+ animation: hsx-wave-back 5s linear infinite;
186
+ }
187
+ .hsx-silk-cloth::after {
188
+ content: '';
189
+ position: absolute;
190
+ inset: 0;
191
+ width: 40%;
192
+ background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.75), transparent);
193
+ transform: translateX(-100%);
194
+ animation: hsx-silk-shine 5s linear infinite;
195
+ }
196
+
197
+ /* Metric cards pick up the season on hover, at night only */
198
+ html[data-festival] .festive-card {
199
+ transition: border-color 300ms, box-shadow 300ms;
200
+ }
201
+ html[data-festive-theme=dark] .festive-card:hover {
202
+ border-color: color-mix(in srgb, var(--festive-accent) 45%, transparent);
203
+ box-shadow: 0 4px 20px color-mix(in srgb, var(--festive-accent) 16%, transparent);
204
+ }
205
+
206
+ .hsx-badge[data-festival='holi'] {
207
+ border-color: transparent;
208
+ background: linear-gradient(#fff, #fff) padding-box,
209
+ linear-gradient(90deg, #ec4899, #eab308, #06b6d4, #8b5cf6) border-box;
210
+ }
211
+ html[data-festive-theme=dark] .hsx-badge[data-festival='holi'] {
212
+ background: linear-gradient(#0f172a, #0f172a) padding-box,
213
+ linear-gradient(90deg, #f472b6, #facc15, #22d3ee, #a78bfa) border-box;
214
+ }
215
+ .hsx-badge[data-festival='diwali'] .hsx-motif {
216
+ animation: hsx-flame 2.4s ease-in-out infinite;
217
+ }
218
+ .hsx-shimmer {
219
+ position: absolute;
220
+ inset: 0;
221
+ overflow: hidden;
222
+ border-radius: 9999px;
223
+ pointer-events: none;
224
+ }
225
+ .hsx-shimmer::before {
226
+ content: '';
227
+ position: absolute;
228
+ inset: 0;
229
+ background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--festive-accent) 35%, transparent) 50%, transparent 70%);
230
+ transform: translateX(-110%);
231
+ animation: hsx-sweep 1.6s ease-out 0.4s 2;
232
+ }
233
+
234
+ @keyframes hsx-breathe {
235
+ 50% { transform: translateX(5%) scaleY(1.25); }
236
+ }
237
+ @keyframes hsx-twinkle {
238
+ 0%, 100% { opacity: 0.15; transform: translateY(0) scale(0.7); }
239
+ 50% { opacity: 0.8; transform: translateY(10px) scale(1); }
240
+ }
241
+ @keyframes hsx-glow {
242
+ 0%, 100% { opacity: 1; }
243
+ 50% { opacity: 0.35; }
244
+ }
245
+ @keyframes hsx-glint {
246
+ 60%, 100% { transform: translateX(430%); }
247
+ }
248
+ @keyframes hsx-shift {
249
+ to { transform: translateX(-50%); }
250
+ }
251
+ @keyframes hsx-breathe-light {
252
+ 0%, 100% { opacity: 1; }
253
+ 50% { opacity: 0.7; }
254
+ }
255
+ @keyframes hsx-flicker {
256
+ 0%, 100% { transform: scale(1, 1) skewX(0); }
257
+ 25% { transform: scale(0.94, 1.1) skewX(3deg); }
258
+ 55% { transform: scale(1.05, 0.93) skewX(-3deg); }
259
+ 80% { transform: scale(0.97, 1.05) skewX(2deg); }
260
+ }
261
+ @keyframes hsx-wave {
262
+ to { transform: translateX(120px); }
263
+ }
264
+ @keyframes hsx-wave-back {
265
+ to { transform: translateX(-120px); }
266
+ }
267
+ @keyframes hsx-silk-shine {
268
+ to { transform: translateX(260%); }
269
+ }
270
+ @keyframes hsx-flame {
271
+ 50% { filter: drop-shadow(0 0 5px #f59e0b); }
272
+ }
273
+ @keyframes hsx-sweep {
274
+ to { transform: translateX(110%); }
275
+ }
276
+ @media (prefers-reduced-motion: reduce) {
277
+ .hsx-aurora,
278
+ .hsx-star,
279
+ .hsx-runner,
280
+ .hsx-runner::after,
281
+ .hsx-bulb,
282
+ .hsx-diya-flame,
283
+ .hsx-silk-wave,
284
+ .hsx-silk-cloth,
285
+ .hsx-silk-cloth::after,
286
+ .hsx-badge .hsx-motif,
287
+ .hsx-shimmer::before { animation: none !important; }
288
+ }
289
+ `;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,9 @@
1
1
  export { FestiveLayer } from "./FestiveLayer.js";
2
2
  export type { FestiveLayerProps } from "./FestiveLayer.js";
3
+ export { FestiveProvider, FestiveSurface, FestiveHeaderBackdrop, useFestive } from "./design/FestiveProvider.js";
4
+ export type { FestiveProviderProps, FestiveValue } from "./design/FestiveProvider.js";
5
+ export { FestiveBadge } from "./design/FestiveBadge.js";
6
+ export { FestiveGarland } from "./design/FestiveGarland.js";
7
+ export { FESTIVALS } from "./design/festivals.js";
8
+ export type { ActiveFestival, FestivalKind, FestivalTheme } from "./design/festivals.js";
9
+ export type { Layout, Point } from "./design/celebration.js";
package/dist/index.js CHANGED
@@ -1,2 +1,6 @@
1
1
  "use client";
2
2
  export { FestiveLayer } from "./FestiveLayer.js";
3
+ export { FestiveProvider, FestiveSurface, FestiveHeaderBackdrop, useFestive } from "./design/FestiveProvider.js";
4
+ export { FestiveBadge } from "./design/FestiveBadge.js";
5
+ export { FestiveGarland } from "./design/FestiveGarland.js";
6
+ export { FESTIVALS } from "./design/festivals.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@handysolver/festive",
3
- "version": "0.1.0",
4
- "description": "Drop-in React festival layer: falling emoji, greeting card and accent colour.",
3
+ "version": "0.2.0",
4
+ "description": "Festival celebrations for any React app: confetti, garlands, a greeting badge, or a simple drop-in layer.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",