repo
stringclasses
302 values
file_path
stringlengths
18
241
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
76
697k
tokens
int64
10
271k
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-character.ts
roblox-ts
.ts
import { useAsync, useEventListener } from "@rbxts/pretty-react-hooks"; import { useState } from "@rbxts/react"; import { Character, promiseCharacter } from "shared/utils/player-utils"; export function useCharacter(player: Player): Character | undefined { const [model, setModel] = useState(player.Character); const ...
129
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-continuous-angle.ts
roblox-ts
.ts
import { useMemo, useRef } from "@rbxts/react"; import { subtractRadians } from "shared/utils/math-utils"; /** * Returns a continuous angle that is always the shortest distance from the * previous angle. Used to prevent angles looping around when they reach * 360 degrees. */ export function useContinuousAngle(angl...
122
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-defined.ts
roblox-ts
.ts
import { useLatest } from "@rbxts/pretty-react-hooks"; /** * Returns true if the two values are equal and the new value is defined. * @param a The previous value. * @param b The new value. * @returns True if the two values are equal and the new value is defined. */ function isEqualOrUndefined(a: unknown, b: unkno...
179
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-orientation.ts
roblox-ts
.ts
import { useViewport } from "@rbxts/pretty-react-hooks"; import { useState } from "@rbxts/react"; export function useOrientation() { const [orientation, setOrientation] = useState<"landscape" | "portrait">("landscape"); useViewport((viewport) => { setOrientation(viewport.Y > viewport.X ? "portrait" : "landscape")...
81
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-premium.ts
roblox-ts
.ts
import { useEventListener } from "@rbxts/pretty-react-hooks"; import { useState } from "@rbxts/react"; import { Players } from "@rbxts/services"; export function usePremium() { const [isPremium, setIsPremium] = useState(Players.LocalPlayer.MembershipType === Enum.MembershipType.Premium); useEventListener(Players.Pl...
117
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-product-price.ts
roblox-ts
.ts
import { useAsync } from "@rbxts/pretty-react-hooks"; import { MarketplaceService } from "@rbxts/services"; export function useProductPrice(productId: number) { const [info = "N/A"] = useAsync(() => { return Promise.retryWithDelay( async () => { return MarketplaceService.GetProductInfo(productId, Enum.InfoTy...
102
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-rem.ts
roblox-ts
.ts
import { useCallback, useContext } from "@rbxts/react"; import { DEFAULT_REM, RemContext } from "../providers/rem-provider"; export interface RemOptions { minimum?: number; maximum?: number; } interface RemFunction { (value: number, mode?: RemScaleMode): number; (value: UDim2, mode?: RemScaleMode): UDim2; (valu...
433
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-seed.ts
roblox-ts
.ts
import { useMemo } from "@rbxts/react"; /** * Generates a random seed unique to this function component. */ export function useSeed() { return useMemo(() => { const random = new Random(); return random.NextNumber(-256, 256); }, []); }
57
littensy/slither
littensy-slither-56545f1/src/client/hooks/use-store.ts
roblox-ts
.ts
import { useProducer, UseProducerHook } from "@rbxts/react-reflex"; import { RootStore } from "client/store"; export const useStore: UseProducerHook<RootStore> = useProducer;
44
littensy/slither
littensy-slither-56545f1/src/client/providers/rem-provider.tsx
roblox-ts
.tsx
import { map, useCamera, useDebounceState, useEventListener } from "@rbxts/pretty-react-hooks"; import React, { createContext, useEffect } from "@rbxts/react"; export interface RemProviderProps extends React.PropsWithChildren { baseRem?: number; remOverride?: number; minimumRem?: number; maximumRem?: number; } ex...
412
littensy/slither
littensy-slither-56545f1/src/client/providers/root-provider.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { ReflexProvider } from "@rbxts/react-reflex"; import { store } from "client/store"; import { RemProvider, RemProviderProps } from "./rem-provider"; export function RootProvider({ baseRem, remOverride, children }: RemProviderProps) { return ( <ReflexProvider producer={store...
114
littensy/slither
littensy-slither-56545f1/src/client/reset/index.client.ts
roblox-ts
.ts
import { StarterGui } from "@rbxts/services"; import { remotes } from "shared/remotes"; async function setCore() { const resetBindable = new Instance("BindableEvent"); resetBindable.Event.Connect(() => { remotes.snake.kill.fire(); }); StarterGui.SetCore("ResetButtonCallback", resetBindable); } Promise.retryWi...
85
littensy/slither
littensy-slither-56545f1/src/client/store/alert/alert-selectors.ts
roblox-ts
.ts
import { createSelector } from "@rbxts/reflex"; import { RootState } from ".."; export const selectAlerts = (state: RootState) => { return state.alert.alerts; }; export const selectAlertsVisible = createSelector(selectAlerts, (alerts) => { return alerts.filter((alert) => alert.visible); }); export const selectAle...
108
littensy/slither
littensy-slither-56545f1/src/client/store/alert/alert-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; export interface AlertState { readonly alerts: readonly Alert[]; } export interface Alert { readonly id: number; readonly scope?: AlertScope; readonly emoji: string; readonly message: string; readonly color: Color3; readonly colorSecondary?: Color3; readonly col...
253
littensy/slither
littensy-slither-56545f1/src/client/store/index.ts
roblox-ts
.ts
import { combineProducers, InferState } from "@rbxts/reflex"; import { slices } from "shared/store"; import { profilerMiddleware } from "shared/store/middleware/profiler"; import { alertSlice } from "./alert"; import { menuSlice } from "./menu"; import { receiverMiddleware } from "./middleware/receiver"; import { worl...
154
littensy/slither
littensy-slither-56545f1/src/client/store/menu/menu-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { RANDOM_SKIN } from "shared/store/saves"; import { getMenuDirection } from "./menu-utils"; export interface MenuState { readonly page: MenuPage; readonly open: boolean; readonly music: boolean; readonly transition: { readonly direction: "left" | "right"; ...
324
littensy/slither
littensy-slither-56545f1/src/client/store/middleware/receiver.ts
roblox-ts
.ts
import { createBroadcastReceiver, ProducerMiddleware } from "@rbxts/reflex"; import { IS_EDIT } from "shared/constants/core"; import { remotes } from "shared/remotes"; import { deserializeState } from "shared/serdes"; export function receiverMiddleware(): ProducerMiddleware { if (IS_EDIT) { return () => (dispatch) ...
153
littensy/slither
littensy-slither-56545f1/src/client/store/world/world-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; export interface WorldState { readonly subject: string; readonly spectating: string; readonly inputAngle: number; } const initialState: WorldState = { subject: "", spectating: "", inputAngle: 0, }; export const worldSlice = createProducer(initialState, { setWorl...
154
littensy/slither
littensy-slither-56545f1/src/client/stories/components/alerts.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { sendAlert } from "client/alerts"; import { Alerts } from "client/components/alerts"; import { Menu } from "client/components/menu"; import { InputCapture } from "client/components/ui/inpu...
435
littensy/slither
littensy-slither-56545f1/src/client/stories/components/controller.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat, useInterval } from "@rbxts/pretty-react-hooks"; import React, { useEffect } from "@rbxts/react"; import { useSelector } from "@rbxts/react-reflex"; import { Players } from "@rbxts/services"; import { Controller } from "client/components/controller"; import { Frame ...
938
littensy/slither
littensy-slither-56545f1/src/client/stories/components/error.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat } from "@rbxts/pretty-react-hooks"; import React, { useEffect } from "@rbxts/react"; import { ErrorHandler } from "client/components/error-handler"; import { RootProvider } from "client/providers/root-provider"; function BadComponent() { useEffect(() => { throw ...
120
littensy/slither
littensy-slither-56545f1/src/client/stories/components/game.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat, useInterval } from "@rbxts/pretty-react-hooks"; import React, { useEffect } from "@rbxts/react"; import { Controller } from "client/components/controller"; import { Game } from "client/components/game"; import { World } from "client/components/world"; import { Root...
553
littensy/slither
littensy-slither-56545f1/src/client/stories/components/menu.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { Menu } from "client/components/menu"; import { InputCapture } from "client/components/ui/input-capture"; import { World } from "client/components/world"; import { RootProvider } from "cli...
258
littensy/slither
littensy-slither-56545f1/src/client/stories/components/skins.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat, useMountEffect } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { Alerts } from "client/components/alerts"; import { Menu } from "client/components/menu"; import { World } from "client/components/world"; import { RootProvider } from "cli...
204
littensy/slither
littensy-slither-56545f1/src/client/stories/components/stats.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat, useMountEffect } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { Menu } from "client/components/menu"; import { Stats } from "client/components/stats"; import { Backdrop } from "client/components/world/backdrop"; import { RootProvider }...
190
littensy/slither
littensy-slither-56545f1/src/client/stories/components/support.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat, useMountEffect } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { Menu } from "client/components/menu"; import { World } from "client/components/world"; import { RootProvider } from "client/providers/root-provider"; import { store } from...
201
littensy/slither
littensy-slither-56545f1/src/client/stories/components/world.story.tsx
roblox-ts
.tsx
import "client/app/react-config"; import { hoarcekat, useInterval } from "@rbxts/pretty-react-hooks"; import React, { useEffect } from "@rbxts/react"; import { Controller } from "client/components/controller"; import { World } from "client/components/world/world"; import { RootProvider } from "client/providers/root-pr...
477
littensy/slither
littensy-slither-56545f1/src/client/stories/utils/use-mock-remotes.ts
roblox-ts
.ts
import { useEffect } from "@rbxts/react"; import { store } from "client/store"; import { USER_NAME } from "shared/constants/core"; import { getSnakeSkin } from "shared/constants/skins"; import { remotes } from "shared/remotes"; import { selectPlayerBalance } from "shared/store/saves"; export function useMockRemotes() ...
303
littensy/slither
littensy-slither-56545f1/src/server/bots/bot-behavior.ts
roblox-ts
.ts
import Object from "@rbxts/object-utils"; import { setInterval } from "@rbxts/set-timeout"; import { store } from "server/store"; import { candyGrid, snakeGrid } from "server/world"; import { getCandy, getSnake } from "server/world/utils"; import { WORLD_BOUNDS } from "shared/constants/core"; import { CandyType } from ...
966
littensy/slither
littensy-slither-56545f1/src/server/commands/create-command.ts
roblox-ts
.ts
import { Players, RunService } from "@rbxts/services"; import { getTextChatCommands } from "./utils"; const ADMINS = new ReadonlySet([ 48203430, // @LITTENSY 96035249, // @NeoInversion ]); export async function createCommand(alias: string, handler: (player: Player, argument: string) => void) { const container = a...
189
littensy/slither
littensy-slither-56545f1/src/server/commands/utils.ts
roblox-ts
.ts
import { TextChatService } from "@rbxts/services"; import { promiseTree } from "@rbxts/validate-tree"; interface EnhancedTextChatService extends TextChatService { TextChannels: Folder & { RBXGeneral: TextChannel; RBXSystem: TextChannel; }; TextChatCommands: Folder; } const textChatServiceSchema = { $className...
207
littensy/slither
littensy-slither-56545f1/src/server/players/services/save.ts
roblox-ts
.ts
import { createCollection } from "@rbxts/lapis"; import { Players } from "@rbxts/services"; import { store } from "server/store"; import { sounds } from "shared/assets"; import { palette } from "shared/constants/palette"; import { remotes } from "shared/remotes"; import { defaultPlayerSave, playerSaveSchema, selectPlay...
397
littensy/slither
littensy-slither-56545f1/src/server/products/services/process-receipt.ts
roblox-ts
.ts
import { MarketplaceService, Players } from "@rbxts/services"; type ProductHandler = (player: Player) => void; const productHandlers = new Map<number, ProductHandler>(); export async function initProcessReceiptService() { MarketplaceService.ProcessReceipt = (receipt) => { const player = Players.GetPlayerByUserId(...
179
littensy/slither
littensy-slither-56545f1/src/server/rewards/services/badges.ts
roblox-ts
.ts
import { BadgeService } from "@rbxts/services"; import { store } from "server/store"; import { identifyMilestone, ScoreMilestone, selectMilestoneRanking, selectMilestones, selectMilestoneScore, } from "server/store/milestones"; import { Badge } from "shared/assets"; import { getPlayerByName } from "shared/utils/pl...
439
littensy/slither
littensy-slither-56545f1/src/server/rewards/services/rewards.ts
roblox-ts
.ts
import { setInterval } from "@rbxts/set-timeout"; import { store } from "server/store"; import { identifyMilestone, ScoreMilestone, selectMilestoneLastKilled, selectMilestoneRanking, selectMilestones, selectMilestoneScore, } from "server/store/milestones"; import { getSnake } from "server/world"; import { sounds ...
1,039
littensy/slither
littensy-slither-56545f1/src/server/store/index.ts
roblox-ts
.ts
import { combineProducers, InferState } from "@rbxts/reflex"; import { slices } from "shared/store"; import { profilerMiddleware } from "shared/store/middleware/profiler"; import { broadcasterMiddleware } from "./middleware/broadcaster"; import { milestoneSlice } from "./milestones"; export type RootState = InferStat...
119
littensy/slither
littensy-slither-56545f1/src/server/store/middleware/broadcaster.ts
roblox-ts
.ts
import { createBroadcaster, ProducerMiddleware } from "@rbxts/reflex"; import { Players } from "@rbxts/services"; import { IS_EDIT, WORLD_TICK } from "shared/constants/core"; import { remotes } from "shared/remotes"; import { serializeState, SharedStateSerialized } from "shared/serdes"; import { SharedState, slices } f...
350
littensy/slither
littensy-slither-56545f1/src/server/store/milestones/milestone-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { mapProperty } from "shared/utils/object-utils"; export type MilestoneState = { readonly [K in string]?: MilestoneEntity; }; export interface MilestoneEntity { readonly topScore?: ScoreMilestone; readonly topRank: number; readonly lastKilled?: string; } exp...
571
littensy/slither
littensy-slither-56545f1/src/server/world/services/candy/candy-helpers.ts
roblox-ts
.ts
import { setInterval, setTimeout } from "@rbxts/set-timeout"; import { store } from "server/store"; import { CANDY_LIMITS } from "server/world/constants"; import { getCandy, getRandomPointNearWorldOrigin, getSnake } from "server/world/utils"; import { getRandomAccent } from "shared/constants/palette"; import { getSnake...
1,198
littensy/slither
littensy-slither-56545f1/src/server/world/services/snakes/snakes.ts
roblox-ts
.ts
import { Players } from "@rbxts/services"; import { store } from "server/store"; import { SNAKE_TICK_PHASE } from "server/world/constants"; import { getSafePointInWorld, killSnake, playerIsSpawned } from "server/world/utils"; import { WORLD_TICK } from "shared/constants/core"; import { remotes } from "shared/remotes"; ...
413
littensy/slither
littensy-slither-56545f1/src/server/world/utils.ts
roblox-ts
.ts
import { setTimeout } from "@rbxts/set-timeout"; import { store } from "server/store"; import { WORLD_BOUNDS } from "shared/constants/core"; import { selectCandyById } from "shared/store/candy"; import { selectSnakeById } from "shared/store/snakes"; import { snakeGrid } from "./services/snakes/snake-grid"; const MIN_...
656
littensy/slither
littensy-slither-56545f1/src/shared/assets/images/init.lua
luau
.lua
-- This file was @generated by Tarmac. It is not intended for manual editing. return { images = { skins = { snake_awesome_body = "rbxassetid://14884183308", snake_awesome_head = "rbxassetid://14884183395", snake_black_ice = "rbxassetid://14836390041", snake_canada = "rbxassetid://14884212831", snake_e...
696
littensy/slither
littensy-slither-56545f1/src/shared/assets/sounds/play-button-sound.ts
roblox-ts
.ts
import { throttle } from "@rbxts/set-timeout"; import { playSound } from "./play-sound"; import { sounds } from "./sounds"; export type ButtonSoundVariant = "default" | "alt" | "none"; const BUTTON_DELAY = 0.1; let lastPressed: number | undefined; export const playButtonDown = throttle((variant: ButtonSoundVariant...
263
littensy/slither
littensy-slither-56545f1/src/shared/assets/sounds/play-sound.ts
roblox-ts
.ts
import { SoundService } from "@rbxts/services"; import { IS_EDIT } from "shared/constants/core"; export interface SoundOptions { volume?: number; speed?: number; looped?: boolean; parent?: Instance; } export function createSound( soundId: string, { volume = 0.5, speed = 1, looped = false, parent = SoundService ...
182
littensy/slither
littensy-slither-56545f1/src/shared/constants/core.ts
roblox-ts
.ts
import { Players, RunService } from "@rbxts/services"; // Premium benefit applied when earning money passively // during a game or when purchasing a product from the shop. export const PREMIUM_BENEFIT = 1.2; export const WORLD_BOUNDS = 128; export const WORLD_TICK = 1 / 20; export const SNAKE_SPEED = 6; export const...
186
littensy/slither
littensy-slither-56545f1/src/shared/serdes/handlers/serdes-candy.ts
roblox-ts
.ts
import BitBuffer from "@rbxts/bitbuffer2"; import { CandyState } from "shared/store/candy"; import { countProperties } from "shared/utils/object-utils"; import { readColor3, readVector2, writeColor3, writeVector2 } from "../utils"; export function serializeCandy(state: CandyState): string { const buffer = new BitBuf...
259
littensy/slither
littensy-slither-56545f1/src/shared/serdes/handlers/serdes-snake.ts
roblox-ts
.ts
import BitBuffer from "@rbxts/bitbuffer2"; import { SnakesState } from "shared/store/snakes"; import { countProperties } from "shared/utils/object-utils"; import { readArray, readVector2, writeArray, writeVector2 } from "../utils"; export function serializeSnakes(state: SnakesState): string { const buffer = new BitB...
370
littensy/slither
littensy-slither-56545f1/src/shared/serdes/utils.ts
roblox-ts
.ts
import BitBuffer from "@rbxts/bitbuffer2"; export function writeVector2(buffer: BitBuffer, vector: Vector2) { buffer.WriteFloat32(vector.X); buffer.WriteFloat32(vector.Y); } export function readVector2(buffer: BitBuffer) { const x = buffer.ReadFloat32(); const y = buffer.ReadFloat32(); return new Vector2(x, y); ...
289
littensy/slither
littensy-slither-56545f1/src/shared/store/candy/candy-selectors.ts
roblox-ts
.ts
import Object from "@rbxts/object-utils"; import { createSelector } from "@rbxts/reflex"; import { mapProperties } from "shared/utils/object-utils"; import { SharedState } from ".."; import { CandyEntity, CandyType } from "./candy-slice"; export const identifyCandy = (candy: CandyEntity) => { return candy.id; }; ex...
359
littensy/slither
littensy-slither-56545f1/src/shared/store/candy/candy-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { assign, mapProperties, mapProperty } from "shared/utils/object-utils"; export interface CandyState { readonly [id: string]: CandyEntity | undefined; } export interface CandyEntity { readonly id: string; readonly size: number; readonly position: Vector2; re...
561
littensy/slither
littensy-slither-56545f1/src/shared/store/index.ts
roblox-ts
.ts
import { CombineStates } from "@rbxts/reflex"; import { candySlice } from "./candy"; import { saveSlice } from "./saves"; import { snakesSlice } from "./snakes"; export type SharedState = CombineStates<typeof slices>; export const slices = { candy: candySlice, snakes: snakesSlice, saves: saveSlice, };
77
littensy/slither
littensy-slither-56545f1/src/shared/store/middleware/profiler.ts
roblox-ts
.ts
import { ProducerMiddleware } from "@rbxts/reflex"; import { IS_PROD } from "shared/constants/core"; export const profilerMiddleware: ProducerMiddleware = () => { return (dispatch, name) => { if (IS_PROD) { return dispatch; } return (...args) => { debug.profilebegin(name); const result = dispatch(...a...
93
littensy/slither
littensy-slither-56545f1/src/shared/store/saves/save-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { mapProperty } from "shared/utils/object-utils"; import { PlayerSave } from "./save-types"; export interface SaveState { readonly [id: string]: PlayerSave | undefined; } const initialState: SaveState = {}; export const saveSlice = createProducer(initialState,...
330
littensy/slither
littensy-slither-56545f1/src/shared/store/saves/save-types.ts
roblox-ts
.ts
import { t } from "@rbxts/t"; import { baseSnakeSkins } from "shared/constants/skins"; export interface PlayerSave { readonly balance: number; readonly skins: readonly string[]; readonly skin: string; } export const RANDOM_SKIN = "__random__"; export const defaultPlayerSave: PlayerSave = { balance: 100, skins: ...
141
littensy/slither
littensy-slither-56545f1/src/shared/store/snakes/snake-selectors.ts
roblox-ts
.ts
import Object from "@rbxts/object-utils"; import { createSelector, shallowEqual } from "@rbxts/reflex"; import { USER_NAME } from "shared/constants/core"; import { SharedState } from "shared/store"; import { mapProperties } from "shared/utils/object-utils"; import { getPlayerByName } from "shared/utils/player-utils"; ...
1,257
littensy/slither
littensy-slither-56545f1/src/shared/store/snakes/snake-slice.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { SNAKE_BOOST_SPEED, SNAKE_SPEED, WORLD_TICK } from "shared/constants/core"; import { map, turnRadians } from "shared/utils/math-utils"; import { mapProperties, mapProperty } from "shared/utils/object-utils"; import { describeSnakeFromScore, snakeIsBoosting } from...
1,153
littensy/slither
littensy-slither-56545f1/src/shared/utils/player-utils.ts
roblox-ts
.ts
import { Players } from "@rbxts/services"; import { promiseTree } from "@rbxts/validate-tree"; const characterSchema = { $className: "Model", HumanoidRootPart: "BasePart", Humanoid: { $className: "Humanoid", Animator: "Animator", }, } as const; export interface Character extends Model { HumanoidRootPart: Bas...
272
littensy/slither
littensy-slither-56545f1/src/shared/utils/scheduler.ts
roblox-ts
.ts
import { RunService } from "@rbxts/services"; interface SchedulerOptions { readonly name: string; readonly tick: number; readonly phase?: number; readonly onTick?: (deltaTime: number) => void; readonly onRender?: (deltaTime: number, alpha: number) => void; } const connected = new Set<RBXScriptConnection>(); exp...
237
Neohertz/comet
Neohertz-comet-bd2e945/src/modules/button.ts
roblox-ts
.ts
import Signal from "@rbxts/lemon-signal"; import { CometError } from "../core/enum"; import { CometState } from "./../types/comet.d"; /** * Toolbar button instance with many great features. */ export class Button { private button: PluginToolbarButton; private buttonState: boolean; private clickEvent: Signal; c...
451
Neohertz/comet
Neohertz-comet-bd2e945/src/modules/view.ts
roblox-ts
.ts
import { CometState } from "../types/comet"; import { CometError } from "../core/enum"; import Signal from "@rbxts/lemon-signal"; import { Button } from "./button"; import { Logger } from "../util/logger"; const HttpService = game.GetService("HttpService"); /** * A view is a container for GUI elements. */ export cl...
1,106
Neohertz/comet
Neohertz-comet-bd2e945/src/systems/history.ts
roblox-ts
.ts
import { InternalSystem } from "../core"; import { CometState } from "../types/comet"; import { Logger } from "../util/logger"; const ChangeHistoryService = game.GetService("ChangeHistoryService"); interface RecordConfig { name: string; description?: string; onSuccess?: "commit" | "append" | "cancel"; } /** * A ...
980
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/assets/assets.luau
luau
.luau
local assets = { add = "rbxasset://.asphalt-plugin/add.png", caretDown = "rbxasset://.asphalt-plugin/caretDown.png", checkmark = "rbxasset://.asphalt-plugin/checkmark.png", extension = "rbxasset://.asphalt-plugin/extension.png", icons = { toolbarIcon = "rbxasset://.asphalt-plugin/icons/toolbarIcon.png", }, sea...
111
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/atoms/editorComponents.ts
roblox-ts
.ts
import { atom } from "@rbxts/charm"; export const enum ComponentRealm { Client = 1, Server = 2, } export const enum EditorComponentFieldType { String = 1, Number = 2, Boolean = 3, Vector3 = 4, Vector2 = 5, } export interface EditorComponent { instance: ModuleScript; name: string; realm: ComponentRealm; id: ...
169
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/atoms/theme.ts
roblox-ts
.ts
import { Atom, atom } from "@rbxts/charm"; export const ThemeColors = { "MainBackground" : Enum.StudioStyleGuideColor.MainBackground, "MainText" : Enum.StudioStyleGuideColor.MainText, "ScrollBar" : Enum.StudioStyleGuideColor.ScrollBar, "ScrollBarBackground" : Enum.StudioStyleGuideColor.ScrollBarBackgr...
195
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/logic/useComponent.ts
roblox-ts
.ts
import { useEventListener } from "@rbxts/pretty-react-hooks"; import React, { useCallback, useEffect, useState } from "@rbxts/react"; import { act } from "@rbxts/react-roblox"; import { COMPONENT_ACTIVE } from "constants"; interface ComponentState { active: boolean; } export default function useComponent(id: string,...
218
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/logic/useComponentFields.ts
roblox-ts
.ts
import { useCallback, useEffect, useState } from "@rbxts/react"; import { EditorComponentField } from "atoms/editorComponents"; import useEditorComponets from "./useEditorComponents"; import { COMPONENT_FIELD } from "constants"; import { useEventListener } from "@rbxts/pretty-react-hooks"; import { String } from "@rbxt...
451
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/logic/useEditorComponents.ts
roblox-ts
.ts
import { useAtom } from "@rbxts/react-charm"; import { EditorComponentsAtom } from "atoms/editorComponents"; export default function useEditorComponets() { return useAtom(EditorComponentsAtom); }
44
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/logic/useInstanceComponents.ts
roblox-ts
.ts
import { String } from "@rbxts/jsnatives"; import { useCallback, useEffect, useState } from "@rbxts/react"; import { CollectionService } from "@rbxts/services"; import { Trash } from "@rbxts/trash"; import { EditorComponent, EditorComponentsAtom } from "atoms/editorComponents"; import { COMPONENT_ADDED_FLAG, COMPONENT_...
512
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/logic/useSelection.ts
roblox-ts
.ts
import { useAtom } from "@rbxts/react-charm"; import { SelectionAtom } from "atoms/selection"; export default function useSelection() { return useAtom(SelectionAtom) }
41
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/visuals/useInstanceIcon.tsx
roblox-ts
.tsx
import { useMemo } from "@rbxts/react"; const StudioService = game.GetService("StudioService"); export default function useInstanceIcon(instance: Instance | undefined) { return useMemo(() => { if (!instance) return ""; const icon = (StudioService.GetClassIcon(instance.ClassName) as { Image: string }).Image; re...
78
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/hooks/visuals/useTheme.tsx
roblox-ts
.tsx
import { useAtom } from "@rbxts/react-charm"; import { ThemeAtom } from "atoms/theme"; export default function useTheme() { return useAtom(ThemeAtom) }
40
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/index.server.ts
roblox-ts
.ts
import { Comet, LogLevel } from "@rbxts/comet"; Comet.createApp("Compo", true); Comet.addPaths(script.WaitForChild("systems")); Comet.configureLogger(LogLevel.VERBOSE) Comet.launch();
46
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/systems/editorComponentCollector.ts
roblox-ts
.ts
import Attributes from "@rbxts/attributes"; import { Dependency, OnStart, System, Track } from "@rbxts/comet"; import { String } from "@rbxts/jsnatives"; import { ServerScriptService, StarterPlayer, Workspace } from "@rbxts/services"; import { Trash } from "@rbxts/trash"; import { ComponentRealm, EditorComponentsAtom }...
922
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/systems/editorComponentField.ts
roblox-ts
.ts
import { COMPONENT_ID } from "constants"; import { Dependency, OnEnd, OnStart, Studio, System } from "@rbxts/comet"; import { ComponentBuilder, EditorComponent, EditorComponentField, EditorComponentsAtom } from "atoms/editorComponents"; import { sandboxload } from "utility/sandboxLoad"; import { effect } from "@rbxts/c...
585
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/systems/inspector.ts
roblox-ts
.ts
import { Dependency, GUI, OnStart, System, View } from "@rbxts/comet"; import { MainSystem } from "./main"; import { MountInspector } from "ui/inspector/mount"; @System() export class InspectorSystem implements OnStart { private mainSystem = Dependency(MainSystem); private gui = Dependency(GUI); public View: View; ...
149
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/systems/main.ts
roblox-ts
.ts
import { History, GUI, Button, Dependency, System, Studio } from "@rbxts/comet"; import assets from "assets/assets"; @System() export class MainSystem { private gui = Dependency(GUI); public button: Button; constructor() { this.button = this.gui.createButton( "Inspector", "Open the inspector window", as...
92
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/systems/selectionSystem.ts
roblox-ts
.ts
import { Dependency, OnInit, Studio, System } from "@rbxts/comet"; import { SelectionAtom } from "atoms/selection"; @System() export class SelectionSystem implements OnInit{ private studio = Dependency(Studio) onInit(): void { SelectionAtom(this.studio.getSelection()[0]) this.studio.onSelection...
89
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/systems/studioTheme/index.ts
roblox-ts
.ts
import { Logger, OnInit, System } from "@rbxts/comet"; import { StudioTheme, ThemeAtom, ThemeColors } from "atoms/theme"; @System() export class StudioThemeSystem implements OnInit { onInit () { this.onThemeChanged() settings().Studio.ThemeChanged.Connect(() => this.onThemeChanged()) } p...
178
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/components/automaticScrollingFrame.tsx
roblox-ts
.tsx
import { useEventListener } from "@rbxts/pretty-react-hooks"; import React, { ReactNode, useRef, useState } from "@rbxts/react"; interface Props { children?: ReactNode; Size?: UDim2; Position?: UDim2; AnchorPoint?: Vector2; BackgroundColor3?: Color3; BackgroundTransparency?: number; BorderSizePixel?: number; L...
241
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/components/checkbox.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { checkmark } from "assets/assets"; import useTheme from "hooks/visuals/useTheme"; interface Props { checked: boolean; onClick?: () => void; } export default function CheckBox({ checked, onClick }: Props) { const theme = useTheme(); return ( <imagebutton Size={UDim2.f...
232
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/components/padding.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; interface PaddingProps { Padding? : UDim, Top? : UDim, Right? : UDim, Bottom? : UDim, Left? : UDim } export default function Padding({ Padding, Top, Right, Bottom, Left } : PaddingProps) { return ( <uipadding PaddingBottom={Padding ...
114
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/components/separator.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; export default function Separator() { const theme = useTheme(); return ( <frame Size={new UDim2(1, 0, 0, 1)} BackgroundColor3={theme.Dark.Default} BackgroundTransparency={0.25}> <uicorner CornerRadius={new UDim(1, 0)} /> </frame>...
100
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/app.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { InspectorView } from "ui/inspector/components/inspectorView"; export default function App() { return <InspectorView />; }
38
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/addComponent.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import assets from "assets/assets"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function AddComponentButton({ OnClick }: { OnClick?: () => void }) { const theme = useTheme(); return ( <frame BackgroundTransparency={1} ...
302
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/common/inspectorSection.tsx
roblox-ts
.tsx
import React, { ReactNode } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function InspectorSection({ children, color }: { children: ReactNode; color?: Color3 }) { const theme = useTheme(); return ( <frame AutomaticSize={"Y"} Size={n...
173
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/common/inspectorSectionButton.tsx
roblox-ts
.tsx
import React, { ReactNode, useEffect, useState } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function InspectorSectionButton({ Selected, OnClick, children, }: { children: ReactNode; OnClick?: () => void; Selected?: boolean; }) { ...
326
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/inspectorComponentsList.tsx
roblox-ts
.tsx
import { Object, String } from "@rbxts/jsnatives"; import React, { Fragment, useMemo, useState } from "@rbxts/react"; import useEditorComponets from "hooks/logic/useEditorComponents"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; import assets from "assets/assets"; import {...
1,116
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/inspectorContainer.tsx
roblox-ts
.tsx
import React, { ReactNode } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function InspectorContainer({ children }: { children: ReactNode }) { const theme = useTheme(); return ( <scrollingframe Size={UDim2.fromScale(1, 1)} Borde...
174
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/inspectorInstance.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import useSelection from "hooks/logic/useSelection"; import InspectorSection from "./common/inspectorSection"; import useTheme from "hooks/visuals/useTheme"; import useInstanceIcon from "hooks/visuals/useInstanceIcon"; export default function InspectorInstance() { const selection = us...
203
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/inspectorView.tsx
roblox-ts
.tsx
import React, { Fragment, useEffect, useState } from "@rbxts/react"; import InspectorContainer from "./inspectorContainer"; import useSelection from "hooks/logic/useSelection"; import Padding from "ui/components/padding"; import useTheme from "hooks/visuals/useTheme"; import InspectorInstance from "./inspectorInstance"...
339
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/instanceComponents.tsx
roblox-ts
.tsx
import React, { Fragment } from "@rbxts/react"; import useInstanceComponents from "hooks/logic/useInstanceComponents"; import InspectorSection from "./common/inspectorSection"; import Padding from "ui/components/padding"; import useTheme from "hooks/visuals/useTheme"; import { ComponentRealm } from "atoms/editorCompone...
228
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/serializedComponent.tsx
roblox-ts
.tsx
import React, { useState } from "@rbxts/react"; import InspectorSection from "./common/inspectorSection"; import useComponent from "hooks/logic/useComponent"; import Padding from "ui/components/padding"; import assets from "assets/assets"; import useTheme from "hooks/visuals/useTheme"; import { EditorComponent } from "...
666
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/components/serializedFields.tsx
roblox-ts
.tsx
import { Object, String } from "@rbxts/jsnatives"; import React, { Fragment, useEffect } from "@rbxts/react"; import { EditorComponent, EditorComponentFieldType } from "atoms/editorComponents"; import useTheme from "hooks/visuals/useTheme"; import useComponentFields from "hooks/logic/useComponentFields"; import RenderF...
401
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/fields/booleanField.tsx
roblox-ts
.tsx
import React, { Fragment, useEffect } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import CheckBox from "ui/components/checkbox"; import Padding from "ui/components/padding"; export default function BooleanInspectorField({ value, onChange, }: { value: boolean; onChange: (value: boolean) => v...
91
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/fields/numberField.tsx
roblox-ts
.tsx
import React, { Fragment } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function NumberInspectorField({ value, onChange, }: { value: number; onChange: (value: number) => void; }) { const theme = useTheme(); return ( <textbox ...
250
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/fields/renderField.tsx
roblox-ts
.tsx
import React, { Fragment, useEffect } from "@rbxts/react"; import { EditorComponentField, EditorComponentFieldType } from "atoms/editorComponents"; import StringInspectorField from "./stringField"; import NumberInspectorField from "./numberField"; import BooleanInspectorField from "./booleanField"; import Vector3Inspec...
366
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/fields/stringField.tsx
roblox-ts
.tsx
import React, { Fragment } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function StringInspectorField({ value, onChange, }: { value: string; onChange: (value: string) => void; }) { const theme = useTheme(); return ( <textbox ...
214
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/fields/vector2Field.tsx
roblox-ts
.tsx
import React, { Fragment } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function Vector2InspectorField({ value, onChange, }: { value: Vector2; onChange: (value: Vector2) => void; }) { const theme = useTheme(); return ( <frame Au...
542
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/fields/vector3Field.tsx
roblox-ts
.tsx
import React, { Fragment } from "@rbxts/react"; import useTheme from "hooks/visuals/useTheme"; import Padding from "ui/components/padding"; export default function Vector3InspectorField({ value, onChange, }: { value: Vector3; onChange: (value: Vector3) => void; }) { const theme = useTheme(); return ( <frame Au...
753
sparkiyy/Compo
sparkiyy-Compo-b2cc911/plugin/src/ui/inspector/mount.tsx
roblox-ts
.tsx
import { createPortal, createRoot } from "@rbxts/react-roblox"; import App from "./app"; import React, { StrictMode } from "@rbxts/react"; export function MountInspector(parent: Instance) { const mountRoot = createRoot(parent) mountRoot.render(<StrictMode>{createPortal(<App />, parent)}</StrictMode>) retur...
85