sparkle-react 0.0.9 → 0.0.11
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 +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +332 -28
- package/dist/index.mjs +1 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -3
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-
|
|
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 */
|
package/dist/index.css.map
CHANGED
|
@@ -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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,MAClB,CAMA,IACA,MACE,UAAW,KACX,OAAQ,IACV,CAGA,CAAC,QACC,QAAS,IACX,CAEA,EAAG,QAAU,OACX,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,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,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A,CAAC,iBACC,oBAAoB,KAAK,MACzB,wBAAyB,IAAI,oBAAoB,IAAI,0BAA0B,IAAI,wBAAwB,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,eACC,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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BAA6B,UAC5B,eAAgB,IAClB,CACA,CAAC,oBAAoB,UACnB,QAAS,EACX","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,44 +1,348 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ApiClient } from '@twurple/api';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
declare const sparkleConfig: z.ZodObject<{
|
|
6
|
+
apiKey: z.ZodString;
|
|
7
|
+
projectId: z.ZodString;
|
|
8
|
+
oat: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
oat?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
apiKey: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
oat?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
type SparkleConfig = z.infer<typeof sparkleConfig>;
|
|
19
|
+
|
|
20
|
+
declare class SparkleClient {
|
|
21
|
+
private config;
|
|
22
|
+
private token;
|
|
23
|
+
constructor(config: SparkleConfig);
|
|
24
|
+
setToken(token: string): void;
|
|
25
|
+
get database(): {
|
|
26
|
+
set: (key: string, value: any) => Promise<Response>;
|
|
27
|
+
get: (key: string) => Promise<Response>;
|
|
28
|
+
incr: (key: string, value: number) => Promise<Response>;
|
|
29
|
+
decr: (key: string, value: number) => Promise<Response>;
|
|
30
|
+
del: (key: string) => Promise<Response>;
|
|
31
|
+
};
|
|
32
|
+
get twitch(): null;
|
|
33
|
+
get hook(): null;
|
|
34
|
+
httpCall(body: any): Promise<Response>;
|
|
7
35
|
}
|
|
8
|
-
|
|
36
|
+
|
|
9
37
|
interface SparkleProviderProps {
|
|
38
|
+
config: SparkleConfig;
|
|
10
39
|
children: ReactNode;
|
|
11
40
|
}
|
|
12
|
-
declare const
|
|
41
|
+
declare const SparkleAppContext: React.Context<{
|
|
42
|
+
sparkle: SparkleClient | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
declare const SparkleProvider: ({ children, config }: SparkleProviderProps) => React.JSX.Element;
|
|
13
45
|
|
|
14
|
-
declare function useRealtime<T
|
|
46
|
+
declare function useRealtime<T>(...keyInputs: string[]): any[];
|
|
15
47
|
|
|
16
|
-
interface
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
broadcaster_type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
profile_image_url: string;
|
|
24
|
-
offline_image_url: string;
|
|
25
|
-
view_count: number;
|
|
26
|
-
email: string;
|
|
48
|
+
interface TokenInfo {
|
|
49
|
+
userId: string;
|
|
50
|
+
displayName: string;
|
|
51
|
+
profilePictureUrl: string;
|
|
52
|
+
exp: number;
|
|
27
53
|
}
|
|
28
|
-
|
|
29
|
-
|
|
54
|
+
|
|
55
|
+
declare function useAuth(): {
|
|
56
|
+
account: TokenInfo | null;
|
|
57
|
+
token: string | null | undefined;
|
|
30
58
|
loading: boolean;
|
|
31
|
-
|
|
32
|
-
authenticate: () => Promise<void>;
|
|
59
|
+
authenticate: () => void;
|
|
33
60
|
logout: () => void;
|
|
34
61
|
};
|
|
35
62
|
|
|
36
|
-
declare function
|
|
63
|
+
declare function useTwitch(asUser?: string | number): {
|
|
64
|
+
apiClient: ApiClient | null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare function useDatabase<T extends string>(): {
|
|
37
68
|
set: (key: string, value: any) => Promise<Response>;
|
|
38
|
-
get: (key: string) => Promise<
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
get: (key: string) => Promise<Response>;
|
|
70
|
+
incr: (key: string, value: number) => Promise<Response>;
|
|
71
|
+
decr: (key: string, value: number) => Promise<Response>;
|
|
41
72
|
del: (key: string) => Promise<Response>;
|
|
42
73
|
};
|
|
43
74
|
|
|
44
|
-
|
|
75
|
+
declare function useUser<T extends string>(...keys: T[]): {
|
|
76
|
+
set: (key: string, value: any) => Promise<Response>;
|
|
77
|
+
get: (key: string) => Promise<any>;
|
|
78
|
+
incr: (key: string, value: number) => Promise<Response>;
|
|
79
|
+
decr: (key: string, value: number) => Promise<Response>;
|
|
80
|
+
del: (key: string) => Promise<Response>;
|
|
81
|
+
user: {};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type CCL =
|
|
85
|
+
| "DrugsIntoxication"
|
|
86
|
+
| "Gambling"
|
|
87
|
+
| "MatureGame"
|
|
88
|
+
| "ProfanityVulgarity"
|
|
89
|
+
| "SexualThemes"
|
|
90
|
+
| "ViolentGraphic"
|
|
91
|
+
|
|
92
|
+
type EventTypeMap = {
|
|
93
|
+
// Notifications
|
|
94
|
+
"notification.follow": EventSubFollowEvent
|
|
95
|
+
"notification.subscribe": EventSubSubscribeEvent
|
|
96
|
+
"notification.cheer": EventSubCheerEvent
|
|
97
|
+
|
|
98
|
+
// Streams
|
|
99
|
+
"stream.online": EventSubStreamOnlineEvent
|
|
100
|
+
"stream.offline": EventSubStreamOfflineEvent
|
|
101
|
+
"stream.update": EventSubStreamUpdateEvent
|
|
102
|
+
|
|
103
|
+
// Rewards
|
|
104
|
+
"reward.add": EventSubRewardAddEvent
|
|
105
|
+
"reward.update": EventSubRewardUpdateEvent
|
|
106
|
+
"reward.remove": EventSubRewardRemoveEvent
|
|
107
|
+
"reward.redemption.claim": EventSubRedemptionClaimEvent
|
|
108
|
+
"reward.redemption.update": EventSubRedemptionUpdateEvent
|
|
109
|
+
|
|
110
|
+
// Polls
|
|
111
|
+
"poll.begin": EventSubPollBeginEvent
|
|
112
|
+
"poll.progress": EventSubPollProgressEvent
|
|
113
|
+
"poll.end": EventSubPollEndEvent
|
|
114
|
+
|
|
115
|
+
// Predictions
|
|
116
|
+
"prediction.begin": EventSubPredictionBeginEvent
|
|
117
|
+
"prediction.progress": EventSubPredictionProgressEvent
|
|
118
|
+
"prediction.lock": EventSubPredictionLockEvent
|
|
119
|
+
"prediction.end": EventSubPredictionEndEvent
|
|
120
|
+
|
|
121
|
+
// Moderations
|
|
122
|
+
"moderator.add": EventSubModeratorAddEvent
|
|
123
|
+
"moderator.remove": EventSubModeratorRemoveEvent
|
|
124
|
+
|
|
125
|
+
"moderator.ban": EventSubModeratorBanEvent
|
|
126
|
+
"moderator.unban": EventSubModeratorUnbanEvent
|
|
127
|
+
|
|
128
|
+
"moderator.shield_mode.begin": EventSubModeratorShieldModeBeginEvent
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Notifications Events
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
interface EventSubFollowEvent {
|
|
136
|
+
user_id: string
|
|
137
|
+
user_login: string
|
|
138
|
+
user_name: string
|
|
139
|
+
followed_at: string
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface EventSubSubscribeEvent {
|
|
143
|
+
user_id: string
|
|
144
|
+
user_login: string
|
|
145
|
+
user_name: string
|
|
146
|
+
tier: string
|
|
147
|
+
is_gift: boolean
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface EventSubCheerEvent {
|
|
151
|
+
is_anonymous: boolean
|
|
152
|
+
user_id?: string
|
|
153
|
+
user_login?: string
|
|
154
|
+
user_name?: string
|
|
155
|
+
message: string
|
|
156
|
+
bits: number
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Stream Events
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
interface EventSubStreamOnlineEvent {
|
|
164
|
+
id: string
|
|
165
|
+
type: "live" | "playlist" | "watch_party" | "premiere" | "rerun"
|
|
166
|
+
started_at: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface EventSubStreamOfflineEvent {}
|
|
170
|
+
|
|
171
|
+
interface EventSubStreamUpdateEvent {
|
|
172
|
+
title: string
|
|
173
|
+
language: string
|
|
174
|
+
category_id: string
|
|
175
|
+
category_name: string
|
|
176
|
+
content_classification_labels: CCL[]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Rewards Events
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
interface RewardImage {
|
|
184
|
+
url_1x: string | null
|
|
185
|
+
url_2x: string | null
|
|
186
|
+
url_4x: string | null
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface RewardCooldown {
|
|
190
|
+
is_enabled: boolean
|
|
191
|
+
value: number
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface EventSubRewardAddEvent {
|
|
195
|
+
id: string
|
|
196
|
+
is_enabled: boolean
|
|
197
|
+
is_paused: boolean
|
|
198
|
+
is_in_stock: boolean
|
|
199
|
+
title: string
|
|
200
|
+
cost: number
|
|
201
|
+
prompt: string
|
|
202
|
+
is_user_input_required: boolean
|
|
203
|
+
should_redemptions_skip_request_queue: boolean
|
|
204
|
+
max_per_stream: RewardCooldown
|
|
205
|
+
max_per_user_per_stream: RewardCooldown
|
|
206
|
+
background_color: string
|
|
207
|
+
image: RewardImage | null
|
|
208
|
+
default_image: RewardImage
|
|
209
|
+
global_cooldown: RewardCooldown
|
|
210
|
+
cooldown_expires_at: string | null
|
|
211
|
+
redemptions_redeemed_current_stream: number | null
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface EventSubRewardUpdateEvent extends EventSubRewardAddEvent {}
|
|
215
|
+
interface EventSubRewardRemoveEvent extends EventSubRewardAddEvent {}
|
|
216
|
+
|
|
217
|
+
interface RewardInfo {
|
|
218
|
+
id: string // Identifiant de la récompense
|
|
219
|
+
title: string // Nom de la récompense
|
|
220
|
+
cost: number // Coût de la récompense
|
|
221
|
+
prompt: string // Description de la récompense
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
interface EventSubRedemptionClaimEvent {
|
|
225
|
+
id: string // Identifiant du rachat de la récompense
|
|
226
|
+
user_id: string // ID de l'utilisateur ayant racheté la récompense
|
|
227
|
+
user_login: string // Nom d'utilisateur de l'utilisateur ayant racheté la récompense
|
|
228
|
+
user_name: string // Nom d'affichage de l'utilisateur ayant racheté la récompense
|
|
229
|
+
user_input: string // Entrée de l'utilisateur fournie. Chaîne vide si non fournie.
|
|
230
|
+
status: "unknown" | "unfulfilled" | "fulfilled" | "canceled" // Statut du rachat de la récompense. Les valeurs possibles sont "unknown", "unfulfilled", "fulfilled" et "canceled".
|
|
231
|
+
reward: RewardInfo // Informations de base sur la récompense qui a été rachetée au moment du rachat
|
|
232
|
+
redeemed_at: string // Horodatage RFC3339 du moment où la récompense a été rachetée
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface EventSubRedemptionUpdateEvent extends EventSubRedemptionClaimEvent {}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Polls Events
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
interface PollChoice {
|
|
242
|
+
id: string
|
|
243
|
+
title: string
|
|
244
|
+
channel_points_votes: number
|
|
245
|
+
votes: number
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
interface PollChannelPointsVoting {
|
|
249
|
+
is_enabled: boolean
|
|
250
|
+
amount_per_vote: number
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface EventSubPollBeginEvent {
|
|
254
|
+
id: string
|
|
255
|
+
title: string
|
|
256
|
+
choices: PollChoice[]
|
|
257
|
+
channel_points_voting: PollChannelPointsVoting
|
|
258
|
+
started_at: string
|
|
259
|
+
ends_at: string
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface EventSubPollProgressEvent extends EventSubPollBeginEvent {}
|
|
263
|
+
|
|
264
|
+
interface EventSubPollEndEvent extends EventSubPollBeginEvent {
|
|
265
|
+
status: "completed" | "archived" | "terminated"
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Predictions Events
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
interface TopPredictor {
|
|
273
|
+
user_id: string // ID de l'utilisateur
|
|
274
|
+
user_login: string // Nom d'utilisateur de l'utilisateur
|
|
275
|
+
user_name: string // Nom d'affichage de l'utilisateur
|
|
276
|
+
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)
|
|
277
|
+
channel_points_used: number // Nombre de Points de Chaîne utilisés pour participer à la prédiction
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
interface Outcome {
|
|
281
|
+
id: string // ID du résultat
|
|
282
|
+
title: string // Titre du résultat
|
|
283
|
+
color: "pink" | "blue" // Couleur du résultat. Les valeurs valides sont "pink" et "blue".
|
|
284
|
+
users: number // Nombre d'utilisateurs ayant utilisé des Points de Chaîne pour ce résultat
|
|
285
|
+
channel_points: number // Nombre total de Points de Chaîne utilisés pour ce résultat
|
|
286
|
+
top_predictors: TopPredictor[] // Un tableau d'utilisateurs ayant utilisé le plus de Points de Chaîne sur ce résultat
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
interface EventSubPredictionBeginEvent {
|
|
290
|
+
id: string // ID de la prédiction de Points de Chaîne
|
|
291
|
+
title: string // Titre de la prédiction de Points de Chaîne
|
|
292
|
+
outcomes: Outcome[] // Un tableau de résultats (outcomes) pour la prédiction de Points de Chaîne
|
|
293
|
+
started_at: string // Heure de début de la prédiction de Points de Chaîne
|
|
294
|
+
locks_at: string // Heure à laquelle la prédiction de Points de Chaîne se verrouillera automatiquement
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface EventSubPredictionProgressEvent
|
|
298
|
+
extends EventSubPredictionBeginEvent {}
|
|
299
|
+
interface EventSubPredictionLockEvent extends EventSubPredictionBeginEvent {}
|
|
300
|
+
|
|
301
|
+
interface EventSubPredictionEndEvent extends EventSubPredictionBeginEvent {
|
|
302
|
+
ended_at: string // Heure de fin de la prédiction de Points de Chaîne
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Moderations Events
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
interface EventSubModeratorAddEvent {
|
|
310
|
+
user_id: string
|
|
311
|
+
user_login: string
|
|
312
|
+
user_name: string
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
interface EventSubModeratorRemoveEvent {
|
|
316
|
+
user_id: string
|
|
317
|
+
user_login: string
|
|
318
|
+
user_name: string
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface EventSubModeratorBanEvent {
|
|
322
|
+
user_id: string
|
|
323
|
+
user_login: string
|
|
324
|
+
user_name: string
|
|
325
|
+
moderator_user_id: string
|
|
326
|
+
moderator_user_login: string
|
|
327
|
+
moderator_user_name: string
|
|
328
|
+
reason: string
|
|
329
|
+
banned_at: string
|
|
330
|
+
ends_at: string | null
|
|
331
|
+
is_permanent: boolean
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface EventSubModeratorUnbanEvent {
|
|
335
|
+
user_id: string
|
|
336
|
+
user_login: string
|
|
337
|
+
user_name: string
|
|
338
|
+
moderator_user_id: string
|
|
339
|
+
moderator_user_login: string
|
|
340
|
+
moderator_user_name: string
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
declare function useHook<T extends keyof EventTypeMap>(event: T, callback?: (data: EventTypeMap[T]) => void): {
|
|
344
|
+
events: EventTypeMap[T][];
|
|
345
|
+
lastEvent: EventTypeMap[T] | undefined;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export { SparkleAppContext, SparkleProvider, type SparkleProviderProps, useAuth, useDatabase, useHook, useRealtime, useTwitch, useUser };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { createContext, useState, useCallback, useEffect, useContext, useMemo } from 'react';
|
|
2
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
function v(){let[o,a]=useState(null),[i,s]=useState(!0),e="u9lt242tz2pn5hl5x444ls2xllnvip",t=useCallback(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 c=(await fetch("https://api.twitch.tv/helix/users",{headers:{Authorization:`Bearer ${r}`,"Client-Id":e}}).then(y=>y.json())).data[0];a(c);}},[]),n=useCallback(async()=>{try{let r="http://localhost:3000/test",p=["user:read:email","channel:read:vips","user:read:follows","user:read:subscriptions"].join(" "),c=new URLSearchParams(window.location.hash).get("#access_token")||localStorage.getItem("twitch_access_token");if(!c)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",c);let _=(await fetch("https://api.twitch.tv/helix/users",{headers:{Authorization:`Bearer ${c}`,"Client-Id":e}}).then(T=>T.json())).data[0];a(_);}}catch(r){console.error("Erreur lors de l'authentification :",r);}finally{s(!1);}},[]),h=useCallback(()=>{localStorage.removeItem("twitch_access_token"),a(null);},[]),d=useCallback(async()=>{let r=new URLSearchParams(window.location.hash).get("#access_token")||localStorage.getItem("twitch_access_token");await fetch("https://api.twitch.tv/helix/channels/vips?broadcaster_id=540958129",{method:"GET",headers:{Authorization:`Bearer ${r}`,"Client-Id":e}}).then(c=>c.json());},[]);return useEffect(()=>{t();},[]),{user:o,loading:i,fetchVips:d,authenticate:n,logout:h}}function b({authenticate:o}){return jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-xl",children:jsxs("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",children:[jsx("div",{children:"Salut"}),jsx("button",{className:"bg-white rounded-md p-2 text-xs whitespace-nowrap text-black",onClick:o,children:"Log In"}),jsx("span",{className:"text-xs",children:"Powered by Sparkle"})]})})}function f({user:o,logout:a}){return jsx("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",children:jsxs("div",{className:"flex w-full flex-row items-center gap-3",children:[jsx("div",{className:"flex h-[34px] w-[34px] flex-shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#313131] text-sm",children:jsx("img",{src:o?.profile_image_url||"",alt:o?.display_name+"'s profile picture",width:34,height:34})}),jsxs("div",{className:"flex w-full flex-col justify-center min-w-[124px]",children:[jsx("div",{className:"space-x-2",children:jsx("span",{className:"text-primary text-sm font-medium capitalize",children:o?.display_name})}),jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"Broadcaster"})]}),jsx("button",{className:"bg-red-500 rounded-md p-2 text-xs whitespace-nowrap",onClick:a,children:"Log Out"})]})})}var w=createContext({socket:void 0}),K=({children:o})=>{let[a,i]=useState(),{user:s,authenticate:e,logout:t}=v();return useEffect(()=>{let n=new WebSocket("ws://localhost:8000");return i(n),()=>{n.close();}},[]),jsxs(w.Provider,{value:{socket:a},children:[!s&&jsx(b,{authenticate:e}),s&&jsx(Fragment,{children:jsx(f,{user:s,logout:t})}),o]})};function rt(...o){let a=useContext(w),i=useMemo(()=>o,[o.join(",")]),[s,e]=useState(i.reduce((d,r)=>({...d,[r]:""}),{}));if(!a)throw new Error("You must use useDatabase inside a SparkleProvider");let{socket:t}=a,n=useCallback(()=>{t?.send(JSON.stringify({type:"subscribe",keys:i}));},[t,i]),h=useCallback(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 useEffect(()=>{if(t)return t.readyState===WebSocket.OPEN&&n(),t.addEventListener("open",n),t.addEventListener("message",h),()=>{t.removeEventListener("open",n),t.removeEventListener("message",h);}},[t]),useEffect(()=>{console.log("update keys",i),n();},[i]),s}function st(...o){useContext(w);let i=useCallback(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=useCallback(async e=>{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"}})}}
|
|
5
|
-
|
|
6
|
-
export { w as SparkleContext, K as SparkleProvider, st as useData, rt as useRealtime, v as useTwitch };
|
|
7
|
-
//# sourceMappingURL=out.js.map
|
|
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 E({authenticate:r,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:r,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 _,useState as M}from"react";import{decode as z}from"jsonwebtoken";var U=async(r,e)=>fetch("http://localhost:4005/auth/oat",{method:"POST",headers:{"Content-Type":"application/json","Api-Key":r.apiKey,"Project-Id":r.projectId},body:JSON.stringify({oat:e})});import{useCallback as J,useState as te,useRef as re,useLayoutEffect as oe}from"react";var N=()=>{};function S(r,...e){r&&r.addEventListener&&r.addEventListener(...e)}function C(r,...e){r&&r.removeEventListener&&r.removeEventListener(...e)}var T=typeof window<"u";var ne=(r,e,t)=>{if(!T)return[e,N,N];if(!r)throw new Error("useLocalStorage key may not be falsy");let o=t?t.raw?s=>s:t.deserializer:JSON.parse,n=re(s=>{try{let c=t?t.raw?String:t.serializer:JSON.stringify,p=localStorage.getItem(s);return p!==null?o(p):(e&&localStorage.setItem(s,c(e)),e)}catch{return e}}),[l,i]=te(()=>n.current(r));oe(()=>i(n.current(r)),[r]);let a=J(s=>{try{let c=typeof s=="function"?s(l):s;if(typeof c>"u")return;let p;t?t.raw?typeof c=="string"?p=c:p=JSON.stringify(c):t.serializer?p=t.serializer(c):p=JSON.stringify(c):p=JSON.stringify(c),localStorage.setItem(r,p),i(o(p))}catch{}},[r,i]),d=J(()=>{try{localStorage.removeItem(r),i(void 0)}catch{}},[r,i]);return[l,a,d]},x=ne;import{useEffect as ie,useState as ae}from"react";var W=(r,e)=>new URLSearchParams(r).get(e),se=r=>{let e=window.location,[t,o]=ae(()=>W(e.search,r));return ie(()=>{let n=()=>{o(W(e.search,r))};return S(window,"popstate",n),S(window,"pushstate",n),S(window,"replacestate",n),()=>{C(window,"popstate",n),C(window,"pushstate",n),C(window,"replacestate",n)}},[]),t},ce=()=>null,R=T?se:ce;var de="u9lt242tz2pn5hl5x444ls2xllnvip",pe="twitch_access_token",ue=[],h=le({account:null,token:null,loading:!0,authenticationMethod:"JWT",authenticate:()=>{},logout:()=>{}}),D=({children:r,config:e})=>{let[t,o]=x(pe,null),[n,l]=x("twitch"),i=e.oat||R("oat"),[a,d]=M(null),[s,c]=M(!1),[p,A]=M("JWT");_(()=>{if(t){let u=z(t);if(console.log(u),u.exp*1e3<Date.now()){o(null),d(null);return}d(u)}},[]),_(()=>{i&&(c(!0),U(e,i).then(u=>u.json()).then(u=>{o(u.accessToken);let w=z(u.accessToken);d(w)}).finally(()=>{c(!1),A("OAT")}))},[i]);let V=F(()=>{o(null),d(null)},[]);_(()=>{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=>{o(w.accessToken);let v=z(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(!t)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=z(t);d(v)}}catch(v){console.error("Erreur lors de l'authentification :",v)}finally{}},[t]);return B.createElement(h.Provider,{value:{authenticationMethod:p,account:a,token:t,loading:s,authenticate:Z,logout:V}},r)};function O({user:r,loading:e,logout:t}){let{authenticationMethod:o}=he(h);return o==="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||!r?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:r?.profilePictureUrl||"",alt:r?.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"},r?.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:t},"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()}),wt=f.object({scope:f.enum(["__key__","__hook__"]),type:f.string(),payload:f.string()}),bt=f.union([we,be]),P=class extends ge{constructor(t){super();this.socket=null;this.queue=[];this.subscriptions=[];this.isAuthenticating=!1;this.jwt=null;this.url=t}send(t){this.socket?.readyState===WebSocket.OPEN?this.socket?.send(JSON.stringify(t)):this.queue.push(t)}authenticate(t){this.isAuthenticating||(this.isAuthenticating=!0,this.jwt=t,this.connect())}connect(){let t=this.url+"?jwt="+this.jwt;this.socket=new WebSocket(t),this.socket.onopen=()=>{this.queue.forEach(o=>this.send(o)),this.queue=[]},this.socket.onmessage=o=>{let n=JSON.parse(o.data);this.emit("message",n)},this.socket.onclose=()=>{this.reconnect()}}reconnect(){setTimeout(()=>{this.queue=[{type:"subscribe",channels:this.subscriptions,scope:"key"}],console.log("try reconnecting"),this.connect()},5e3)}subscribe(t,o="key"){let n=t.filter(l=>!this.subscriptions.includes(l));n.length&&(this.subscriptions=[...this.subscriptions,...n],console.log("subscribe",o,t),this.send({type:"subscribe",channels:t,scope:o}))}unsubscribe(t){this.send({type:"unsubscribe",channels:t})}disconnect(){this.socket&&(this.socket.onclose=()=>{},this.socket.close())}};import Te from"events";var k=Se({subscribe:()=>{},values:{},on:()=>{},off:()=>{}}),j=new Te,$=({children:r})=>{let[e,t]=Ce({}),o=ke(),{token:n}=xe(h),l=(d,s)=>{j.on(d,s)},i=(d,s)=>{j.off(d,s)};H(()=>(o.current=new P("ws://localhost:8000"),o.current.on("message",d=>{let{scope:s,payload:c,type:p}=d;if(s==="__hook__"){j.emit(p,JSON.parse(c));return}s==="__key__"&&t(A=>({...A,[p]:JSON.parse(c)}))}),()=>{o.current?.disconnect()}),[]),H(()=>{!o.current||!n||o.current.authenticate(n)},[n]);let a=ve((d,s)=>{o.current?.subscribe(d,s)},[o]);return ye.createElement(k.Provider,{value:{subscribe:a,values:e,on:l,off:i}},r)};var K=r=>({set:async(e,t)=>r.httpCall({action:"set",key:e,value:t}),get:async e=>r.httpCall({action:"get",key:e}),incr:async(e,t)=>r.httpCall({action:"incr",key:e,value:t}),decr:async(e,t)=>r.httpCall({action:"decr",key:e,value:t}),del:async e=>r.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"}})}},Nt=new y({apiKey:"123",projectId:"123"});var Ae=({children:r})=>{let[e,t]=q(!1),{authenticate:o,logout:n,token:l,account:i,loading:a}=ze(h);return Y(()=>{t(!0)},[]),e?l?b.createElement(b.Fragment,null,b.createElement(O,{user:i,logout:n,loading:a}),i&&r):b.createElement(E,{authenticate:o,loading:a}):null},I=Pe({sparkle:void 0}),Jt=({children:r,config:e})=>{let[t,o]=q();return Y(()=>{e&&o(new y(e))},[e]),b.createElement(I.Provider,{value:{sparkle:t}},b.createElement(D,{config:e},b.createElement($,{config:e},b.createElement(Ae,null,r))))};import{useContext as Ee,useEffect as Ne,useMemo as _e}from"react";function Bt(...r){let e=Ee(k),t=_e(()=>r,[r.join(",")]);if(!e)throw new Error("You must use useRealtime inside a SparkleProvider");return Ne(()=>{e.subscribe(t,"__key__")},[t]),t.map(o=>e.values[o])}import{useContext as Me}from"react";function Kt(){let{account:r,token:e,loading:t,authenticate:o,logout:n}=Me(h);return{account:r,token:e,loading:t,authenticate:o,logout:n}}import{ApiClient as Oe}from"@twurple/api";import{StaticAuthProvider as je}from"@twurple/auth";import{useEffect as Ie,useState as Le}from"react";function Vt(r){let[e,t]=Le(null),[o]=x("twitch");return Ie(()=>{console.log("env",process.env.TWITCH_CLIENT_ID),console.log("init");let n=new Oe({authProvider:new je("u9lt242tz2pn5hl5x444ls2xllnvip",o,["bits:read","channel:manage:moderators","channel:manage:polls","channel:manage:predictions","channel:manage:redemptions","channel:manage:vips","channel:read:polls","channel:read:predictions","channel:read:redemptions","channel:read:subscriptions","channel:read:vips","moderation:read","moderator:manage:announcements","channel:moderate","moderator:read:blocked_terms","moderator:read:chatters","moderator:read:followers","user:read:email"])});return t(n),()=>{t(null)}},[]),{apiClient:e}}import{useContext as X,useEffect as Ue}from"react";function or(){let{token:r}=X(h),{sparkle:e}=X(I);if(!e)throw new Error("SparkleClient not found in context");return Ue(()=>{r&&e.setToken(r)},[r]),e.database}import{useCallback as Q,useContext as Je,useEffect as We,useState as Re}from"react";function sr(...r){let[e,t]=Re({}),{token:o}=Je(h),n=Q(async(i,a)=>(a&&typeof a=="object"&&(a=JSON.stringify(a)),await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"set",key:i,value:a}),headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})),[]),l=Q(async i=>(await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"get",key:i}),headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})).json(),[]);return We(()=>{(async()=>{let a=await l("coins");t({coins:a})})()},[]),{set:n,get:l,incr:async(i,a)=>await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"incr",key:i,value:a}),headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),decr:async(i,a)=>await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"decr",key:i,value:a}),headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),del:async i=>await fetch("http://localhost:4005/users",{method:"POST",body:JSON.stringify({action:"del",key:i}),headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),user:e}}import{useContext as Fe,useEffect as G,useState as Be}from"react";function ur(r,e){let t=Fe(k),[o,n]=Be([]);if(!t)throw new Error("You must use useHook inside a SparkleProvider");return G(()=>{let l=i=>{n(a=>[...a,i]),e?.(i)};return t.on(r,l),()=>{t.off(r,l)}},[]),G(()=>{t.subscribe([r],"__hook__")},[r]),{events:o,lastEvent:o[o.length-1]}}export{I as SparkleAppContext,Jt as SparkleProvider,Kt as useAuth,or as useDatabase,ur as useHook,Bt as useRealtime,Vt as useTwitch,sr as useUser};
|
|
8
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -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"],"names":["createContext","useEffect","useState","useCallback","useTwitch","user","setUser","loading","setLoading","clientId","tryAuthenticate","accessToken","res","authenticate","redirectUri","scope","error","logout","fetchVips","result","jsx","jsxs","LoginForm","UserInfo","Fragment","SparkleContext","SparkleProvider","children","socket","setSocket","ws","useContext","useMemo","useRealtime","keyInputs","context","keys","state","setState","acc","key","openOpen","openMessage","event","data","useData","set","value","get"],"mappings":"AAAA,OAAyB,iBAAAA,EAAe,aAAAC,EAAW,YAAAC,MAAgB,QCAnE,OAAS,YAAAA,EAAU,aAAAD,EAAW,eAAAE,MAAmB,QAe1C,SAASC,GAAY,CAC1B,GAAM,CAACC,EAAMC,CAAO,EAAIJ,EAA4B,IAAI,EAClD,CAACK,EAASC,CAAU,EAAIN,EAAS,EAAI,EAErCO,EAAW,iCAEXC,EAAkBP,EAAY,SAAY,CAC9C,IAAMQ,EACJ,IAAI,gBAAgB,OAAO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,YAAa,IAAAP,EAAK,MAAAO,CAAM,CAAC,EACxD,QAAS,CACP,eAAgB,kBAClB,CACF,CAAC,EAEH,UAAW,MAAOP,EAAaO,IACtB,MAAM,MAAM,gCAAiC,CAClD,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,OAAQ,YAAa,IAAAP,EAAK,MAAAO,CAAM,CAAC,EACxD,QAAS,CACP,eAAgB,kBAClB,CACF,CAAC,EAEH,IAAK,MAAOP,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","sourcesContent":["import { 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","interface 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 { 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"]}
|
|
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/useTwitch.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 { ApiClient } from \"@twurple/api\"\nimport { StaticAuthProvider } from \"@twurple/auth\"\nimport { useEffect, useState } from \"react\"\nimport useLocalStorage from \"../utils/hooks/useLocalStorage\"\n\nexport function useTwitch(asUser?: string | number) {\n const [apiClient, setApiClient] = useState<ApiClient | null>(null)\n const [twitch] = useLocalStorage<string>(\"twitch\")\n\n useEffect(() => {\n console.log(\"env\", process.env.TWITCH_CLIENT_ID)\n\n console.log(\"init\")\n\n const apiClient = new ApiClient({\n authProvider: new StaticAuthProvider(\n \"u9lt242tz2pn5hl5x444ls2xllnvip\",\n twitch!,\n [\n \"bits:read\",\n \"channel:manage:moderators\",\n \"channel:manage:polls\",\n \"channel:manage:predictions\",\n \"channel:manage:redemptions\",\n \"channel:manage:vips\",\n\n \"channel:read:polls\",\n \"channel:read:predictions\",\n \"channel:read:redemptions\",\n \"channel:read:subscriptions\",\n \"channel:read:vips\",\n \"moderation:read\",\n \"moderator:manage:announcements\",\n \"channel:moderate\",\n \"moderator:read:blocked_terms\",\n \"moderator:read:chatters\",\n \"moderator:read:followers\",\n \"user:read:email\",\n ]\n ),\n })\n\n setApiClient(apiClient)\n\n return () => {\n setApiClient(null)\n }\n }, [])\n\n return {\n apiClient,\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,E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ACA,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","ApiClient","StaticAuthProvider","useEffect","useState","useTwitch","asUser","apiClient","setApiClient","useState","twitch","useLocalStorage_default","useEffect","ApiClient","StaticAuthProvider","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,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sparkle-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
7
|
-
"
|
|
7
|
+
"main": "./dist/index.mjs",
|
|
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,13 @@
|
|
|
16
17
|
"typescript": "^5.3.3"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"
|
|
20
|
+
"@twurple/api": "^7.0.6",
|
|
21
|
+
"@twurple/auth": "^7.0.6",
|
|
22
|
+
"framer-motion": "^10.16.16",
|
|
23
|
+
"jsonwebtoken": "^9.0.2",
|
|
24
|
+
"lucide-react": "^0.294.0",
|
|
25
|
+
"react": "^18.2.0",
|
|
26
|
+
"zod": "^3.22.4"
|
|
20
27
|
},
|
|
21
28
|
"scripts": {
|
|
22
29
|
"dev": "tsup --watch",
|