sparkle-react 0.0.10 → 0.0.12

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/index.css CHANGED
@@ -1,2 +1,2 @@
1
- *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.inset-0{inset:0}.bottom-3{bottom:.75rem}.left-1\/2{left:50%}.right-3{right:.75rem}.top-1\/2{top:50%}.flex{display:flex}.h-\[34px\]{height:34px}.w-\[34px\]{width:34px}.w-full{width:100%}.min-w-\[124px\]{min-width:124px}.flex-shrink-0{flex-shrink:0}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-full{--tw-translate-y: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.gap-3{gap:.75rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.bg-\[\#313131\]{--tw-bg-opacity: 1;background-color:rgb(49 49 49 / var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/60{background-color:#0009}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-3{padding:.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.capitalize{text-transform:capitalize}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-white\/10{--tw-ring-color: rgb(255 255 255 / .1)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-500{transition-duration:.5s}.hover\:-translate-y-1:hover{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
1
+ *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.inset-0{inset:0}.bottom-3{bottom:.75rem}.left-1\/2{left:50%}.right-3{right:.75rem}.top-1\/2{top:50%}.z-50{z-index:50}.flex{display:flex}.inline-flex{display:inline-flex}.h-9{height:2.25rem}.h-\[34px\]{height:34px}.w-\[34px\]{width:34px}.w-full{width:100%}.min-w-\[124px\]{min-width:124px}.max-w-xs{max-width:20rem}.flex-shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.bg-\[\#313131\]{--tw-bg-opacity: 1;background-color:rgb(49 49 49 / var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/60{background-color:#0009}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.tracking-tight{letter-spacing:-.025em}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-white\/10{--tw-ring-color: rgb(255 255 255 / .1)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-colors{transition-property:color,background-color,border-color,fill,stroke,-webkit-text-decoration-color;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,-webkit-text-decoration-color;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}
2
2
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/globals.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-3 {\n bottom: 0.75rem;\n}\n.left-1\\/2 {\n left: 50%;\n}\n.right-3 {\n right: 0.75rem;\n}\n.top-1\\/2 {\n top: 50%;\n}\n.flex {\n display: flex;\n}\n.h-\\[34px\\] {\n height: 34px;\n}\n.w-\\[34px\\] {\n width: 34px;\n}\n.w-full {\n width: 100%;\n}\n.min-w-\\[124px\\] {\n min-width: 124px;\n}\n.flex-shrink-0 {\n flex-shrink: 0;\n}\n.-translate-x-full {\n --tw-translate-x: -100%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.-translate-y-full {\n --tw-translate-y: -100%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse));\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.bg-\\[\\#313131\\] {\n --tw-bg-opacity: 1;\n background-color: rgb(49 49 49 / var(--tw-bg-opacity));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n.bg-black\\/60 {\n background-color: rgb(0 0 0 / 0.6);\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-3 {\n padding: 0.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-gray-400 {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.ring-1 {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.ring-white\\/10 {\n --tw-ring-color: rgb(255 255 255 / 0.1);\n}\n.backdrop-blur-xl {\n --tw-backdrop-blur: blur(24px);\n -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n}\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.duration-500 {\n transition-duration: 500ms;\n}\n.hover\\:-translate-y-1:hover {\n --tw-translate-y: -0.25rem;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n"],"mappings":"AAOA,EACA,QACA,OACE,WAAY,WACZ,aAAc,EACd,aAAc,MACd,aAAc,OAChB,CAEA,QACA,OACE,cAAc,EAChB,CAWA,KACE,YAAa,IACb,yBAA0B,KAC1B,cAAe,EACf,YAAa,EACV,SAAU,EACb,YAAa,aAAa,CAAE,SAAS,CAAE,aAAa,CAAE,kBAAkB,CAAE,QAAU,CAAE,MAAM,CAAE,cAAgB,CAAE,KAAK,CAAE,SAAW,CAAE,UAAU,CAAE,mBAAmB,CAAE,gBAAgB,CAAE,eAAiB,CAAE,mBAC1M,sBAAuB,OACvB,wBAAyB,MAC3B,CAOA,KA9CA,OA+CU,EACR,YAAa,OACf,CAQA,GACE,OAAQ,EACR,MAAO,QACP,iBAAkB,GACpB,CAMA,IAAI,OAAO,CAAC,QACV,wBAAyB,UAAU,OAC3B,gBAAiB,UAAU,MACrC,CAMA,GACA,GACA,GACA,GACA,GACA,GACE,UAAW,QACX,YAAa,OACf,CAMA,EACE,MAAO,QACP,gBAAiB,OACnB,CAMA,EACA,OACE,YAAa,MACf,CAOA,KACA,IACA,KACA,IACE,YAAa,YAAY,CAAE,cAAc,CAAE,KAAK,CAAE,MAAM,CAAE,QAAQ,CAAE,eAAiB,CAAE,WAAa,CAAE,UACtG,UAAW,GACb,CAMA,MACE,UAAW,GACb,CAMA,IACA,IACE,UAAW,IACX,YAAa,EACb,SAAU,SACV,eAAgB,QAClB,CAEA,IACE,OAAQ,MACV,CAEA,IACE,IAAK,KACP,CAQA,MACE,YAAa,EACb,aAAc,QACd,gBAAiB,QACnB,CAQA,O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,IAAI,IAAI,EAAE,IAClC,yBAAyB,EAAE,EAAE,MAC7B,kBAAkB,EAAE,EAAE,MACtB,aAAa,EAAE,EAAE,MACjB,qBAAqB,EAAE,EAAE,MACzB,YACA,kBACA,gBACA,iBACA,kBACA,cACA,gBACA,aACA,mBACA,qBACA,2BACA,yBACA,0BACA,2BACA,uBACA,wBACA,yBACA,qBACF,CAEA,WACE,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,aACA,aACA,kBACA,6BAA6B,UAC7B,eACA,oBACA,sBACA,uBACA,wBACA,kBACA,wBAAwB,IACxB,wBAAwB,KACxB,iBAAiB,IAAI,GAAG,IAAI,IAAI,EAAE,IAClC,yBAAyB,EAAE,EAAE,MAC7B,kBAAkB,EAAE,EAAE,MACtB,aAAa,EAAE,EAAE,MACjB,qBAAqB,EAAE,EAAE,MACzB,YACA,kBACA,gBACA,iBACA,kBACA,cACA,gBACA,aACA,mBACA,qBACA,2BACA,yBACA,0BACA,2BACA,uBACA,wBACA,yBACA,qBACF,CACA,CAAC,MACC,SAAU,KACZ,CACA,CAAC,SACC,SAAU,QACZ,CACA,CAAC,QA9dD,MA+dS,CACT,CACA,CAAC,SACC,OAAQ,MACV,CACA,CAAC,UACC,KAAM,GACR,CACA,CAAC,QACC,MAAO,MACT,CACA,CAAC,SACC,IAAK,GACP,CACA,CAAC,KACC,QAAS,IACX,CACA,CAAC,WACC,OAAQ,IACV,CACA,CAAC,WACC,MAAO,IACT,CACA,CAAC,OACC,MAAO,IACT,CACA,CAAC,gBACC,UAAW,KACb,CACA,CAAC,cACC,YAAa,CACf,CACA,CAAC,kBACC,kBAAkB,MAClB,UAAW,UAAU,IAAI,iBAAiB,CAAE,IAAI,mBAAmB,OAAO,IAAI,cAAc,KAAM,IAAI,cAAc,MAAM,IAAI,cAAc,OAAO,IAAI,eAAe,OAAO,IAAI,cACnL,CACA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ACC,oBAAqB,IACrB,2BAA4B,aAAa,EAAG,CAAE,CAAC,CAAE,EAAG,CAAE,GACtD,oBAAqB,IACvB,CACA,CAAC,aACC,oBAAqB,GACvB,CACA,CAAC,qBAAqB,OACpB,kBAAkB,QAClB,UAAW,UAAU,IAAI,iBAAiB,CAAE,IAAI,mBAAmB,OAAO,IAAI,cAAc,KAAM,IAAI,cAAc,MAAM,IAAI,cAAc,OAAO,IAAI,eAAe,OAAO,IAAI,cACnL","names":[]}
1
+ {"version":3,"sources":["../src/globals.css"],"sourcesContent":["/*\n! tailwindcss v3.3.0 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-3 {\n bottom: 0.75rem;\n}\n.left-1\\/2 {\n left: 50%;\n}\n.right-3 {\n right: 0.75rem;\n}\n.top-1\\/2 {\n top: 50%;\n}\n.z-50 {\n z-index: 50;\n}\n.flex {\n display: flex;\n}\n.inline-flex {\n display: inline-flex;\n}\n.h-9 {\n height: 2.25rem;\n}\n.h-\\[34px\\] {\n height: 34px;\n}\n.w-\\[34px\\] {\n width: 34px;\n}\n.w-full {\n width: 100%;\n}\n.min-w-\\[124px\\] {\n min-width: 124px;\n}\n.max-w-xs {\n max-width: 20rem;\n}\n.flex-shrink-0 {\n flex-shrink: 0;\n}\n.-translate-x-1\\/2 {\n --tw-translate-x: -50%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.-translate-y-1\\/2 {\n --tw-translate-y: -50%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n@keyframes spin {\n\n to {\n transform: rotate(360deg);\n }\n}\n.animate-spin {\n animation: spin 1s linear infinite;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse));\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));\n}\n.space-y-3 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.bg-\\[\\#313131\\] {\n --tw-bg-opacity: 1;\n background-color: rgb(49 49 49 / var(--tw-bg-opacity));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n.bg-black\\/60 {\n background-color: rgb(0 0 0 / 0.6);\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity));\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-3 {\n padding: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.font-semibold {\n font-weight: 600;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.tracking-tight {\n letter-spacing: -0.025em;\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.ring-1 {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.ring-white\\/10 {\n --tw-ring-color: rgb(255 255 255 / 0.1);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.backdrop-blur-xl {\n --tw-backdrop-blur: blur(24px);\n -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n}\n.transition-colors {\n transition-property: color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.focus-visible\\:outline-none:focus-visible {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n.focus-visible\\:ring-1:focus-visible {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.disabled\\:pointer-events-none:disabled {\n pointer-events: none;\n}\n.disabled\\:opacity-50:disabled {\n opacity: 0.5;\n}\n"],"mappings":"AAOA,EACA,QACA,OACE,WAAY,WACZ,aAAc,EACd,aAAc,MACd,aAAc,OAChB,CAEA,QACA,OACE,cAAc,EAChB,CAWA,KACE,YAAa,IACb,yBAA0B,KAC1B,cAAe,EACf,YAAa,EACV,SAAU,EACb,YAAa,aAAa,CAAE,SAAS,CAAE,aAAa,CAAE,kBAAkB,CAAE,QAAU,CAAE,MAAM,CAAE,cAAgB,CAAE,KAAK,CAAE,SAAW,CAAE,UAAU,CAAE,mBAAmB,CAAE,gBAA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IAAI,yBAAyB,IAAI,0BAA0B,IAAI,sBAAsB,IAAI,uBAAuB,IAAI,wBAAwB,IAAI,qBACnP,gBAAiB,IAAI,oBAAoB,IAAI,0BAA0B,IAAI,wBAAwB,IAAI,yBAAyB,IAAI,0BAA0B,IAAI,sBAAsB,IAAI,uBAAuB,IAAI,wBAAwB,IAAI,oBAC7P,CACA,CAAC,kBACC,oBAAqB,KAAK,CAAE,gBAAgB,CAAE,YAAY,CAAE,IAAI,CAAE,MAAM,CAAE,8BAC1E,oBAAqB,KAAK,CAAE,gBAAgB,CAAE,YAAY,CAAE,qBAAqB,CAAE,IAAI,CAAE,OACzF,oBAAqB,KAAK,CAAE,gBAAgB,CAAE,YAAY,CAAE,qBAAqB,CAAE,IAAI,CAAE,MAAM,CAAE,8BACjG,2BAA4B,aAAa,EAAG,CAAE,CAAC,CAAE,EAAG,CAAE,GACtD,oBAAqB,IACvB,CACA,CAAC,2BAA2B,eAC1B,QAAS,IAAI,MAAM,YACnB,eAAgB,GAClB,CACA,CAAC,qBAAqB,eACpB,yBAAyB,IAAI,iBAAiB,EAAE,EAAE,EAAE,IAAI,wBAAwB,IAAI,wBACpF,kBAAkB,IAAI,iBAAiB,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE,IAAI,yBAAyB,IAAI,iBACzF,WAAY,IAAI,wBAAwB,CAAE,IAAI,iBAAiB,CAAE,IAAI,WAAW,EAAE,EAAE,EAAE,MACxF,CACA,CAAC,6BAA6B,UAC5B,eAAgB,IAClB,CACA,CAAC,oBAAoB,UACnB,QAAS,EACX","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,42 +1,343 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import { z } from 'zod';
2
3
 
3
- interface WebSocketContextType {
4
- socket: WebSocket | undefined;
4
+ declare const sparkleConfig: z.ZodObject<{
5
+ apiKey: z.ZodString;
6
+ projectId: z.ZodString;
7
+ oat: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ apiKey: string;
10
+ projectId: string;
11
+ oat?: string | undefined;
12
+ }, {
13
+ apiKey: string;
14
+ projectId: string;
15
+ oat?: string | undefined;
16
+ }>;
17
+ type SparkleConfig = z.infer<typeof sparkleConfig>;
18
+
19
+ declare class SparkleClient {
20
+ private config;
21
+ private token;
22
+ constructor(config: SparkleConfig);
23
+ setToken(token: string): void;
24
+ get database(): {
25
+ set: (key: string, value: any) => Promise<Response>;
26
+ get: (key: string) => Promise<Response>;
27
+ incr: (key: string, value: number) => Promise<Response>;
28
+ decr: (key: string, value: number) => Promise<Response>;
29
+ del: (key: string) => Promise<Response>;
30
+ };
31
+ get twitch(): null;
32
+ get hook(): null;
33
+ httpCall(body: any): Promise<Response>;
5
34
  }
6
- declare const SparkleContext: React.Context<WebSocketContextType>;
35
+
7
36
  interface SparkleProviderProps {
37
+ config: SparkleConfig;
8
38
  children: ReactNode;
9
39
  }
10
- declare const SparkleProvider: ({ children }: SparkleProviderProps) => React.JSX.Element;
40
+ declare const SparkleAppContext: React.Context<{
41
+ sparkle: SparkleClient | undefined;
42
+ }>;
43
+ declare const SparkleProvider: ({ children, config }: SparkleProviderProps) => React.JSX.Element;
11
44
 
12
- declare function useRealtime<T extends string>(...keyInputs: T[]): Record<T, any>;
45
+ declare function useRealtime<T>(...keyInputs: string[]): any[];
13
46
 
14
- interface TwitchUser {
15
- id: string;
16
- login: string;
17
- display_name: string;
18
- type: string;
19
- broadcaster_type: string;
20
- description: string;
21
- profile_image_url: string;
22
- offline_image_url: string;
23
- view_count: number;
24
- email: string;
47
+ interface TokenInfo {
48
+ userId: string;
49
+ displayName: string;
50
+ profilePictureUrl: string;
51
+ exp: number;
25
52
  }
26
- declare function useTwitch(): {
27
- user: TwitchUser | null;
53
+
54
+ declare function useAuth(): {
55
+ account: TokenInfo | null;
56
+ token: string | null | undefined;
28
57
  loading: boolean;
29
- fetchVips: () => Promise<void>;
30
- authenticate: () => Promise<void>;
58
+ authenticate: () => void;
31
59
  logout: () => void;
32
60
  };
33
61
 
34
- declare function useData<T extends string>(...keys: T[]): {
62
+ declare function useDatabase<T extends string>(): {
63
+ set: (key: string, value: any) => Promise<Response>;
64
+ get: (key: string) => Promise<Response>;
65
+ incr: (key: string, value: number) => Promise<Response>;
66
+ decr: (key: string, value: number) => Promise<Response>;
67
+ del: (key: string) => Promise<Response>;
68
+ };
69
+
70
+ declare function useUser<T extends string>(...keys: T[]): {
35
71
  set: (key: string, value: any) => Promise<Response>;
36
- get: (key: string) => Promise<void>;
37
- inctement: (key: string, value: number) => Promise<Response>;
38
- decrement: (key: string, value: number) => Promise<Response>;
72
+ get: (key: string) => Promise<any>;
73
+ incr: (key: string, value: number) => Promise<Response>;
74
+ decr: (key: string, value: number) => Promise<Response>;
39
75
  del: (key: string) => Promise<Response>;
76
+ user: {};
77
+ };
78
+
79
+ type CCL =
80
+ | "DrugsIntoxication"
81
+ | "Gambling"
82
+ | "MatureGame"
83
+ | "ProfanityVulgarity"
84
+ | "SexualThemes"
85
+ | "ViolentGraphic"
86
+
87
+ type EventTypeMap = {
88
+ // Notifications
89
+ "notification.follow": EventSubFollowEvent
90
+ "notification.subscribe": EventSubSubscribeEvent
91
+ "notification.cheer": EventSubCheerEvent
92
+
93
+ // Streams
94
+ "stream.online": EventSubStreamOnlineEvent
95
+ "stream.offline": EventSubStreamOfflineEvent
96
+ "stream.update": EventSubStreamUpdateEvent
97
+
98
+ // Rewards
99
+ "reward.add": EventSubRewardAddEvent
100
+ "reward.update": EventSubRewardUpdateEvent
101
+ "reward.remove": EventSubRewardRemoveEvent
102
+ "reward.redemption.claim": EventSubRedemptionClaimEvent
103
+ "reward.redemption.update": EventSubRedemptionUpdateEvent
104
+
105
+ // Polls
106
+ "poll.begin": EventSubPollBeginEvent
107
+ "poll.progress": EventSubPollProgressEvent
108
+ "poll.end": EventSubPollEndEvent
109
+
110
+ // Predictions
111
+ "prediction.begin": EventSubPredictionBeginEvent
112
+ "prediction.progress": EventSubPredictionProgressEvent
113
+ "prediction.lock": EventSubPredictionLockEvent
114
+ "prediction.end": EventSubPredictionEndEvent
115
+
116
+ // Moderations
117
+ "moderator.add": EventSubModeratorAddEvent
118
+ "moderator.remove": EventSubModeratorRemoveEvent
119
+
120
+ "moderator.ban": EventSubModeratorBanEvent
121
+ "moderator.unban": EventSubModeratorUnbanEvent
122
+
123
+ "moderator.shield_mode.begin": EventSubModeratorShieldModeBeginEvent
124
+ }
125
+
126
+ /**
127
+ * Notifications Events
128
+ */
129
+
130
+ interface EventSubFollowEvent {
131
+ user_id: string
132
+ user_login: string
133
+ user_name: string
134
+ followed_at: string
135
+ }
136
+
137
+ interface EventSubSubscribeEvent {
138
+ user_id: string
139
+ user_login: string
140
+ user_name: string
141
+ tier: string
142
+ is_gift: boolean
143
+ }
144
+
145
+ interface EventSubCheerEvent {
146
+ is_anonymous: boolean
147
+ user_id?: string
148
+ user_login?: string
149
+ user_name?: string
150
+ message: string
151
+ bits: number
152
+ }
153
+
154
+ /**
155
+ * Stream Events
156
+ */
157
+
158
+ interface EventSubStreamOnlineEvent {
159
+ id: string
160
+ type: "live" | "playlist" | "watch_party" | "premiere" | "rerun"
161
+ started_at: string
162
+ }
163
+
164
+ interface EventSubStreamOfflineEvent {}
165
+
166
+ interface EventSubStreamUpdateEvent {
167
+ title: string
168
+ language: string
169
+ category_id: string
170
+ category_name: string
171
+ content_classification_labels: CCL[]
172
+ }
173
+
174
+ /**
175
+ * Rewards Events
176
+ */
177
+
178
+ interface RewardImage {
179
+ url_1x: string | null
180
+ url_2x: string | null
181
+ url_4x: string | null
182
+ }
183
+
184
+ interface RewardCooldown {
185
+ is_enabled: boolean
186
+ value: number
187
+ }
188
+
189
+ interface EventSubRewardAddEvent {
190
+ id: string
191
+ is_enabled: boolean
192
+ is_paused: boolean
193
+ is_in_stock: boolean
194
+ title: string
195
+ cost: number
196
+ prompt: string
197
+ is_user_input_required: boolean
198
+ should_redemptions_skip_request_queue: boolean
199
+ max_per_stream: RewardCooldown
200
+ max_per_user_per_stream: RewardCooldown
201
+ background_color: string
202
+ image: RewardImage | null
203
+ default_image: RewardImage
204
+ global_cooldown: RewardCooldown
205
+ cooldown_expires_at: string | null
206
+ redemptions_redeemed_current_stream: number | null
207
+ }
208
+
209
+ interface EventSubRewardUpdateEvent extends EventSubRewardAddEvent {}
210
+ interface EventSubRewardRemoveEvent extends EventSubRewardAddEvent {}
211
+
212
+ interface RewardInfo {
213
+ id: string // Identifiant de la récompense
214
+ title: string // Nom de la récompense
215
+ cost: number // Coût de la récompense
216
+ prompt: string // Description de la récompense
217
+ }
218
+
219
+ interface EventSubRedemptionClaimEvent {
220
+ id: string // Identifiant du rachat de la récompense
221
+ user_id: string // ID de l'utilisateur ayant racheté la récompense
222
+ user_login: string // Nom d'utilisateur de l'utilisateur ayant racheté la récompense
223
+ user_name: string // Nom d'affichage de l'utilisateur ayant racheté la récompense
224
+ user_input: string // Entrée de l'utilisateur fournie. Chaîne vide si non fournie.
225
+ status: "unknown" | "unfulfilled" | "fulfilled" | "canceled" // Statut du rachat de la récompense. Les valeurs possibles sont "unknown", "unfulfilled", "fulfilled" et "canceled".
226
+ reward: RewardInfo // Informations de base sur la récompense qui a été rachetée au moment du rachat
227
+ redeemed_at: string // Horodatage RFC3339 du moment où la récompense a été rachetée
228
+ }
229
+
230
+ interface EventSubRedemptionUpdateEvent extends EventSubRedemptionClaimEvent {}
231
+
232
+ /**
233
+ * Polls Events
234
+ */
235
+
236
+ interface PollChoice {
237
+ id: string
238
+ title: string
239
+ channel_points_votes: number
240
+ votes: number
241
+ }
242
+
243
+ interface PollChannelPointsVoting {
244
+ is_enabled: boolean
245
+ amount_per_vote: number
246
+ }
247
+
248
+ interface EventSubPollBeginEvent {
249
+ id: string
250
+ title: string
251
+ choices: PollChoice[]
252
+ channel_points_voting: PollChannelPointsVoting
253
+ started_at: string
254
+ ends_at: string
255
+ }
256
+
257
+ interface EventSubPollProgressEvent extends EventSubPollBeginEvent {}
258
+
259
+ interface EventSubPollEndEvent extends EventSubPollBeginEvent {
260
+ status: "completed" | "archived" | "terminated"
261
+ }
262
+
263
+ /**
264
+ * Predictions Events
265
+ */
266
+
267
+ interface TopPredictor {
268
+ user_id: string // ID de l'utilisateur
269
+ user_login: string // Nom d'utilisateur de l'utilisateur
270
+ user_name: string // Nom d'affichage de l'utilisateur
271
+ channel_points_won: number | null // Nombre de Points de Chaîne gagnés (toujours null dans les événements de progression et de verrouillage de la prédiction)
272
+ channel_points_used: number // Nombre de Points de Chaîne utilisés pour participer à la prédiction
273
+ }
274
+
275
+ interface Outcome {
276
+ id: string // ID du résultat
277
+ title: string // Titre du résultat
278
+ color: "pink" | "blue" // Couleur du résultat. Les valeurs valides sont "pink" et "blue".
279
+ users: number // Nombre d'utilisateurs ayant utilisé des Points de Chaîne pour ce résultat
280
+ channel_points: number // Nombre total de Points de Chaîne utilisés pour ce résultat
281
+ top_predictors: TopPredictor[] // Un tableau d'utilisateurs ayant utilisé le plus de Points de Chaîne sur ce résultat
282
+ }
283
+
284
+ interface EventSubPredictionBeginEvent {
285
+ id: string // ID de la prédiction de Points de Chaîne
286
+ title: string // Titre de la prédiction de Points de Chaîne
287
+ outcomes: Outcome[] // Un tableau de résultats (outcomes) pour la prédiction de Points de Chaîne
288
+ started_at: string // Heure de début de la prédiction de Points de Chaîne
289
+ locks_at: string // Heure à laquelle la prédiction de Points de Chaîne se verrouillera automatiquement
290
+ }
291
+
292
+ interface EventSubPredictionProgressEvent
293
+ extends EventSubPredictionBeginEvent {}
294
+ interface EventSubPredictionLockEvent extends EventSubPredictionBeginEvent {}
295
+
296
+ interface EventSubPredictionEndEvent extends EventSubPredictionBeginEvent {
297
+ ended_at: string // Heure de fin de la prédiction de Points de Chaîne
298
+ }
299
+
300
+ /**
301
+ * Moderations Events
302
+ */
303
+
304
+ interface EventSubModeratorAddEvent {
305
+ user_id: string
306
+ user_login: string
307
+ user_name: string
308
+ }
309
+
310
+ interface EventSubModeratorRemoveEvent {
311
+ user_id: string
312
+ user_login: string
313
+ user_name: string
314
+ }
315
+
316
+ interface EventSubModeratorBanEvent {
317
+ user_id: string
318
+ user_login: string
319
+ user_name: string
320
+ moderator_user_id: string
321
+ moderator_user_login: string
322
+ moderator_user_name: string
323
+ reason: string
324
+ banned_at: string
325
+ ends_at: string | null
326
+ is_permanent: boolean
327
+ }
328
+
329
+ interface EventSubModeratorUnbanEvent {
330
+ user_id: string
331
+ user_login: string
332
+ user_name: string
333
+ moderator_user_id: string
334
+ moderator_user_login: string
335
+ moderator_user_name: string
336
+ }
337
+
338
+ declare function useHook<T extends keyof EventTypeMap>(event: T, callback?: (data: EventTypeMap[T]) => void): {
339
+ events: EventTypeMap[T][];
340
+ lastEvent: EventTypeMap[T] | undefined;
40
341
  };
41
342
 
42
- export { SparkleContext, SparkleProvider, type TwitchUser, useData, useRealtime, useTwitch };
343
+ export { SparkleAppContext, SparkleProvider, type SparkleProviderProps, useAuth, useDatabase, useHook, useRealtime, useUser };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import h from"react";import{createContext as N,useEffect as P,useState as U}from"react";import{useState as x,useEffect as T,useCallback as f}from"react";function v(){let[o,a]=x(null),[i,s]=x(!0),e="u9lt242tz2pn5hl5x444ls2xllnvip",t=f(async()=>{let r=new URLSearchParams(window.location.hash).get("#access_token")||localStorage.getItem("twitch_access_token");if(r){localStorage.setItem("twitch_access_token",r);let l=(await fetch("https://api.twitch.tv/helix/users",{headers:{Authorization:`Bearer ${r}`,"Client-Id":e}}).then(y=>y.json())).data[0];a(l)}},[]),n=f(async()=>{try{let r="http://localhost:3000/test",p=["user:read:email","channel:read:vips","user:read:follows","user:read:subscriptions"].join(" "),l=new URLSearchParams(window.location.hash).get("#access_token")||localStorage.getItem("twitch_access_token");if(!l)window.location.replace(`https://id.twitch.tv/oauth2/authorize?client_id=${e}&redirect_uri=${r}&response_type=token&scope=${p}&force_verify=true`);else{localStorage.setItem("twitch_access_token",l);let C=(await fetch("https://api.twitch.tv/helix/users",{headers:{Authorization:`Bearer ${l}`,"Client-Id":e}}).then(_=>_.json())).data[0];a(C)}}catch(r){console.error("Erreur lors de l'authentification :",r)}finally{s(!1)}},[]),g=f(()=>{localStorage.removeItem("twitch_access_token"),a(null)},[]),d=f(async()=>{let r=new URLSearchParams(window.location.hash).get("#access_token")||localStorage.getItem("twitch_access_token"),p=await fetch("https://api.twitch.tv/helix/channels/vips?broadcaster_id=540958129",{method:"GET",headers:{Authorization:`Bearer ${r}`,"Client-Id":e}}).then(l=>l.json())},[]);return T(()=>{t()},[]),{user:o,loading:i,fetchVips:d,authenticate:n,logout:g}}import w from"react";function b({authenticate:o}){return w.createElement("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-xl"},w.createElement("div",{className:"absolute top-1/2 left-1/2 -translate-x-full -translate-y-full bg-popover flex items-start rounded-md ring-1 ring-white/10 flex-col p-3 gap-3 cursor-pointer shadow-md bg-black text-white"},w.createElement("div",null,"Salut"),w.createElement("button",{className:"bg-white rounded-md p-2 text-xs whitespace-nowrap text-black",onClick:o},"Log In"),w.createElement("span",{className:"text-xs"},"Powered by Sparkle")))}import c from"react";function m({user:o,logout:a}){return c.createElement("div",{className:"bg-popover flex items-start fixed right-3 bottom-3 rounded-md ring-1 ring-white/10 flex-col p-3 gap-3 hover:-translate-y-1 transition-all cursor-pointer shadow-md bg-black text-white duration-500"},c.createElement("div",{className:"flex w-full flex-row items-center gap-3"},c.createElement("div",{className:"flex h-[34px] w-[34px] flex-shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#313131] text-sm"},c.createElement("img",{src:o?.profile_image_url||"",alt:o?.display_name+"'s profile picture",width:34,height:34})),c.createElement("div",{className:"flex w-full flex-col justify-center min-w-[124px]"},c.createElement("div",{className:"space-x-2"},c.createElement("span",{className:"text-primary text-sm font-medium capitalize"},o?.display_name)),c.createElement("span",{className:"text-muted-foreground text-xs font-normal"},"Broadcaster")),c.createElement("button",{className:"bg-red-500 rounded-md p-2 text-xs whitespace-nowrap",onClick:a},"Log Out")))}var u=N({socket:void 0}),q=({children:o})=>{let[a,i]=U(),{user:s,authenticate:e,logout:t}=v();return P(()=>{let n=new WebSocket("ws://localhost:8000");return i(n),()=>{n.close()}},[]),h.createElement(u.Provider,{value:{socket:a}},!s&&h.createElement(b,{authenticate:e}),s&&h.createElement(h.Fragment,null,h.createElement(m,{user:s,logout:t})),o)};import{useCallback as k,useState as j,useContext as O,useEffect as S,useMemo as E}from"react";function Q(...o){let a=O(u),i=E(()=>o,[o.join(",")]),[s,e]=j(i.reduce((d,r)=>({...d,[r]:""}),{}));if(!a)throw new Error("You must use useDatabase inside a SparkleProvider");let{socket:t}=a,n=k(()=>{t?.send(JSON.stringify({type:"subscribe",keys:i}))},[t,i]),g=k(d=>{let r=JSON.parse(d.data.toString());console.log("Message re\xE7u : "+d.data),e(p=>({...p,[r.key]:JSON.parse(r.value)}))},[]);return S(()=>{if(t)return t.readyState===WebSocket.OPEN&&n(),t.addEventListener("open",n),t.addEventListener("message",g),()=>{t.removeEventListener("open",n),t.removeEventListener("message",g)}},[t]),S(()=>{console.log("update keys",i),n()},[i]),s}import{useCallback as z,useContext as I}from"react";function rt(...o){let a=I(u),i=z(async(e,t)=>(t&&typeof t=="object"&&(t=JSON.stringify(t)),await fetch("http://localhost:4005/actions",{method:"POST",body:JSON.stringify({action:"set",key:e,value:t}),headers:{"Content-Type":"application/json"}})),[]),s=z(async e=>{let t=await fetch("http://localhost:4005/actions",{method:"POST",body:JSON.stringify({action:"get",key:e}),headers:{"Content-Type":"application/json"}})},[]);return{set:i,get:s,inctement:async(e,t)=>await fetch("http://localhost:4005/actions",{method:"POST",body:JSON.stringify({action:"inctement",key:e,value:t}),headers:{"Content-Type":"application/json"}}),decrement:async(e,t)=>await fetch("http://localhost:4005/actions",{method:"POST",body:JSON.stringify({action:"decrement",key:e,value:t}),headers:{"Content-Type":"application/json"}}),del:async e=>await fetch("http://localhost:4005/actions",{method:"POST",body:JSON.stringify({action:"del",key:e}),headers:{"Content-Type":"application/json"}})}}export{u as SparkleContext,q as SparkleProvider,rt as useData,Q as useRealtime,v as useTwitch};
1
+ import b,{useContext as ze,useEffect as Y,useState as q,createContext as Pe}from"react";import*as g from"react";import{motion as L}from"framer-motion";import{Loader2 as ee}from"lucide-react";function A({authenticate:t,loading:e}){return g.createElement("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-xl"},g.createElement("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 space-y-3 flex flex-col items-center max-w-xs w-full"},g.createElement("h3",{className:"font-semibold tracking-tight text-2xl"},"Counter Manager"),g.createElement(L.button,{layout:!0,className:"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-9 px-4 py-2 overflow-hidden",onClick:t,disabled:e},g.createElement(L.div,{layout:!0,key:e?"loading":"loaded",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},e?g.createElement(ee,{className:"animate-spin"}):g.createElement("span",null,"Login with Twitch"))),g.createElement("span",{className:"text-xs"},"Powered by Sparkle")))}import m,{useContext as he}from"react";import{Loader2 as fe}from"lucide-react";import{motion as me}from"framer-motion";import*as B from"react";import{createContext as le,useCallback as F,useEffect as M,useState as O}from"react";import{decode as T}from"jsonwebtoken";var U=async(t,e)=>fetch("http://localhost:4005/auth/oat",{method:"POST",headers:{"Content-Type":"application/json","Api-Key":t.apiKey,"Project-Id":t.projectId},body:JSON.stringify({oat:e})});import{useCallback as J,useState as te,useRef as oe,useLayoutEffect as re}from"react";var E=()=>{};function k(t,...e){t&&t.addEventListener&&t.addEventListener(...e)}function S(t,...e){t&&t.removeEventListener&&t.removeEventListener(...e)}var C=typeof window<"u";var ne=(t,e,o)=>{if(!C)return[e,E,E];if(!t)throw new Error("useLocalStorage key may not be falsy");let r=o?o.raw?s=>s:o.deserializer:JSON.parse,i=oe(s=>{try{let c=o?o.raw?String:o.serializer:JSON.stringify,p=localStorage.getItem(s);return p!==null?r(p):(e&&localStorage.setItem(s,c(e)),e)}catch{return e}}),[l,n]=te(()=>i.current(t));re(()=>n(i.current(t)),[t]);let a=J(s=>{try{let c=typeof s=="function"?s(l):s;if(typeof c>"u")return;let p;o?o.raw?typeof c=="string"?p=c:p=JSON.stringify(c):o.serializer?p=o.serializer(c):p=JSON.stringify(c):p=JSON.stringify(c),localStorage.setItem(t,p),n(r(p))}catch{}},[t,n]),d=J(()=>{try{localStorage.removeItem(t),n(void 0)}catch{}},[t,n]);return[l,a,d]},N=ne;import{useEffect as ie,useState as ae}from"react";var W=(t,e)=>new URLSearchParams(t).get(e),se=t=>{let e=window.location,[o,r]=ae(()=>W(e.search,t));return ie(()=>{let i=()=>{r(W(e.search,t))};return k(window,"popstate",i),k(window,"pushstate",i),k(window,"replacestate",i),()=>{S(window,"popstate",i),S(window,"pushstate",i),S(window,"replacestate",i)}},[]),o},ce=()=>null,R=C?se:ce;var de="u9lt242tz2pn5hl5x444ls2xllnvip",pe="twitch_access_token",ue=[],h=le({account:null,token:null,loading:!0,authenticationMethod:"JWT",authenticate:()=>{},logout:()=>{}}),D=({children:t,config:e})=>{let[o,r]=N(pe,null),[i,l]=N("twitch"),n=e.oat||R("oat"),[a,d]=O(null),[s,c]=O(!1),[p,P]=O("JWT");M(()=>{if(o){let u=T(o);if(console.log(u),u.exp*1e3<Date.now()){r(null),d(null);return}d(u)}},[]),M(()=>{n&&(c(!0),U(e,n).then(u=>u.json()).then(u=>{r(u.accessToken);let w=T(u.accessToken);d(w)}).finally(()=>{c(!1),P("OAT")}))},[n]);let V=F(()=>{r(null),d(null)},[]);M(()=>{let u=new URLSearchParams(window.location.hash).get("#access_token");u&&(l(u),c(!0),fetch("http://localhost:4005/auth",{method:"POST",headers:{"Content-Type":"application/json","Api-Key":e.apiKey,"Project-Id":e.projectId},body:JSON.stringify({oat:u})}).then(w=>w.json()).then(w=>{r(w.accessToken);let v=T(w.accessToken);d(v)}).finally(()=>{c(!1),window.history.replaceState({},document.title,"/")}))},[]);let Z=F(async()=>{let u="http://localhost:3000",w=ue.join(" ");c(!0);try{if(!o)window.location.replace(`https://id.twitch.tv/oauth2/authorize?client_id=${de}&redirect_uri=${u}&response_type=token&scope=${w}&force_verify=true`);else{let v=T(o);d(v)}}catch(v){console.error("Erreur lors de l'authentification :",v)}finally{}},[o]);return B.createElement(h.Provider,{value:{authenticationMethod:p,account:a,token:o,loading:s,authenticate:Z,logout:V}},t)};function j({user:t,loading:e,logout:o}){let{authenticationMethod:r}=he(h);return r==="OAT"?null:m.createElement(me.div,{className:"bg-popover flex items-start fixed right-3 bottom-3 rounded-md ring-1 ring-white/10 flex-col p-3 gap-3 cursor-pointer shadow-md bg-black text-white",layout:!0},e||!t?m.createElement("div",{className:"flex flex-row text-muted-foreground items-center gap-2"},m.createElement("div",{className:"text-sm"},"Authenticating with Twitch..."),m.createElement(fe,{className:"animate-spin",size:16})):m.createElement("div",{className:"flex w-full flex-row items-center gap-3"},m.createElement("div",{className:"flex h-[34px] w-[34px] flex-shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#313131] text-sm"},m.createElement("img",{src:t?.profilePictureUrl||"",alt:t?.displayName+"'s profile picture",width:34,height:34})),m.createElement("div",{className:"flex w-full flex-col justify-center min-w-[124px]"},m.createElement("div",{className:"space-x-2"},m.createElement("span",{className:"text-primary text-sm font-medium capitalize"},t?.displayName)),m.createElement("span",{className:"text-muted-foreground text-xs font-normal"},"Broadcaster")),m.createElement("button",{className:"bg-red-500 rounded-md p-2 text-xs whitespace-nowrap",onClick:o},"Log Out")))}import ye,{useCallback as ve,useContext as xe,useRef as ke}from"react";import{createContext as Se,useEffect as H,useState as Ce}from"react";import f from"zod";import ge from"events";var we=f.object({type:f.literal("subscribe"),channels:f.array(f.string()),scope:f.string()}),be=f.object({type:f.literal("unsubscribe"),channels:f.string()}),ht=f.object({scope:f.enum(["__key__","__hook__"]),type:f.string(),payload:f.string()}),ft=f.union([we,be]),z=class extends ge{constructor(o){super();this.socket=null;this.queue=[];this.subscriptions=[];this.isAuthenticating=!1;this.jwt=null;this.url=o}send(o){this.socket?.readyState===WebSocket.OPEN?this.socket?.send(JSON.stringify(o)):this.queue.push(o)}authenticate(o){this.isAuthenticating||(this.isAuthenticating=!0,this.jwt=o,this.connect())}connect(){let o=this.url+"?jwt="+this.jwt;this.socket=new WebSocket(o),this.socket.onopen=()=>{this.queue.forEach(r=>this.send(r)),this.queue=[]},this.socket.onmessage=r=>{let i=JSON.parse(r.data);this.emit("message",i)},this.socket.onclose=()=>{this.reconnect()}}reconnect(){setTimeout(()=>{this.queue=[{type:"subscribe",channels:this.subscriptions,scope:"key"}],console.log("try reconnecting"),this.connect()},5e3)}subscribe(o,r="key"){let i=o.filter(l=>!this.subscriptions.includes(l));i.length&&(this.subscriptions=[...this.subscriptions,...i],console.log("subscribe",r,o),this.send({type:"subscribe",channels:o,scope:r}))}unsubscribe(o){this.send({type:"unsubscribe",channels:o})}disconnect(){this.socket&&(this.socket.onclose=()=>{},this.socket.close())}};import Te from"events";var x=Se({subscribe:()=>{},values:{},on:()=>{},off:()=>{}}),_=new Te,$=({children:t})=>{let[e,o]=Ce({}),r=ke(),{token:i}=xe(h),l=(d,s)=>{_.on(d,s)},n=(d,s)=>{_.off(d,s)};H(()=>(r.current=new z("ws://localhost:8000"),r.current.on("message",d=>{let{scope:s,payload:c,type:p}=d;if(s==="__hook__"){_.emit(p,JSON.parse(c));return}s==="__key__"&&o(P=>({...P,[p]:JSON.parse(c)}))}),()=>{r.current?.disconnect()}),[]),H(()=>{!r.current||!i||r.current.authenticate(i)},[i]);let a=ve((d,s)=>{r.current?.subscribe(d,s)},[r]);return ye.createElement(x.Provider,{value:{subscribe:a,values:e,on:l,off:n}},t)};var K=t=>({set:async(e,o)=>t.httpCall({action:"set",key:e,value:o}),get:async e=>t.httpCall({action:"get",key:e}),incr:async(e,o)=>t.httpCall({action:"incr",key:e,value:o}),decr:async(e,o)=>t.httpCall({action:"decr",key:e,value:o}),del:async e=>t.httpCall({action:"del",key:e})});var y=class{constructor(e){this.config=e,this.token=""}setToken(e){this.token=e}get database(){return K(this)}get twitch(){return null}get hook(){return null}async httpCall(e){return await fetch("http://localhost:4005/actions",{method:"POST",body:JSON.stringify(e),headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"}})}},zt=new y({apiKey:"123",projectId:"123"});var Ae=({children:t})=>{let[e,o]=q(!1),{authenticate:r,logout:i,token:l,account:n,loading:a}=ze(h);return Y(()=>{o(!0)},[]),e?l?b.createElement(b.Fragment,null,b.createElement(j,{user:n,logout:i,loading:a}),n&&t):b.createElement(A,{authenticate:r,loading:a}):null},I=Pe({sparkle:void 0}),_t=({children:t,config:e})=>{let[o,r]=q();return Y(()=>{e&&r(new y(e))},[e]),b.createElement(I.Provider,{value:{sparkle:o}},b.createElement(D,{config:e},b.createElement($,{config:e},b.createElement(Ae,null,t))))};import{useContext as Ee,useEffect as Ne,useMemo as Me}from"react";function Jt(...t){let e=Ee(x),o=Me(()=>t,[t.join(",")]);if(!e)throw new Error("You must use useRealtime inside a SparkleProvider");return Ne(()=>{e.subscribe(o,"__key__")},[o]),o.map(r=>e.values[r])}import{useContext as Oe}from"react";function Bt(){let{account:t,token:e,loading:o,authenticate:r,logout:i}=Oe(h);return{account:t,token:e,loading:o,authenticate:r,logout:i}}import{useContext as X,useEffect as je}from"react";function Yt(){let{token:t}=X(h),{sparkle:e}=X(I);if(!e)throw new Error("SparkleClient not found in context");return je(()=>{t&&e.setToken(t)},[t]),e.database}import{useCallback as Q,useContext as _e,useEffect as Ie,useState as Le}from"react";function Gt(...t){let[e,o]=Le({}),{token:r}=_e(h),i=Q(async(n,a)=>(a&&typeof a=="object"&&(a=JSON.stringify(a)),await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"set",key:n,value:a}),headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}})),[]),l=Q(async n=>(await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"get",key:n}),headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}})).json(),[]);return Ie(()=>{(async()=>{let a=await l("coins");o({coins:a})})()},[]),{set:i,get:l,incr:async(n,a)=>await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"incr",key:n,value:a}),headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}}),decr:async(n,a)=>await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"decr",key:n,value:a}),headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}}),del:async n=>await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"del",key:n}),headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}}),user:e}}import{useContext as Ue,useEffect as G,useState as Je}from"react";function oo(t,e){let o=Ue(x),[r,i]=Je([]);if(!o)throw new Error("You must use useHook inside a SparkleProvider");return G(()=>{let l=n=>{i(a=>[...a,n]),e?.(n)};return o.on(t,l),()=>{o.off(t,l)}},[]),G(()=>{o.subscribe([t],"__hook__")},[t]),{events:r,lastEvent:r[r.length-1]}}export{I as SparkleAppContext,_t as SparkleProvider,Bt as useAuth,Yt as useDatabase,oo as useHook,Jt as useRealtime,Gt as useUser};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider.tsx","../src/hooks/useTwitch.ts","../src/components/login-form.tsx","../src/components/user-info.tsx","../src/hooks/useRealtime.ts","../src/hooks/useData.ts"],"sourcesContent":["import React from \"react\"\nimport { type ReactNode, createContext, useEffect, useState } from \"react\"\nimport { type TwitchUser, useTwitch } from \"./hooks/useTwitch\"\nimport LoginForm from \"./components/login-form\"\nimport UserInfo from \"./components/user-info\"\n\ninterface WebSocketContextType {\n socket: WebSocket | undefined\n}\n\nexport const SparkleContext = createContext<WebSocketContextType>({\n socket: undefined,\n})\n\ninterface SparkleProviderProps {\n children: ReactNode\n}\n\nexport const SparkleProvider = ({ children }: SparkleProviderProps) => {\n const [socket, setSocket] = useState<WebSocket>()\n const { user, authenticate, logout } = useTwitch()\n\n useEffect(() => {\n const ws = new WebSocket(\"ws://localhost:8000\")\n setSocket(ws)\n\n return () => {\n ws.close()\n }\n }, [])\n\n return (\n <SparkleContext.Provider\n value={{\n socket,\n }}\n >\n {!user && <LoginForm authenticate={authenticate} />}\n {user && (\n <>\n <UserInfo user={user} logout={logout} />\n </>\n )}\n {children}\n </SparkleContext.Provider>\n )\n}\n","import { useState, useEffect, useCallback } from \"react\"\n\nexport interface TwitchUser {\n id: string\n login: string\n display_name: string\n type: string\n broadcaster_type: string\n description: string\n profile_image_url: string\n offline_image_url: string\n view_count: number\n email: string\n}\n\nexport function useTwitch() {\n const [user, setUser] = useState<TwitchUser | null>(null)\n const [loading, setLoading] = useState(true)\n\n const clientId = \"u9lt242tz2pn5hl5x444ls2xllnvip\"\n\n const tryAuthenticate = useCallback(async () => {\n const accessToken =\n new URLSearchParams(window.location.hash).get(\"#access_token\") ||\n localStorage.getItem(\"twitch_access_token\")\n\n if (accessToken) {\n localStorage.setItem(\"twitch_access_token\", accessToken)\n\n const response = await fetch(\"https://api.twitch.tv/helix/users\", {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Client-Id\": clientId,\n },\n }).then((res) => res.json())\n\n const user = response.data[0]\n setUser(user)\n }\n }, [])\n\n const authenticate = useCallback(async () => {\n try {\n const redirectUri = \"http://localhost:3000/test\"\n const scope = [\n \"user:read:email\",\n \"channel:read:vips\",\n \"user:read:follows\",\n \"user:read:subscriptions\",\n ].join(\" \")\n\n const accessToken =\n new URLSearchParams(window.location.hash).get(\"#access_token\") ||\n localStorage.getItem(\"twitch_access_token\")\n\n if (!accessToken) {\n // Redirigez pour l'authentification si aucun token n'est trouvé\n window.location.replace(\n `https://id.twitch.tv/oauth2/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=token&scope=${scope}&force_verify=true`\n )\n } else {\n // Stockez le token dans le stockage local\n localStorage.setItem(\"twitch_access_token\", accessToken)\n\n const response = await fetch(\"https://api.twitch.tv/helix/users\", {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Client-Id\": clientId,\n },\n }).then((res) => res.json())\n\n const user = response.data[0]\n\n // Utilisez le token pour faire des requêtes à l'API Twitch\n // const [follow, subscription] = await Promise.all([\n // await fetch(\n // `https://api.twitch.tv/helix/subscriptions/user?broadcaster_id=540958129&user_id=${user.id}`,\n // {\n // headers: {\n // Authorization: `Bearer ${accessToken}`,\n // \"Client-Id\": clientId,\n // },\n // }\n // ).then((res) => res.json()),\n // await fetch(\n // `https://api.twitch.tv/helix/channels/followed?broadcaster_id=540958129&user_id=${user.id}`,\n // {\n // headers: {\n // Authorization: `Bearer ${accessToken}`,\n // \"Client-Id\": clientId,\n // },\n // }\n // ).then((res) => res.json()),\n // ])\n\n // console.log(follow, subscription)\n\n setUser(user)\n }\n } catch (error) {\n console.error(\"Erreur lors de l'authentification :\", error)\n } finally {\n setLoading(false)\n }\n }, [])\n\n const logout = useCallback(() => {\n localStorage.removeItem(\"twitch_access_token\")\n setUser(null)\n }, [])\n\n const fetchVips = useCallback(async () => {\n const accessToken =\n new URLSearchParams(window.location.hash).get(\"#access_token\") ||\n localStorage.getItem(\"twitch_access_token\")\n\n const result = await fetch(\n \"https://api.twitch.tv/helix/channels/vips?broadcaster_id=540958129\",\n {\n method: \"GET\",\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Client-Id\": clientId,\n },\n }\n ).then((res) => res.json())\n }, [])\n\n useEffect(() => {\n tryAuthenticate()\n }, [])\n\n return { user, loading, fetchVips, authenticate, logout }\n}\n","import React from \"react\"\n\ninterface LoginFormProps {\n authenticate: () => void\n}\n\nexport default function LoginForm({ authenticate }: LoginFormProps) {\n return (\n <div className=\"absolute inset-0 bg-black/60 backdrop-blur-xl\">\n <div className=\"absolute top-1/2 left-1/2 -translate-x-full -translate-y-full bg-popover flex items-start rounded-md ring-1 ring-white/10 flex-col p-3 gap-3 cursor-pointer shadow-md bg-black text-white\">\n <div>Salut</div>\n\n <button\n className=\"bg-white rounded-md p-2 text-xs whitespace-nowrap text-black\"\n onClick={authenticate}\n >\n Log In\n </button>\n\n <span className=\"text-xs\">Powered by Sparkle</span>\n </div>\n </div>\n )\n}\n","import React from \"react\"\n\nimport { TwitchUser } from \"../hooks/useTwitch\"\n\ninterface UserInfoProps {\n user: TwitchUser\n logout: () => void\n}\n\nexport default function UserInfo({ user, logout }: UserInfoProps) {\n return (\n <div className=\"bg-popover flex items-start fixed right-3 bottom-3 rounded-md ring-1 ring-white/10 flex-col p-3 gap-3 hover:-translate-y-1 transition-all cursor-pointer shadow-md bg-black text-white duration-500\">\n {/* <div className=\"text-gray-400 text-xs\">Currently logged in as </div> */}\n <div className=\"flex w-full flex-row items-center gap-3\">\n <div className=\"flex h-[34px] w-[34px] flex-shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#313131] text-sm\">\n <img\n src={user?.profile_image_url || \"\"}\n alt={user?.display_name + \"'s profile picture\"}\n width={34}\n height={34}\n />\n </div>\n <div className=\"flex w-full flex-col justify-center min-w-[124px]\">\n <div className=\"space-x-2\">\n <span className=\"text-primary text-sm font-medium capitalize\">\n {user?.display_name}\n </span>\n </div>\n <span className=\"text-muted-foreground text-xs font-normal\">\n Broadcaster\n </span>\n </div>\n <button\n className=\"bg-red-500 rounded-md p-2 text-xs whitespace-nowrap\"\n onClick={logout}\n >\n Log Out\n </button>\n </div>\n </div>\n )\n}\n","import { useCallback, useState, useContext, useEffect, useMemo } from \"react\"\nimport { SparkleContext } from \"../provider\"\n\nexport function useRealtime<T extends string>(...keyInputs: T[]) {\n type State = Record<T, any>\n\n const context = useContext(SparkleContext)\n\n const keys = useMemo(() => keyInputs, [keyInputs.join(\",\")])\n\n const [state, setState] = useState<State>(\n keys.reduce((acc, key) => ({ ...acc, [key]: \"\" }), {} as State)\n )\n\n if (!context) {\n throw new Error(\"You must use useDatabase inside a SparkleProvider\")\n }\n\n const { socket } = context\n\n const openOpen = useCallback(() => {\n socket?.send(JSON.stringify({ type: \"subscribe\", keys }))\n }, [socket, keys])\n\n const openMessage = useCallback((event: MessageEvent) => {\n const data = JSON.parse(event.data.toString())\n\n console.log(\"Message reçu : \" + event.data)\n\n setState((state) => ({\n ...state,\n [data.key]: JSON.parse(data.value),\n }))\n }, [])\n\n useEffect(() => {\n if (!socket) return\n\n if (socket.readyState === WebSocket.OPEN) {\n openOpen()\n }\n\n socket.addEventListener(\"open\", openOpen)\n socket.addEventListener(\"message\", openMessage)\n\n return () => {\n socket.removeEventListener(\"open\", openOpen)\n socket.removeEventListener(\"message\", openMessage)\n }\n }, [socket])\n\n useEffect(() => {\n console.log(\"update keys\", keys)\n openOpen()\n }, [keys])\n\n return state\n}\n","import { useCallback, useContext } from \"react\"\nimport { SparkleContext } from \"../provider\"\n\nexport function useData<T extends string>(...keys: T[]) {\n const context = useContext(SparkleContext)\n\n const set = useCallback(async (key: string, value: any) => {\n if (value && typeof value === \"object\") {\n value = JSON.stringify(value)\n }\n\n return await fetch(\"http://localhost:4005/actions\", {\n method: \"POST\",\n body: JSON.stringify({\n action: \"set\",\n key,\n value,\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n }, [])\n\n const get = useCallback(async (key: string) => {\n const value = await fetch(\"http://localhost:4005/actions\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"get\", key }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n\n // return JSON.parse(value.)\n }, [])\n\n return {\n set,\n get,\n inctement: async (key: string, value: number) => {\n return await fetch(\"http://localhost:4005/actions\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"inctement\", key, value }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n },\n decrement: async (key: string, value: number) => {\n return await fetch(\"http://localhost:4005/actions\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"decrement\", key, value }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n },\n del: async (key: string) => {\n return await fetch(\"http://localhost:4005/actions\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"del\", key }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n })\n },\n }\n}\n"],"mappings":"AAAA,OAAOA,MAAW,QAClB,OAAyB,iBAAAC,EAAe,aAAAC,EAAW,YAAAC,MAAgB,QCDnE,OAAS,YAAAC,EAAU,aAAAC,EAAW,eAAAC,MAAmB,QAe1C,SAASC,GAAY,CAC1B,GAAM,CAACC,EAAMC,CAAO,EAAIL,EAA4B,IAAI,EAClD,CAACM,EAASC,CAAU,EAAIP,EAAS,EAAI,EAErCQ,EAAW,iCAEXC,EAAkBP,EAAY,SAAY,CAC9C,IAAMQ,EACJ,IAAI,gBAAgB,OAAO,SAAS,IAAI,EAAE,IAAI,eAAe,GAC7D,aAAa,QAAQ,qBAAqB,EAE5C,GAAIA,EAAa,CACf,aAAa,QAAQ,sBAAuBA,CAAW,EASvD,IAAMN,GAPW,MAAM,MAAM,oCAAqC,CAChE,QAAS,CACP,cAAe,UAAUM,CAAW,GACpC,YAAaF,CACf,CACF,CAAC,EAAE,KAAMG,GAAQA,EAAI,KAAK,CAAC,GAEL,KAAK,CAAC,EAC5BN,EAAQD,CAAI,CACd,CACF,EAAG,CAAC,CAAC,EAECQ,EAAeV,EAAY,SAAY,CAC3C,GAAI,CACF,IAAMW,EAAc,6BACdC,EAAQ,CACZ,kBACA,oBACA,oBACA,yBACF,EAAE,KAAK,GAAG,EAEJJ,EACJ,IAAI,gBAAgB,OAAO,SAAS,IAAI,EAAE,IAAI,eAAe,GAC7D,aAAa,QAAQ,qBAAqB,EAE5C,GAAI,CAACA,EAEH,OAAO,SAAS,QACd,mDAAmDF,CAAQ,iBAAiBK,CAAW,8BAA8BC,CAAK,oBAC5H,MACK,CAEL,aAAa,QAAQ,sBAAuBJ,CAAW,EASvD,IAAMN,GAPW,MAAM,MAAM,oCAAqC,CAChE,QAAS,CACP,cAAe,UAAUM,CAAW,GACpC,YAAaF,CACf,CACF,CAAC,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AC,GACA,CAAC,CAAC,EAECC,EAAMH,EAAY,MAAOC,GAAgB,CAC7C,IAAMC,EAAQ,MAAM,MAAM,gCAAiC,CACzD,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,OAAQ,MAAO,IAAAD,CAAI,CAAC,EAC3C,QAAS,CACP,eAAgB,kBAClB,CACF,CAAC,CAGH,EAAG,CAAC,CAAC,EAEL,MAAO,CACL,IAAAF,EACA,IAAAI,EACA,UAAW,MAAOF,EAAaC,IACtB,MAAM,MAAM,gCAAiC,CAClD,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,OAAQ,YAAa,IAAAD,EAAK,MAAAC,CAAM,CAAC,EACxD,QAAS,CACP,eAAgB,kBAClB,CACF,CAAC,EAEH,UAAW,MAAOD,EAAaC,IACtB,MAAM,MAAM,gCAAiC,CAClD,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,OAAQ,YAAa,IAAAD,EAAK,MAAAC,CAAM,CAAC,EACxD,QAAS,CACP,eAAgB,kBAClB,CACF,CAAC,EAEH,IAAK,MAAOD,GACH,MAAM,MAAM,gCAAiC,CAClD,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,OAAQ,MAAO,IAAAA,CAAI,CAAC,EAC3C,QAAS,CACP,eAAgB,kBAClB,CACF,CAAC,CAEL,CACF","names":["React","createContext","useEffect","useState","useState","useEffect","useCallback","useTwitch","user","setUser","loading","setLoading","clientId","tryAuthenticate","accessToken","res","authenticate","redirectUri","scope","error","logout","fetchVips","result","React","LoginForm","authenticate","React","UserInfo","user","logout","SparkleContext","createContext","SparkleProvider","children","socket","setSocket","useState","user","authenticate","logout","useTwitch","useEffect","ws","React","LoginForm","UserInfo","useCallback","useState","useContext","useEffect","useMemo","useRealtime","keyInputs","context","useContext","SparkleContext","keys","useMemo","state","setState","useState","acc","key","socket","openOpen","useCallback","openMessage","event","data","useEffect","useCallback","useContext","useData","keys","context","useContext","SparkleContext","set","useCallback","key","value","get"]}
1
+ {"version":3,"sources":["../src/provider.tsx","../src/components/login-form.tsx","../src/components/user-info.tsx","../src/providers/authProvider.tsx","../src/lib/auth.ts","../src/utils/hooks/useLocalStorage.ts","../src/utils/utils.ts","../src/utils/hooks/useSearchParam.ts","../src/providers/realtimeProvider.tsx","../src/lib/websocket.ts","../src/core/resources/database.ts","../src/core/index.ts","../src/hooks/useRealtime.ts","../src/hooks/useAuth.ts","../src/hooks/useDatabase.ts","../src/hooks/useUser.ts","../src/hooks/useHook.ts"],"sourcesContent":["import React, {\n type ReactNode,\n useContext,\n useEffect,\n useState,\n createContext,\n} from \"react\"\nimport LoginForm from \"./components/login-form\"\nimport UserInfo from \"./components/user-info\"\nimport { AuthProvider, SparkleAuthContext } from \"./providers/authProvider\"\nimport { WebSocketProvider } from \"./providers/realtimeProvider\"\nimport { SparkleConfig } from \"./utils/config\"\nimport SparkleClient from \"./core\"\n\nconst Provider = ({ children }: { children: ReactNode }) => {\n const [isClientReady, setIsClientReady] = useState(false)\n const { authenticate, logout, token, account, loading } =\n useContext(SparkleAuthContext)\n\n useEffect(() => {\n setIsClientReady(true)\n }, [])\n\n if (!isClientReady) {\n return null\n }\n\n if (!token) {\n return <LoginForm authenticate={authenticate} loading={loading} />\n }\n\n return (\n <>\n <UserInfo user={account} logout={logout} loading={loading} />\n {account && children}\n </>\n )\n}\n\nexport interface SparkleProviderProps {\n config: SparkleConfig\n children: ReactNode\n}\n\nexport const SparkleAppContext = createContext<{\n sparkle: SparkleClient | undefined\n}>({\n sparkle: undefined,\n})\n\nexport const SparkleProvider = ({ children, config }: SparkleProviderProps) => {\n const [sparkle, setSparkle] = useState<SparkleClient>()\n\n useEffect(() => {\n if (config) {\n setSparkle(new SparkleClient(config))\n }\n }, [config])\n\n return (\n <SparkleAppContext.Provider value={{ sparkle }}>\n <AuthProvider config={config}>\n <WebSocketProvider config={config}>\n <Provider>{children}</Provider>\n </WebSocketProvider>\n </AuthProvider>\n </SparkleAppContext.Provider>\n )\n}\n","import * as React from \"react\"\nimport { motion } from \"framer-motion\"\nimport { Loader2 } from \"lucide-react\"\n\ninterface LoginFormProps {\n authenticate: () => void\n loading: boolean\n}\n\nexport default function LoginForm({ authenticate, loading }: LoginFormProps) {\n return (\n <div className=\"absolute inset-0 bg-black/60 backdrop-blur-xl\">\n <div className=\"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 space-y-3 flex flex-col items-center max-w-xs w-full\">\n <h3 className=\"font-semibold tracking-tight text-2xl\">\n Counter Manager\n </h3>\n <motion.button\n layout\n className=\"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-9 px-4 py-2 overflow-hidden\"\n onClick={authenticate}\n disabled={loading}\n >\n <motion.div\n layout\n key={loading ? \"loading\" : \"loaded\"}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n >\n {loading ? (\n <Loader2 className=\"animate-spin\" />\n ) : (\n <span>Login with Twitch</span>\n )}\n </motion.div>\n </motion.button>\n\n <span className=\"text-xs\">Powered by Sparkle</span>\n </div>\n </div>\n )\n}\n","import React, { useContext } from \"react\"\n\nimport { Loader2 } from \"lucide-react\"\nimport { motion } from \"framer-motion\"\nimport { TokenInfo } from \"../utils/types\"\nimport { SparkleAuthContext } from \"../providers/authProvider\"\n\ninterface UserInfoProps {\n user: TokenInfo | null\n loading: boolean\n logout: () => void\n}\n\nexport default function UserInfo({ user, loading, logout }: UserInfoProps) {\n const { authenticationMethod } = useContext(SparkleAuthContext)\n\n if (authenticationMethod === \"OAT\") {\n return null\n }\n\n return (\n <motion.div\n className=\"bg-popover flex items-start fixed right-3 bottom-3 rounded-md ring-1 ring-white/10 flex-col p-3 gap-3 cursor-pointer shadow-md bg-black text-white\"\n layout\n >\n {loading || !user ? (\n <div className=\"flex flex-row text-muted-foreground items-center gap-2\">\n <div className=\"text-sm\">Authenticating with Twitch...</div>\n <Loader2 className=\"animate-spin\" size={16} />\n </div>\n ) : (\n <div className=\"flex w-full flex-row items-center gap-3\">\n <div className=\"flex h-[34px] w-[34px] flex-shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#313131] text-sm\">\n <img\n src={user?.profilePictureUrl || \"\"}\n alt={user?.displayName + \"'s profile picture\"}\n width={34}\n height={34}\n />\n </div>\n <div className=\"flex w-full flex-col justify-center min-w-[124px]\">\n <div className=\"space-x-2\">\n <span className=\"text-primary text-sm font-medium capitalize\">\n {user?.displayName}\n </span>\n </div>\n <span className=\"text-muted-foreground text-xs font-normal\">\n Broadcaster\n </span>\n </div>\n <button\n className=\"bg-red-500 rounded-md p-2 text-xs whitespace-nowrap\"\n onClick={logout}\n >\n Log Out\n </button>\n </div>\n )}\n </motion.div>\n )\n}\n","import * as React from \"react\"\n\nimport {\n type ReactNode,\n createContext,\n useCallback,\n useEffect,\n useState,\n} from \"react\"\n\nimport { decode } from \"jsonwebtoken\"\n\nimport { TokenInfo } from \"../utils/types\"\nimport { SparkleConfig } from \"../utils/config\"\nimport { authWithCode } from \"../lib/auth\"\n\nimport useLocalStorage from \"../utils/hooks/useLocalStorage\"\nimport useSearchParam from \"../utils/hooks/useSearchParam\"\n\ninterface AuthContextType {\n account: TokenInfo | null\n token: string | undefined | null\n loading: boolean\n authenticationMethod: AuthenticationMethod\n authenticate: () => void\n logout: () => void\n}\n\nconst TWITCH_CLIENT_ID = \"u9lt242tz2pn5hl5x444ls2xllnvip\"\nconst STORAGE_KEY = \"twitch_access_token\"\n\nconst SCOPES = [\n // \"openid\",\n // \"user:read:email\",\n]\n\nexport const SparkleAuthContext = createContext<AuthContextType>({\n account: null,\n token: null,\n loading: true,\n authenticationMethod: \"JWT\",\n authenticate: () => {},\n logout: () => {},\n})\n\ninterface AuthProviderProps {\n config: SparkleConfig\n children: ReactNode\n}\n\ntype AuthenticationMethod = \"OAT\" | \"JWT\"\n\nexport const AuthProvider = ({ children, config }: AuthProviderProps) => {\n const [accessToken, setAccessToken] = useLocalStorage(STORAGE_KEY, null)\n const [_, setTwitch] = useLocalStorage(\"twitch\")\n const oat = config.oat || useSearchParam(\"oat\")\n\n const [account, setAccount] = useState<TokenInfo | null>(null)\n const [loading, setLoading] = useState(false)\n const [authenticationMethod, setAuthenticationMethod] =\n useState<AuthenticationMethod>(\"JWT\")\n\n useEffect(() => {\n if (accessToken) {\n const decoded = decode(accessToken) as TokenInfo\n\n console.log(decoded)\n\n if (decoded.exp * 1000 < Date.now()) {\n setAccessToken(null)\n setAccount(null)\n return\n }\n\n setAccount(decoded as TokenInfo)\n }\n }, [])\n\n useEffect(() => {\n if (!oat) return\n\n setLoading(true)\n\n authWithCode(config, oat)\n .then((res) => res.json())\n .then((res) => {\n setAccessToken(res.accessToken)\n const decoded = decode(res.accessToken)\n setAccount(decoded as TokenInfo)\n })\n .finally(() => {\n setLoading(false)\n setAuthenticationMethod(\"OAT\")\n })\n }, [oat])\n\n const logout = useCallback(() => {\n setAccessToken(null)\n setAccount(null)\n }, [])\n\n useEffect(() => {\n let accessToken = new URLSearchParams(window.location.hash).get(\n \"#access_token\"\n )\n\n if (!accessToken) return\n\n setTwitch(accessToken)\n\n setLoading(true)\n\n fetch(\"http://localhost:4005/auth\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Api-Key\": config.apiKey,\n \"Project-Id\": config.projectId,\n },\n body: JSON.stringify({ oat: accessToken }),\n })\n .then((res) => res.json())\n .then((res) => {\n setAccessToken(res.accessToken)\n const decoded = decode(res.accessToken)\n setAccount(decoded as TokenInfo)\n })\n .finally(() => {\n setLoading(false)\n window.history.replaceState({}, document.title, \"/\")\n })\n }, [])\n\n const authenticate = useCallback(async () => {\n const redirectUri = \"http://localhost:3000\"\n const scope = SCOPES.join(\" \")\n\n setLoading(true)\n\n try {\n if (!accessToken) {\n window.location.replace(\n `https://id.twitch.tv/oauth2/authorize?client_id=${TWITCH_CLIENT_ID}&redirect_uri=${redirectUri}&response_type=token&scope=${scope}&force_verify=true`\n )\n } else {\n const decoded = decode(accessToken)\n setAccount(decoded as TokenInfo)\n }\n } catch (error) {\n console.error(\"Erreur lors de l'authentification :\", error)\n } finally {\n }\n }, [accessToken])\n\n return (\n <SparkleAuthContext.Provider\n value={{\n authenticationMethod,\n account,\n token: accessToken,\n loading,\n authenticate,\n logout,\n }}\n >\n {children}\n </SparkleAuthContext.Provider>\n )\n}\n","import { SparkleConfig } from \"../utils/config\"\n\nexport const authWithCode = async (config: SparkleConfig, oat: string) => {\n return fetch(\"http://localhost:4005/auth/oat\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Api-Key\": config.apiKey,\n \"Project-Id\": config.projectId,\n },\n body: JSON.stringify({ oat }),\n })\n}\n\nexport const authWithJwt = async (config: SparkleConfig, jwt: string) => {\n return fetch(\"http://localhost:4005/auth\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Api-Key\": config.apiKey,\n \"Project-Id\": config.projectId,\n },\n body: JSON.stringify({ jwt }),\n })\n}\n","import {\n Dispatch,\n SetStateAction,\n useCallback,\n useState,\n useRef,\n useLayoutEffect,\n} from \"react\"\nimport { isBrowser, noop } from \"../utils\"\n\ntype parserOptions<T> =\n | {\n raw: true\n }\n | {\n raw: false\n serializer: (value: T) => string\n deserializer: (value: string) => T\n }\n\nconst useLocalStorage = <T>(\n key: string,\n initialValue?: T,\n options?: parserOptions<T>\n): [T | undefined, Dispatch<SetStateAction<T | undefined>>, () => void] => {\n if (!isBrowser) {\n return [initialValue as T, noop, noop]\n }\n if (!key) {\n throw new Error(\"useLocalStorage key may not be falsy\")\n }\n\n const deserializer = options\n ? options.raw\n ? (value) => value\n : options.deserializer\n : JSON.parse\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const initializer = useRef((key: string) => {\n try {\n const serializer = options\n ? options.raw\n ? String\n : options.serializer\n : JSON.stringify\n\n const localStorageValue = localStorage.getItem(key)\n if (localStorageValue !== null) {\n return deserializer(localStorageValue)\n } else {\n initialValue && localStorage.setItem(key, serializer(initialValue))\n return initialValue\n }\n } catch {\n // If user is in private mode or has storage restriction\n // localStorage can throw. JSON.parse and JSON.stringify\n // can throw, too.\n return initialValue\n }\n })\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [state, setState] = useState<T | undefined>(() =>\n initializer.current(key)\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useLayoutEffect(() => setState(initializer.current(key)), [key])\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const set: Dispatch<SetStateAction<T | undefined>> = useCallback(\n (valOrFunc) => {\n try {\n const newState =\n typeof valOrFunc === \"function\"\n ? (valOrFunc as Function)(state)\n : valOrFunc\n if (typeof newState === \"undefined\") return\n let value: string\n\n if (options)\n if (options.raw)\n if (typeof newState === \"string\") value = newState\n else value = JSON.stringify(newState)\n else if (options.serializer) value = options.serializer(newState)\n else value = JSON.stringify(newState)\n else value = JSON.stringify(newState)\n\n localStorage.setItem(key, value)\n setState(deserializer(value))\n } catch {\n // If user is in private mode or has storage restriction\n // localStorage can throw. Also JSON.stringify can throw.\n }\n },\n [key, setState]\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const remove = useCallback(() => {\n try {\n localStorage.removeItem(key)\n setState(undefined)\n } catch {\n // If user is in private mode or has storage restriction\n // localStorage can throw.\n }\n }, [key, setState])\n\n return [state, set, remove]\n}\n\nexport default useLocalStorage\n","export const noop = () => {}\n\nexport function on<T extends Window | Document | HTMLElement | EventTarget>(\n obj: T | null,\n ...args: Parameters<T[\"addEventListener\"]> | [string, Function | null, ...any]\n): void {\n if (obj && obj.addEventListener) {\n obj.addEventListener(\n ...(args as Parameters<HTMLElement[\"addEventListener\"]>)\n )\n }\n}\n\nexport function off<T extends Window | Document | HTMLElement | EventTarget>(\n obj: T | null,\n ...args:\n | Parameters<T[\"removeEventListener\"]>\n | [string, Function | null, ...any]\n): void {\n if (obj && obj.removeEventListener) {\n obj.removeEventListener(\n ...(args as Parameters<HTMLElement[\"removeEventListener\"]>)\n )\n }\n}\n\nexport const isBrowser = typeof window !== \"undefined\"\n\nexport const isNavigator = typeof navigator !== \"undefined\"\n","import { useEffect, useState } from \"react\"\nimport { isBrowser, off, on } from \"../utils\"\n\nconst getValue = (search: string, param: string) =>\n new URLSearchParams(search).get(param)\n\nexport type UseQueryParam = (param: string) => string | null\n\nconst useSearchParam: UseQueryParam = (param) => {\n const location = window.location\n const [value, setValue] = useState<string | null>(() =>\n getValue(location.search, param)\n )\n\n useEffect(() => {\n const onChange = () => {\n setValue(getValue(location.search, param))\n }\n\n on(window, \"popstate\", onChange)\n on(window, \"pushstate\", onChange)\n on(window, \"replacestate\", onChange)\n\n return () => {\n off(window, \"popstate\", onChange)\n off(window, \"pushstate\", onChange)\n off(window, \"replacestate\", onChange)\n }\n }, [])\n\n return value\n}\n\nconst useSearchParamServer = () => null\n\nexport default isBrowser ? useSearchParam : useSearchParamServer\n","import React, { ReactNode, useCallback, useContext, useRef } from \"react\"\n\nimport { createContext, useEffect, useState } from \"react\"\nimport { SparkleAuthContext } from \"./authProvider\"\nimport { UpdateMessage, WebSocketClient } from \"../lib/websocket\"\nimport { SparkleConfig } from \"../utils/config\"\nimport EventEmitter from \"events\"\n\ninterface WebSocketContextType {\n subscribe: (keys: string[], scope: string) => void\n values: Record<string, any>\n\n on: (event: string, listener: (message: any) => void) => void\n off: (event: string, listener: (message: any) => void) => void\n}\n\nexport const SparkleContext = createContext<WebSocketContextType>({\n subscribe: () => {},\n values: {},\n on: () => {},\n off: () => {},\n})\n\ntype State = Record<string, any>\n\ninterface WebSocketProviderProps {\n config: SparkleConfig\n children: ReactNode\n}\n\nconst eventEmitter = new EventEmitter()\n\nexport const WebSocketProvider = ({ children }: WebSocketProviderProps) => {\n const [values, setValues] = useState<State>({})\n\n const socket = useRef<WebSocketClient>()\n\n const { token } = useContext(SparkleAuthContext)\n\n const on = (event: string, listener: (payload: any) => void) => {\n eventEmitter.on(event, listener)\n }\n\n const off = (event: string, listener: (payload: any) => void) => {\n eventEmitter.off(event, listener)\n }\n\n useEffect(() => {\n socket.current = new WebSocketClient(\"ws://localhost:8000\")\n\n socket.current.on(\"message\", (message: UpdateMessage) => {\n const { scope, payload, type } = message\n\n if (scope === \"__hook__\") {\n eventEmitter.emit(type, JSON.parse(payload))\n return\n }\n\n if (scope === \"__key__\") {\n setValues((prev) => ({ ...prev, [type]: JSON.parse(payload) }))\n }\n })\n\n return () => {\n socket.current?.disconnect()\n }\n }, [])\n\n useEffect(() => {\n if (!socket.current || !token) return\n socket.current.authenticate(token)\n }, [token])\n\n const subscribe = useCallback(\n (keys: string[], scope: string) => {\n socket.current?.subscribe(keys, scope)\n },\n [socket]\n )\n\n return (\n <SparkleContext.Provider\n value={{\n subscribe,\n values,\n on,\n off,\n }}\n >\n {children}\n </SparkleContext.Provider>\n )\n}\n","import z from \"zod\"\nimport EventEmitter from \"events\"\n\nconst subscribeSchema = z.object({\n type: z.literal(\"subscribe\"),\n channels: z.array(z.string()),\n scope: z.string(),\n})\n\nconst unsubscribeSchema = z.object({\n type: z.literal(\"unsubscribe\"),\n channels: z.string(),\n})\n\nconst updateSchema = z.object({\n scope: z.enum([\"__key__\", \"__hook__\"]),\n type: z.string(),\n payload: z.string(),\n})\n\nconst messageSchema = z.union([subscribeSchema, unsubscribeSchema])\n\nexport type Message = z.infer<typeof messageSchema>\n\nexport type UpdateMessage = z.infer<typeof updateSchema>\n\nexport type SubscribeMessage = z.infer<typeof subscribeSchema>\nexport type UnsubscribeMessage = z.infer<typeof unsubscribeSchema>\n\nexport class WebSocketClient extends EventEmitter {\n private socket: WebSocket | null = null\n private queue: Message[] = []\n\n private subscriptions: string[] = []\n\n private isAuthenticating = false\n\n private url: string\n private jwt: string | null = null\n\n constructor(url: string) {\n super()\n this.url = url\n }\n\n private send(data: Message) {\n if (this.socket?.readyState === WebSocket.OPEN) {\n this.socket?.send(JSON.stringify(data))\n } else {\n this.queue.push(data)\n }\n }\n\n authenticate(jwt: string) {\n if (this.isAuthenticating) return\n this.isAuthenticating = true\n this.jwt = jwt\n this.connect()\n }\n\n private connect() {\n const authenticatedUrl = this.url + \"?jwt=\" + this.jwt\n this.socket = new WebSocket(authenticatedUrl)\n\n this.socket.onopen = () => {\n this.queue.forEach((data) => this.send(data))\n this.queue = []\n }\n\n this.socket.onmessage = (event) => {\n const data = JSON.parse(event.data)\n this.emit(\"message\", data)\n }\n\n this.socket.onclose = () => {\n this.reconnect()\n }\n }\n\n reconnect() {\n setTimeout(() => {\n this.queue = [\n {\n type: \"subscribe\",\n channels: this.subscriptions,\n scope: \"key\",\n },\n ]\n\n console.log(\"try reconnecting\")\n\n this.connect()\n }, 5000)\n }\n\n subscribe(channels: string[], scope = \"key\") {\n const newChannels = channels.filter(\n (channel) => !this.subscriptions.includes(channel)\n )\n\n if (!newChannels.length) return\n this.subscriptions = [...this.subscriptions, ...newChannels]\n\n console.log(\"subscribe\", scope, channels)\n\n this.send({\n type: \"subscribe\",\n channels,\n scope,\n })\n }\n\n unsubscribe(channels: string) {\n this.send({ type: \"unsubscribe\", channels })\n }\n\n disconnect() {\n if (!this.socket) return\n\n this.socket.onclose = () => {}\n this.socket.close()\n }\n}\n","import SparkleClient from \"..\"\n\nexport const createDataResource = (client: SparkleClient) => {\n return {\n set: async (key: string, value: any) =>\n client.httpCall({\n action: \"set\",\n key,\n value,\n }),\n\n get: async (key: string) =>\n client.httpCall({\n action: \"get\",\n key,\n }),\n\n incr: async (key: string, value: number) =>\n client.httpCall({\n action: \"incr\",\n key,\n value,\n }),\n\n decr: async (key: string, value: number) =>\n client.httpCall({\n action: \"decr\",\n key,\n value,\n }),\n\n del: async (key: string) =>\n client.httpCall({\n action: \"del\",\n key,\n }),\n }\n}\n","import { SparkleConfig } from \"../utils/config\"\nimport { createDataResource } from \"./resources/database\"\n\nexport default class SparkleClient {\n private config: SparkleConfig\n private token: string\n\n constructor(config: SparkleConfig) {\n this.config = config\n this.token = \"\"\n }\n\n setToken(token: string) {\n this.token = token\n }\n\n get database() {\n return createDataResource(this)\n }\n\n get twitch() {\n return null\n }\n\n get hook() {\n return null\n }\n\n async httpCall(body: any) {\n const result = await fetch(\"http://localhost:4005/actions\", {\n method: \"POST\",\n body: JSON.stringify(body),\n headers: {\n Authorization: `Bearer ${this.token}`,\n \"Content-Type\": \"application/json\",\n },\n })\n\n return result\n }\n}\n\nconst client = new SparkleClient({\n apiKey: \"123\",\n projectId: \"123\",\n})\n","import { useContext, useEffect, useMemo } from \"react\"\nimport { SparkleContext } from \"../providers/realtimeProvider\"\n\nexport function useRealtime<T>(...keyInputs: string[]) {\n const context = useContext(SparkleContext)\n\n const keys = useMemo(() => keyInputs, [keyInputs.join(\",\")])\n\n if (!context) {\n throw new Error(\"You must use useRealtime inside a SparkleProvider\")\n }\n\n useEffect(() => {\n context.subscribe(keys, \"__key__\")\n }, [keys])\n\n return keys.map((k) => context.values[k])\n}\n","import { useContext } from \"react\"\nimport { SparkleAuthContext } from \"../providers/authProvider\"\n\nexport function useAuth() {\n const {\n account,\n token: accessToken,\n loading,\n authenticate,\n logout,\n } = useContext(SparkleAuthContext)\n\n return {\n account,\n token: accessToken,\n loading,\n authenticate,\n logout,\n }\n}\n","import { useContext, useEffect } from \"react\"\nimport { SparkleAuthContext } from \"../providers/authProvider\"\nimport { SparkleAppContext } from \"../provider\"\n\nexport function useDatabase<T extends string>() {\n const { token } = useContext(SparkleAuthContext)\n const { sparkle } = useContext(SparkleAppContext)\n\n if (!sparkle) throw new Error(\"SparkleClient not found in context\")\n\n useEffect(() => {\n if (!token) return\n sparkle.setToken(token)\n }, [token])\n\n return sparkle.database\n}\n","import { useCallback, useContext, useEffect, useState } from \"react\"\nimport { SparkleAuthContext } from \"../providers/authProvider\"\n\nexport function useUser<T extends string>(...keys: T[]) {\n const [user, setUser] = useState({})\n const { token } = useContext(SparkleAuthContext)\n\n const set = useCallback(async (key: string, value: any) => {\n if (value && typeof value === \"object\") {\n value = JSON.stringify(value)\n }\n\n return await fetch(\"http://localhost:4005/users\", {\n method: \"POST\",\n body: JSON.stringify({\n action: \"set\",\n key,\n value,\n }),\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n })\n }, [])\n\n const get = useCallback(async (key: string) => {\n const value = await fetch(\"http://localhost:4005/users\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"get\", key }),\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n })\n\n return value.json()\n\n // return JSON.parse(value.)\n }, [])\n\n // admin / read - write\n // modo / read - write with policies\n // viewer / read only with policies\n // other, same like viewer\n\n useEffect(() => {\n const fetch = async () => {\n const coins = await get(\"coins\")\n setUser({\n coins,\n })\n }\n\n fetch()\n }, [])\n\n return {\n set,\n get,\n incr: async (key: string, value: number) => {\n return await fetch(\"http://localhost:4005/users\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"incr\", key, value }),\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n })\n },\n decr: async (key: string, value: number) => {\n return await fetch(\"http://localhost:4005/users\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"decr\", key, value }),\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n })\n },\n del: async (key: string) => {\n return await fetch(\"http://localhost:4005/users\", {\n method: \"POST\",\n body: JSON.stringify({ action: \"del\", key }),\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n })\n },\n user,\n }\n}\n","import { useContext, useEffect, useMemo, useState } from \"react\"\nimport { SparkleContext } from \"../providers/realtimeProvider\"\nimport type { EventTypeMap } from \"../hooks\"\n\nexport function useHook<T extends keyof EventTypeMap>(\n event: T,\n callback?: (data: EventTypeMap[T]) => void\n) {\n const context = useContext(SparkleContext)\n const [messages, setMessages] = useState<EventTypeMap[T][]>([])\n\n if (!context) {\n throw new Error(\"You must use useHook inside a SparkleProvider\")\n }\n\n useEffect(() => {\n const handler = (message: T) => {\n setMessages((messages) => [...messages, message])\n callback?.(message)\n }\n\n context.on(event, handler)\n\n return () => {\n context.off(event, handler)\n }\n }, [])\n\n useEffect(() => {\n context.subscribe([event], \"__hook__\")\n }, [event])\n\n return {\n events: messages,\n lastEvent: messages[messages.length - 1] as EventTypeMap[T] | undefined,\n }\n}\n"],"mappings":"AAAA,OAAOA,GAEL,cAAAC,GACA,aAAAC,EACA,YAAAC,EACA,iBAAAC,OACK,QCNP,UAAYC,MAAW,QACvB,OAAS,UAAAC,MAAc,gBACvB,OAAS,WAAAC,OAAe,eAOT,SAARC,EAA2B,CAAE,aAAAC,EAAc,QAAAC,CAAQ,EAAmB,CAC3E,OACE,gBAAC,OAAI,UAAU,iDACb,gBAAC,OAAI,UAAU,yHACb,gBAAC,MAAG,UAAU,yCAAwC,iBAEtD,EACA,gBAACJ,EAAO,OAAP,CACC,OAAM,GACN,UAAU,kUACV,QAASG,EACT,SAAUC,GAEV,gBAACJ,EAAO,IAAP,CACC,OAAM,GACN,IAAKI,EAAU,UAAY,SAC3B,QAAS,CAAE,QAAS,CAAE,EACtB,QAAS,CAAE,QAAS,CAAE,EACtB,KAAM,CAAE,QAAS,CAAE,GAElBA,EACC,gBAACH,GAAA,CAAQ,UAAU,eAAe,EAElC,gBAAC,YAAK,mBAAiB,CAE3B,CACF,EAEA,gBAAC,QAAK,UAAU,WAAU,oBAAkB,CAC9C,CACF,CAEJ,CCzCA,OAAOI,GAAS,cAAAC,OAAkB,QAElC,OAAS,WAAAC,OAAe,eACxB,OAAS,UAAAC,OAAc,gBCHvB,UAAYC,MAAW,QAEvB,OAEE,iBAAAC,GACA,eAAAC,EACA,aAAAC,EACA,YAAAC,MACK,QAEP,OAAS,UAAAC,MAAc,eCRhB,IAAMC,EAAe,MAAOC,EAAuBC,IACjD,MAAM,iCAAkC,CAC7C,OAAQ,OACR,QAAS,CACP,eAAgB,mBAChB,UAAWD,EAAO,OAClB,aAAcA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AAC,EAChDT,IAAWS,CAAO,CACpB,EAEA,OAAAR,EAAQ,GAAGF,EAAOS,CAAO,EAElB,IAAM,CACXP,EAAQ,IAAIF,EAAOS,CAAO,CAC5B,CACF,EAAG,CAAC,CAAC,EAELD,EAAU,IAAM,CACdN,EAAQ,UAAU,CAACF,CAAK,EAAG,UAAU,CACvC,EAAG,CAACA,CAAK,CAAC,EAEH,CACL,OAAQK,EACR,UAAWA,EAASA,EAAS,OAAS,CAAC,CACzC,CACF","names":["React","useContext","useEffect","useState","createContext","React","motion","Loader2","LoginForm","authenticate","loading","React","useContext","Loader2","motion","React","createContext","useCallback","useEffect","useState","decode","authWithCode","config","oat","useCallback","useState","useRef","useLayoutEffect","noop","on","obj","args","off","isBrowser","useLocalStorage","key","initialValue","options","isBrowser","noop","deserializer","value","initializer","useRef","serializer","localStorageValue","state","setState","useState","useLayoutEffect","set","useCallback","valOrFunc","newState","remove","useLocalStorage_default","useEffect","useState","getValue","search","param","useSearchParam","location","value","setValue","useState","useEffect","onChange","on","off","useSearchParamServer","useSearchParam_default","isBrowser","TWITCH_CLIENT_ID","STORAGE_KEY","SCOPES","SparkleAuthContext","createContext","AuthProvider","children","config","accessToken","setAccessToken","useLocalStorage_default","_","setTwitch","oat","useSearchParam_default","account","setAccount","useState","loading","setLoading","authenticationMethod","setAuthenticationMethod","useEffect","decoded","decode","authWithCode","res","logout","useCallback","authenticate","redirectUri","scope","error","UserInfo","user","loading","logout","authenticationMethod","useContext","SparkleAuthContext","React","motion","Loader2","React","useCallback","useContext","useRef","createContext","useEffect","useState","z","EventEmitter","subscribeSchema","unsubscribeSchema","updateSchema","messageSchema","WebSocketClient","url","data","jwt","authenticatedUrl","event","channels","scope","newChannels","channel","EventEmitter","SparkleContext","createContext","eventEmitter","WebSocketProvider","children","values","setValues","useState","socket","useRef","token","useContext","SparkleAuthContext","on","event","listener","off","useEffect","WebSocketClient","message","scope","payload","type","prev","subscribe","useCallback","keys","React","createDataResource","client","key","value","SparkleClient","config","token","createDataResource","body","client","Provider","children","isClientReady","setIsClientReady","useState","authenticate","logout","token","account","loading","useContext","SparkleAuthContext","useEffect","React","UserInfo","LoginForm","SparkleAppContext","createContext","SparkleProvider","config","sparkle","setSparkle","SparkleClient","AuthProvider","WebSocketProvider","useContext","useEffect","useMemo","useRealtime","keyInputs","context","useContext","SparkleContext","keys","useMemo","useEffect","k","useContext","useAuth","account","accessToken","loading","authenticate","logout","useContext","SparkleAuthContext","useContext","useEffect","useDatabase","token","useContext","SparkleAuthContext","sparkle","SparkleAppContext","useEffect","useCallback","useContext","useEffect","useState","useUser","keys","user","setUser","useState","token","useContext","SparkleAuthContext","set","useCallback","key","value","get","useEffect","coins","useContext","useEffect","useState","useHook","event","callback","context","useContext","SparkleContext","messages","setMessages","useState","useEffect","handler","message"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkle-react",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -8,6 +8,7 @@
8
8
  "types": "./dist/index.d.mts",
9
9
  "license": "MIT",
10
10
  "devDependencies": {
11
+ "@types/jsonwebtoken": "^9.0.5",
11
12
  "autoprefixer": "^10.0.1",
12
13
  "postcss": "^8",
13
14
  "rimraf": "^5.0.5",
@@ -16,7 +17,11 @@
16
17
  "typescript": "^5.3.3"
17
18
  },
18
19
  "dependencies": {
19
- "react": "^18.2.0"
20
+ "framer-motion": "^10.16.16",
21
+ "jsonwebtoken": "^9.0.2",
22
+ "lucide-react": "^0.294.0",
23
+ "react": "^18.2.0",
24
+ "zod": "^3.22.4"
20
25
  },
21
26
  "scripts": {
22
27
  "dev": "tsup --watch",