text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>
export default LiveEditor;
<|fim_prefix|>import React from "react";
import { useSessionStorage } from "@mantine/hooks";
import styled from "styled-components";
import { ViewMode } from "../../enums/viewMode.enum";
import { GraphView } from "./views/GraphView";
import { TreeView } from "./vie<|fim_middle... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>ment")?.run();
});
}, []);
return (
<StyledEditorWrapper>
<StyledWrapper>
<Editor
height="100%"
language={fileType}
theme={theme}
value={contents}
options={editorOptions}
onMount={handleMount}
onValidate={erro... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>k={handleSave}>Export</Menu.Item>
</Menu.Dropdown>
</Menu>
);
};
<|fim_prefix|>import React from "react";
import { Flex, Menu } from "@mantine/core";
import { event as gaEvent } from "nextjs-google-analytics";
import { CgChevronDown } from "react-icons/cg";
import useFile from "../../../store/... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import { ActionIcon, TextInput, Tooltip } from "@mantine/core";
import { getHotkeyHandler } from "@mantine/hooks";
import styled from "styled-components";
import { AiOutlineSearch } from "react-icons/ai";
import { LuChevronDown, LuChevronUp, LuX } from "react-icons/lu";
import { useFocusNode ... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>Sun size="18" />}
</StyledToolElement>
);
};
<|fim_prefix|>import { FaMoon, FaSun } from "react-icons/fa6";
import useConfig from "../../../store/useConfig";
import { StyledToolElement } from "./styles";
export const ThemeToggle = () => {
const darkmodeEnabled = useConfig(state => state.darkmodeE... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { Menu, Flex } from "@mantine/core";
import { event as gaEvent } from "nextjs-google-analytics";
import { CgChevronDown } from "react-icons/cg";
import { MdFilterListAlt } from "react-icons/md";
import { VscSearchFuzzy, VscJson, Vs<|fim_suffix|>e Type
</Menu.Item>... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> <Flex align="center" gap={3}>
View <CgChevronDown />
</Flex>
</StyledToolElement>
</Menu.Target>
<Menu.Dropdown>
<SegmentedControl
size="md"
w="100%"
value={viewMode}
onChange={e => {
setViewMode(e ... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import Link from "next/link";
import { Flex, Group } from "@mantine/core";
import styled from "styled-components";
import toast from "react-hot-toast";
import { AiOutlineFullscreen } from "react-icons/ai";
import { FaChrome } from "react-icons/fa";
import { FaGithub } from "react-icons/fa6";
import { TbEx... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>ing: 6px;
border-radius: 3px;
white-space: nowrap;
&:hover {
background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0);
}
&:hover {
color: ${({ theme }) => theme.INTERACTIVE_HOVER};
opacity: 1;
box-shadow: none;
}
`;
<|fim_prefix|>import styled from "styled-components";
expo... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>Click={handeClick}
onEnter={() => setHovered(true)}
onLeave={() => setHovered(false)}
style={{
stroke: colorScheme === "dark" ? "#3a3a3d" : "#c9cdd3",
...(hovered && { stroke: colorScheme === "dark" ? "#60a5fa" : "#3b82f6" }),
strokeWidth: hovered ? 2 : 1.25,
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>"}
handles large datasets with ease.
</Text>
<List
spacing="xs"
size="sm"
w="100%"
c={darkmodeEnabled ? "gray.4" : "dark.6"}
icon={
<ThemeIcon color="teal" size={20} radius="xl" variant="light">
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { ThemeIcon, Tooltip } from "@mantine/core";
import { LuShieldCheck } from "react-icons/lu";
export const SecureInf<|fim_suffix|>ute",
bottom: "14px",
right: "14px",
zIndex: 3,
backdropFilter: "blur(12px)",
boxShadow: "0 ... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> => {
if (collapsedCount > 0) {
expandAll();
gaEvent("expand_all");
} else {
collapseAll();
gaEvent("collapse_all");
}
}}
>
{collapsedCount > 0 ? ... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>EditorWrapper
$widget={isWidget}
onContextMenu={event => event.preventDefault()}
onClick={blurOnClick}
>
<JSONCrack
ref={jsonCrackRef}
key={[direction, gesturesEnabled, rulersEnabled].join("-")}
json={json}
theme={darkmodeEnable... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import type { RefObject } from "react";
import type { LayoutDirection, NodeData, JSONCrackRef } from "jsoncrack-react";
import type { ViewPort } fro<|fim_suffix|>ef?.current?.collapseAll();
},
setCollapsedCount: count => {
if (get().collapsedCount === count) return;
set({ collapsedCount: count... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import type { DefaultTheme } from "styled-components";
import { styled } from "styled-components";
import type { KeyPath } from "react-json-tree";
interface LabelProps {
keyPath: KeyPath;
nodeType: string;
}
function getLabelColor({ $type, theme }: { $type?: string; theme:... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>kify(children);
if (typeof children === "string" && isColorFormat(children)) {
return (
<StyledRow>
<ColorSwatch size={12} radius={4} mr={4} color={children} />
{children}
</StyledRow>
);
}
return <>{`${children}`}</>;
};
function isColorFormat(colorString: str... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>
style={{
color: getValueColor({
theme,
$value: valueAsString,
}),
}}
>
<TextRenderer>{JSON.stringify(value)}</TextRenderer>
</span>
);
};
<|fim_prefix|>import React from "react";
import type { DefaultTheme } from "styled-components";
import ... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { useTheme } from "styled-components";
import { JSONTree } from "react-json-tree";
import useJson from "../../../../store/useJson";
import { Label } from "./Label";
import { Value } from "./Value";
export const TreeView = (<|fim_suffix|>e.GRID_BG_COLOR,
},
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import type { ModalProps } from "@mantine/core";
import {
ColorPicker,
TextInput,
SegmentedControl,
Group,
Modal,
Button,
Divider,
ColorInput,
} from "@mantine/core";
import { toBlob, toJpeg, toPng, toSvg } from "html-to-image";
import { event as gaEvent } from "... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>m>
<List.Item
icon={
<ThemeIcon variant="transparent" size="sm" c="dimmed">
<TbHistory />
</ThemeIcon>
}
>
No account needed
</List.Item>
<List.Item
ico... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import type { ModalProps } from "@mantine/core";
import { Modal, Group, Button, TextInput, Stack, Paper, Text } from "@mantine/core";
import { Dropzone } from "@mantine/dropzone";
import { event as gaEvent } from "nextjs-google-analytics";
import toast from "react-hot-toast";
im... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import type { ModalProps } from "@mantine/core";
import { Stack, Modal, Button, Text, An<|fim_suffix|> } from "react-icons/vsc";
import useFile from "../../../store/useFile";
import useJson from "../../../store/useJson";
export const JPathModal = ({ opened, onClose }: ModalProp... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import type { ModalProps } from "@mantine/core";
import { Stack, Modal, Button, Text, Anchor, Group, TextInput } from "@mantine/core";
import { VscLinkExternal } from "react-icons/vsc";
import useJsonQuery from "../../../hooks/useJsonQuery";
export const JQModal = ({ opened, onClose }: Modal... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import * as ModalComponents from ".";
import { useModal } from "../../store/useModal";
import { modals, type ModalName } from "./modalTypes";
const Modal = ({ modalKey }: { modalKey: ModalName }) => {
const opened = useModal(state => state[modalKey]);
const setVisible = useModal(state =>... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import type { ModalProps } from "@mantine/core";
import { Modal, Stack, Text, ScrollArea, Flex, CloseButton } from "@mantine/core";
import { CodeHighlight } from "@mantine/code-highlight";
import type { NodeData } from "jsoncrack-react";
import useGraph from "../../editor/views/GraphView/stor... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import type { ModalProps } from "@mantine/core";
import { Stack, Modal, Button, Text, Anchor, Group, Paper } from "@mantine/core";
import Editor from "@monaco-editor/react";
import { event as gaEvent } from "nextjs-google-analytics";
import { toast } from "react-hot-toast";
import { VscLinkEx... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import type { ModalProps } from "@mantine/core";
import { Stack, Modal, Select, ScrollArea } from "@mantine/core";
import { CodeHighlight } from "@mantine/code-highlight";
import { event as gaEvent } from "nextjs-google-analytics";
import useJson from "../../../store/useJson";
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>om "./TypeModal";
export { JPathModal } from "./JPathModal";
<|fim_prefix|>export { DownloadModal } from "./DownloadModal";
export { ImportModal } from "./ImportModal";
export { NodeModal } from "./NodeModal";
export { SchemaMo<|fim_middle|>dal } from "./SchemaModal";
export { JQModal } from "./JQModal";
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>ct.freeze(Object.keys(ModalComponents)) as Extract<
keyof typeof ModalComponents,
string
>[];
export type ModalName = (typeof modals)[number];
<|fim_prefix|>import * as ModalComponents from ".";
// Define the modals array sepa<|fim_middle|>rate from the component logic
export const modals = Obje<|en... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { useDebouncedValue } from "@mantine/hooks";
import { event as gaEvent } from "nextjs-google-analytics";
import useGraph from "../features/editor/views/GraphView/stores/useGraph";
import { cleanupHighlight, searchQuery, highlightMatchedNodes } from "../lib/utils/search";
... | fim | AykutSarac/jsoncrack.com | typescript |
import toast from "react-hot-toast";
import useFile from "../store/useFile";
import useJson from "../store/useJson";
const useJsonQuery = () => {
const getJson = useJson(state => state.getJson);
const setContents = useFile(state => state.setContents);
const transformer = async ({ value }) => {
const { run }... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>tSize = "1.2rem", hideText, hideLogo }: LogoProps) => {
const handleLogoClick = React.useCallback((event: React.MouseEvent<HTMLAnchorElement>) => {
if (typeof window === "undefined") return;
if (!window.location.href.includes("widget")) return;
event.preventDefault();
window.open("/", "... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { Container, Title, Accordion } from "@mantine/core";
import Questions from "../../data/faq.json";
export const FAQ = () => {
return (
<Container id="faq" component="section" size="sm" py={80}>
<Title
c="black"
order={2}
fz={{
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import {
Container,
Flex,
Title,
Text,
Paper,
Center,
Badge,
ThemeIcon,
SimpleGrid,
} from "@mantine/core";
import { FaBolt, FaToolbox } from "react-icons/fa";
import { IoImages, IoShieldCheckmark } from "react-icons/io5";
import { MdOutlineFormatIndentIncrease... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { Container, Image } from "@mantine/core";
export const HeroP<|fim_suffix|>rderRadius: 10,
overflow: "hidden",
border: "1px solid #c1c1c1",
outline: "1px solid #c1c1c1",
outlineOffset: "6px",
}}
/>
</Container>
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import { Oxygen } from "next/font/google";
import Link from "next/link";
import { Stack, Flex, Button } from "@mantine/core";
import styled from "styled-components";
import { FaChevronRight, FaGithub, FaStar } from "react-icons/fa6";
const oxygen = Oxygen({
subsets: ["latin-e... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> borderRadius: "17px",
border: "1px solid #e0e0e0",
}}
>
<StyledImageWrapper>
<Image src="/assets/step3-visual.png" pos="relative" w="100%" alt="export image" />
</StyledImageWrapper>
<Title ta="center" c="black" order={3}>
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> xs: 32,
sm: 42,
}}
maw={500}
order={2}
c="gray.9"
>
Don't waste time with JSON formatters
</Title>
<Text my="md" c="gray.7" fz={16} maw={510}>
Format JSON and transform into a readabl... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> <StyledDottedContainer>
<Image
className="jc"
src="/assets/bf2-image.png"
alt="json, csv, yaml, xml"
loading="lazy"
/>
</StyledDottedContainer>
<Stack maw={634}>
<Title
lh="1.1"
fz={{... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> </Anchor>
<Anchor
href="https://github.com/AykutSarac/jsoncrack.com"
fz="sm"
c="gray.5"
target="_blank"
rel="noopener"
>
Open Source
</Anchor>
<Anchor
href="h... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> <StyledNavbarWrapper className="navbar">
<StyledNavbar>
<Left>
<JSONCrackLogo fontSize="1.2rem" />
</Left>
<Center>
<Button
component="a"
href="https://marketplace.visualstudio.com/items?itemName=AykutSarac.jsoncrack-vscode"
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>
`;
const ContentWrapper = styled.div`
flex: 1;
`;
const PageLayout = ({ children }: React.PropsWithChildren) => {
return (
<ThemeProvider theme={lightTheme}>
<StyledLayoutWrapper>
<Navbar />
<ContentWrapper>{children}</ContentWrapper>
<Footer />
</StyledLayou... | fim | AykutSarac/jsoncrack.com | typescript |
export function isIframe() {
try {
return window.self !== window.top;
} catch {
return true;
}
}
<|endoftext|> | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>on formatNumber(str) {
if (!str) return "";
else if (str.match(/^\d+$/)) str = "Num" + str;
else if (str.charAt(0).match(/\d/)) {
const numbers = {
0: "Zero_",
1: "One_",
2: "Two_",
3: "Three_",
4: "Four_",
5: "Five_",
6: "Six_",
... | fim | AykutSarac/jsoncrack.com | javascript |
<|fim_prefix|>import type { ParseError } from "jsonc-parser";
import { FileFormat } from "../../enums/file.enum";
export const contentToJson = async (value: string, format = FileFormat.JSON): Promise<object> => {
if (!value) return {};
if (format === FileFormat.JSON) {
const { parse } = await import("jsonc-pa... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import { type MantineColorScheme, type MantineColorSchemeManager } from "@mantine/core";
export interface SmartColorSchemeManagerOptions {
/** Local storage key used to retrieve value with `localStorage.getItem(key)` */
key: string;
/** Function that returns the current pathname */
getPathname: (... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>export const searchQuery = (param: string) => {
return document.querySelectorAll(param);
};
export const cleanupHighlight = () => {
cons<|fim_suffix|>0; i < nodes.length; i++) {
nodes[i].classList.add("searched");
}
nodes[selectedNode].classList.add("highlight");
};
<|fim_middle|>t nodes = d... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import Head from "next/head";
import Link from "next/link";
import { Button, St<|fim_suffix|> href="/">
<Button size="lg" color="gray" type="button">
Go Home
</Button>
</Link>
</Stack>
</Layout>
);
};
export default NotFound;
... | fim | AykutSarac/jsoncrack.com | typescript |
import type { AppProps } from "next/app";
import Head from "next/head";
import { useRouter } from "next/router";
import { createTheme, MantineProvider } from "@mantine/core";
import "@mantine/core/styles.css";
import { CodeHighlightAdapterProvider, createShikiAdapter } from "@mantine/code-highlight";
import "@mantine/c... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import type { DocumentContext, DocumentInitialProps } from "next/document";
import Document, { Html, Head, Main, NextScript } from "next/document";
import { ColorSchemeScript } from "@mantine/core";
import { ServerStyleSheet } from "styled<|fim_suffix|>itialProps,
styles: (
<>
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import Head from "next/head";
import { useRouter } from "next/router";
import { Button, Stack, Text, Title } from "@mantine/core";
import { generateNextSeo } from "next-seo/pages";
import { SEO } from "../constants/seo";
import Layout from "../layout/PageLayout";
const Custom50... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import Head from "next/head";
import {
Anchor,
Badge,
Code,
Container,
Divider,
Paper,
Stack,
Table,
Text,
Title,
} from "@mantine/core";
import { CodeHig<|fim_suffix|> <Table.Td>
<Code>options.theme</Code>
</Tab... | fim | AykutSarac/jsoncrack.com | typescript |
import { useEffect } from "react";
import dynamic from "next/dynamic";
import Head from "next/head";
import { useRouter } from "next/router";
import { Tooltip, useMantineColorScheme } from "@mantine/core";
import "@mantine/dropzone/styles.css";
import styled, { ThemeProvider } from "styled-components";
import { Allotme... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> stars: data?.stargazers_count || 0,
},
};
} catch {
return {
props: {
stars: 0,
},
};
}
}) satisfies GetStaticProps<{ stars: number }>;
<|fim_prefix|>import React from "react";
import type { InferGetStaticPropsType, GetStaticProps } from "next";
import Hea... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|></Paper>
</Container>
</Layout>
);
};
export default Privacy;
<|fim_prefix|>import React from "react";
import Head from "next<|fim_middle|>/head";
import { Box, Container, Paper, Stack, Text, Title } from "@mantine/core";
import { generateNextSeo } from "next-seo/pages";
import { SEO } from "... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>6" ta="center">
Last updated: No 30, 2024
</Text>
<Stack mt={50} my="lg">
{Object.keys(terms).map((term, index) => (
<Box component="section" mt="xl" key={index}>
<Title order={2} mb="xl" c="gray.8">
{term}
... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import dynamic from "next/dynamic";
import Head from "next/head";
import { useRouter } from "next/router";
import { useMantineColorScheme } from "@mantine/core";
import { ThemeProvider } from "styled-components";
import type { LayoutDirection } from "jsoncrack-react";
import { generateNextSeo... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import { create } from "zustand";
import { persist } from "zustand/middleware";
const initialStates = {
darkmodeEnabled: true,
liveTransformEnabled: true,
gesturesEnabled: false,
rulersEnabled: true,
};
export<|fim_suffix|> create(
persist<typeof initialStates & ConfigActions>(
set => ({
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>c ({ contents, hasChanges = true, skipUpdate = false, format }) => {
try {
set({
...(contents && { contents }),
error: null,
hasChanges,
format: format ?? get().format,
});
const isFetchURL = window.location.href.includes("?");
const json = awai... | fim | AykutSarac/jsoncrack.com | typescript |
import { create } from "zustand";
interface JsonActions {
setJson: (json: string) => void;
getJson: () => string;
clear: () => void;
}
const initialStates = {
json: "{}",
loading: true,
};
export type JsonStates = typeof initialStates;
const useJson = create<JsonStates & JsonActions>()((set, get) => ({
... | fim | AykutSarac/jsoncrack.com | typescript |
import { createWithEqualityFn as create } from "zustand/traditional";
import { type ModalName, modals } from "../features/modals/modalTypes";
interface ModalActions {
setVisible: (name: ModalName, open: boolean) => void;
}
type ModalState = Record<ModalName, boolean>;
const initialStates: ModalState = modals.reduc... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> DefaultTheme extends CustomTheme {}
}
<|fim_prefix|>/* eslint-disable <|fim_middle|>@typescript-eslint/no-empty-object-type */
import "styled-components";
import type theme from "../constants/theme";
type CustomTheme = typeof theme;
declare module "styled-components" {
export interface<|endoftext|> | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>
languageOptions: {
parserOptions: {
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"unused-imports": unusedImports,
},
rules: {
"@typescript-eslint/consistent-type-imports": "error",
"unused-imports/no-unused-imports": "error",
"@typ... | fim | AykutSarac/jsoncrack.com | javascript |
<|fim_suffix|>// Stable render factories so reaflow doesn't re-key nodes/edges on every parent render.
const renderNode = useCallback(
(nodeProps: NodeProps) => <CustomNode {...nodeProps} onNodeClick={onNodeClick} />,
[onNodeClick]
);
const renderEdge = useCallback(
(edgeProps: EdgeProps) ... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import { describe, expect, it } from "vitest";
import { isNodeHidden, pathKey, prunePaths } from "../components/CollapseContext";
describe("pathKey", () => {
it("serializes a JSONPath to a stable JSON string", () => {
expect(pathKey([])).toBe("[]");
expect(pathKey(["users"])).toBe('["users"]');... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>e).not.toContain("undefined");
expect(className.split(" ").every(part => part.length > 0)).toBe(true);
});
});
describe("buildCanvasStyle", () => {
it("projects all required theme CSS custom properties", () => {
const style = buildCanvasStyle("dark", undefined) as Record<string, string>;
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>result.edges).toEqual([]);
const rows = result.nodes[0].text;
expect(rows).toEqual([
{ key: "name", value: "Apple", type: "string" },
{ key: "count", value: 3, type: "number" },
{ key: "active", value: true, type: "boolean" },
{ key: "tag", value: null, type: "null" },
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>omputeGraphClientRect = (
container: HTMLElement | null,
layoutSize: { width: number; height: number } | null
): DOMRect | null => {
if (!container) return null;
const svg = container.querySelector(".jsoncrack-canvas svg") as SVGSVGElement | null;
if (!svg) return null;
let raw: { left: numb... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import { createContext, useContext } from "react";
import type { JSONPath } from "jsonc-parser";
export interface CollapseContextValue {
collapsedSet: Set<string>;
onToggleCollapse?: (path: JSONPath) => void;
}
const EMPTY: CollapseContextValue = { c<|fim_suffix|>ext = createContext<CollapseContextV... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>} title="Zoom in">
+
</button>
</div>
);
};
<|fim_prefix|>import styles from "./Controls.module.css";
interface ControlsProps {
onFocusRoot: () => void;
onCenterView: () => void;
onZoomOut: () => void;
onZoomIn: () => void;
}
export const Controls = ({ onFocusRoot, onCenterVi... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>IntoView(targetNodeDom.parentElement, {
elementExtraMarginForZoom: 150,
});
}
}, [hostElement, edgeId, edgeTargetById, viewPort]);
return (
<Edge
containerClassName={`edge-${props.id}`}
onClick={handleClick}
onEnter={() => setHovered(true)}
onLeave={() =>... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import React from "react";
import type { NodeProps <|fim_suffix|>nt<SVGGElement, MouseEvent>, data: NodeData) => {
onNodeClick?.(data);
},
[onNodeClick]
);
return (
<Node
{...nodeProps}
onClick={handleNodeClick as any}
animated={false}
label={null as any}
... | fim | AykutSarac/jsoncrack.com | typescript |
import React from "react";
import type { JSONPath } from "jsonc-parser";
import type { NodeData } from "../types";
import { isPathCollapsed, useCollapseContext } from "./CollapseContext";
import styles from "./Node.module.css";
import { TextRenderer } from "./TextRenderer";
import { getTextColor } from "./nodeStyles";
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|> next.node.text && prev.node.width === next.node.width;
};
export const TextNode = React.memo(TextNodeBase, propsAreEqual);
<|fim_prefix|>import React from "react";
import type { NodeData } from "../types";
import styles from "./Node.module.css";
import { TextRenderer } from "./TextRenderer";
import { ge... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>{
return URL_PATTERN.test(word);
};
const isColorFormat = (colorString: string) => {
return (
HEX_CODE_PATTERN.test(colorString) ||
RGB_PATTERN.test(colorString) ||
RGBA_PATTERN.test(colorString)
);
};
const LinkifiedText = ({ text }: { text: string }) => {
if (!isURL(text)) return <... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>type TextColorOptions = {
type?: string;
value?: string | number | null | boolean;
};
export const getTextColor = ({ type, value }: TextColorOptions) => {
if (value === null) return "var(--node-null)";
if (type === "object") return "var(--node-key)";
if (type === "number") return "var(--node-in... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>ses;
}
<|fim_prefix|>declare module "*.module.css" {
const classes: Record<<|fim_middle|>string, string>;
export default clas<|endoftext|> | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>from "./types";
<|fim_prefix|>export { JSONCrack } from "./JSONCrackComponent";
export { parseGraph } from "./parser";
export type { JSONCrackProps, <|fim_middle|>JSONCrackRef } from "./JSONCrackComponent";
export type { ParseGraphResult } from "./parser";
export type {
CanvasThemeMode,
EdgeData,
Gr... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>e.value as NodeRow["value"],
type,
});
}
});
if (node.parent?.type === "array" && node.type === "object" && node.children?.length === 0) {
text.push({
key: null,
value: "{0 keys}",
type: "object",
childrenCount: 0,
});
}
... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import type { CanvasThemeMode } from "./types";
export i<|fim_suffix|>ERACTIVE_NORMAL: "#b9bbbe",
BACKGROUND_NODE: "#2B2C3E",
BACKGROUND_MODIFIER_ACCENT: "rgba(79,84,92,0.48)",
TEXT_POSITIVE: "hsl(139,calc(var(--saturation-factor, 1)*51.6%),52.2%)",
GRID_BG_COLOR: "#141414",
GRID_COLO... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import type { JSONPath, Node } from "json<|fim_suffix|>P";
export type CanvasThemeMode = "light" | "dark";
<|fim_middle|>c-parser";
export interface NodeRow {
key: string | null;
value: string | number | null | boolean;
type: Node["type"];
childrenCount?: number;
to?: string[];
}
export inter... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_suffix|>heKey, sizes);
return sizes;
};
<|fim_prefix|>const NODE_DIMENSIONS = {
ROW_HEIGHT: 30,
PARENT_HEIGHT: 36,
} as const;
type Text = number | string | [string, string][];
type Size = { width: number; height: number };
const CACHE_TTL_MS = 120_000;
const sizeCache = new Map<string, Size>();
let lastC... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>import react from "@vitejs/plugin-react";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";<|fim_suffix|> ["es"],
fileName: "index",
},
rolldownOptions: {
external: [
"react",
"react-dom",
"react/... | fim | AykutSarac/jsoncrack.com | typescript |
<|fim_prefix|>#!/usr/bin/env -S dotnet fsi
open System
open System.Text
open System.Net.Http
let url = fsi.CommandLineArgs[1]
let actor = fsi.CommandLineArgs[2]
let branch = fsi.CommandLineArgs[3]
let commitID = fsi.CommandLineArgs[4]
let compareURL = fsi.CommandLineArgs[5]
let msg = IO.File.ReadAllText "msg.txt"
let ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_suffix|>2R2 F# Sample.
// ----------------------------------------------------------------------------
#r "nuget: B2R2.FrontEnd.API"
open B2R2
open B2R2.FrontEnd
let isa = ISA "amd64"
let bytes = [| 0x65uy; 0xffuy; 0x15uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy |]
let hdl = BinHandle(bytes, isa)
let lifter = hdl.NewLi... | fim | B2R2-org/B2R2 | fsharp |
#!/usr/bin/env fsharpi
(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restrictio... | fim | B2R2-org/B2R2 | fsharp |
<|fim_suffix|> Opcode.InvalOP; Opcode.InvalOP |])
("opVex0F3A60", [| Opcode.InvalOP; Opcode.VPCMPESTRM;
Opcode.InvalOP; Opcode.InvalOP |])
("opNor0F3A61", [| Opcode.InvalOP; Opcode.PCMPESTRI;
Opcode.InvalOP; Opcode.InvalOP |])
("opVex0F3A61", [| Opcode.In... | fim | B2R2-org/B2R2 | fsharp |
<|fim_suffix|>es or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without li... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_suffix|> ']')
let alphanumericWithUnderscore s = Char.IsLetterOrDigit s || s = '_'
let pId = many1Satisfy alphanumericWithUnderscore
let pLabelDef = pId .>>? pchar ':' >>= addLabeldef <?> "label"
/// If the value satisfies the condition then check succeeds.
let check p condition =
if condition p... | fim | B2R2-org/B2R2 | fsharp |
<|fim_prefix|>(*
B2R2 - the Next-Generation Reversing Platform
Copyright (c) SoftSec Lab. @ KAIST, since 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | fim | B2R2-org/B2R2 | fsharp |
<|fim_suffix|> EncVEXPrefix(VEXType.TwoByteOp, REXPrefix.REXW, 128<rt>, Prefix.OPSIZE)
member _.VEX128n66n0F3A with get() =
EncVEXPrefix(VEXType.ThreeByteOpTwo, REXPrefix.NOREX, 128<rt>,
Prefix.OPSIZE)
member _.VEX256n66n0F3A with get() =
EncVEXPrefix(VEXType.ThreeByteOpTwo, REXPrefix.NOREX, 256<r... | fim | B2R2-org/B2R2 | fsharp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.