file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
.fatherrc.js
JavaScript
export default { cjs: 'babel', esm: { type: 'babel', importLibToEs: true }, preCommit: { eslint: true, prettier: true, }, };
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
assets/index.less
LESS
@footer-prefix-cls: rc-footer; .@{footer-prefix-cls} { position: relative; clear: both; color: rgba(255, 255, 255, 0.4); font-size: 14px; line-height: 1.5; background-color: #000; a { transition: all 0.3s; color: rgba(255, 255, 255, 0.9); text-decoration: none; &:hover { color: #4...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/basic.tsx
TypeScript (TSX)
import '../assets/index.less'; import React from 'react'; // import plantTXT from './svg/Plant'; import Malfurion from '../src'; import useElementSelection from './hooks/useElementSelection'; import Selection from './components/Selection'; // const svgText = plantTXT; // const svgText = ` // <svg> // <g transform="t...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/components/Selection/OperatePoint.tsx
TypeScript (TSX)
import React from 'react'; import { Point } from '../../../src/interface'; export type Position = 'lt' | 'rt' | 'lb' | 'rb'; export interface OperatePointProps { point: Point; size: number; stroke: string; position: Position; onMouseDown: (e: React.MouseEvent<SVGElement>, position: Position) => void; } exp...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/components/Selection/OriginPoint.tsx
TypeScript (TSX)
import React from 'react'; import { Point } from '../../../src/interface'; export interface OriginPointProps { point: Point; size: number; stroke: string; } export function OriginPoint({ point, size, stroke }: OriginPointProps) { const half = size / 2; return ( <g> <line x1={point.x - hal...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/components/Selection/RotateHandler.tsx
TypeScript (TSX)
import React from 'react'; import { Point } from '../../../src/interface'; export interface RotateHandlerProps { origin: Point; length: number; size: number; stroke: string; rotate: number; onMouseDown: React.MouseEventHandler<SVGElement>; } function RotateHandler( { origin, length, stroke, size, rotate...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/components/Selection/index.tsx
TypeScript (TSX)
import React from 'react'; import { throttle } from 'lodash'; import { Matrix, Line } from '../../../src'; import useElementSelection from '../../hooks/useElementSelection'; import OperatePoint, { Position } from './OperatePoint'; import { OriginPoint } from './OriginPoint'; import RotateHandler from './RotateHandler';...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/hooks/useElementSelection.ts
TypeScript
import React from 'react'; import Malfurion, { BoundingBox } from '../../src'; interface ProxyRef { current: Malfurion | null; currentPath: number[]; } export default function useElementSelection( overwriteProxyRef: React.RefObject<ProxyRef> = { current: null }, ) { const [boundingBox, setBoundingBox] = React...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/svg/Plant.ts
TypeScript
/* eslint-disable max-len */ // export default ` // <?xml version="1.0" encoding="UTF-8"?> // <svg width="493px" height="841px" viewBox="0 0 493 841" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> // <!-- Generator: Sketch 63.1 (92452) - https://sketch.com --> // <t...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
index.js
JavaScript
module.exports = require('./src/');
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
jest.config.js
JavaScript
module.exports = { snapshotSerializers: [require.resolve('enzyme-to-json/serializer')], };
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/index.ts
TypeScript
import { getBox, analysisSVG } from './utils/svgUtil'; import { SVGEntity, SVGNodeEntity, SVGBox, SVGNodeRecord, MalfurionEventHandler, MalfurionEventType, BoundingBox, SerializeTransform, TransformConfig, HierarchyInfo, } from './interface'; import Matrix from './utils/matrix'; import { Line } from...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/interface.ts
TypeScript
import Malfurion from '.'; export interface SVGBox { x: number; y: number; width: number; height: number; } export interface ShapeInfo extends SVGBox { originX?: number; originY?: number; } export interface BoundingBox extends Omit<ShapeInfo, 'originX' | 'originY'>, Omit<Required<TransformConfig>, ...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/utils/cacheUtil.ts
TypeScript
import { SVGNodeEntity } from '../interface'; function convertStringPath(path: string) { return path.split('-').map(pos => Number(pos)); } export class PathCache { private elementPathMap = new Map<Element, string>(); private pathElementMap = new Map<string, Element>(); private entityPathMap = new Map<SVGNod...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/utils/mathUtil.ts
TypeScript
import { Point } from '../interface'; // Minimum 0.0000000000001, leave 1 digit. const PRECISION = 0.000000000001; /** * * @param list [x, y, z][] * @returns [a, b,c ] */ export function resolveTernary(list: [number, number, number][]) { const z0 = list[0][2]; const z1 = list[1][2]; const z2 = list[2][2]; ...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/utils/matrix.ts
TypeScript
import { multiply, divide, inv } from 'mathjs'; import { Point, ShapeInfo } from '../interface'; import { parseTransformMatrix } from './svgUtil'; import { resolveTernary } from './mathUtil'; export default class Matrix { protected matrix: number[][]; public static fromArray(matrixArr: number[][]) { const ins...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/utils/svgUtil.ts
TypeScript
import { SVGNodeRecord, SVGEntity, SVGNodeEntity, SVGBox } from '../interface'; import Matrix from './matrix'; function getColor(str: string = '') { const { style } = new Option(); style.color = str; if (style.color) { return style.color; } return null; } export function getAttributes({ attributes, ...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/utils.test.tsx
TypeScript (TSX)
import Matrix from '../src/utils/matrix'; import { Line } from '../src/utils/mathUtil'; describe('Utils', () => { describe('Matrix', () => { it('fill', () => { const m = new Matrix(2, 3); m.fill([1, 2, 3, 4, 5, 6]); expect(m.getMatrix()).toEqual([[1, 2], [3, 4], [5, 6]]); expect(m.get(0...
zombieJ/malfurion
0
A svg control lib
TypeScript
zombieJ
二货爱吃白萝卜
alipay
.eslintrc.js
JavaScript
const base = require('@umijs/fabric/dist/eslint'); module.exports = { ...base, rules: { ...base.rules, 'default-case': 0, 'react/sort-comp': 0, 'react/no-array-index-key': 0, 'react/no-access-state-in-setstate': 0, 'no-plusplus': 0, 'no-param-reassign': 0, 'react/require-default-pro...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
.fatherrc.js
JavaScript
export default { cjs: 'babel', esm: { type: 'babel', importLibToEs: true }, preCommit: { eslint: true, prettier: true, }, runtimeHelpers: true, };
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
assets/dropdown.less
LESS
@tabs-prefix-cls: rc-tabs; .@{tabs-prefix-cls}-dropdown { position: absolute; background: #fefefe; border: 1px solid black; max-height: 200px; overflow: auto; &-hidden { display: none; } &-menu { margin: 0; padding: 0; list-style: none; &-item { padding: 4px 8px; &-s...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
assets/index.less
LESS
@import './dropdown.less'; @import './panels.less'; @import './position.less'; @import './rtl.less'; @tabs-prefix-cls: rc-tabs; @easing-in-out: cubic-bezier(0.35, 0, 0.25, 1); @effect-duration: 0.3s; .@{tabs-prefix-cls} { border: 1px solid gray; font-size: 14px; overflow: hidden; // =======================...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
assets/panels.less
LESS
@tabs-prefix-cls: rc-tabs; .@{tabs-prefix-cls} { &-content { &-holder { flex: auto; } display: flex; width: 100%; &-animated { transition: margin 0.3s; } } &-tabpane { width: 100%; flex: none; } }
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
assets/position.less
LESS
@tabs-prefix-cls: rc-tabs; .@{tabs-prefix-cls} { display: flex; // ========================== Vertical ========================== &-top, &-bottom { flex-direction: column; .@{tabs-prefix-cls}-ink-bar { height: 3px; } } &-top { .@{tabs-prefix-cls}-ink-bar { bottom: 0; } ...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
assets/rtl.less
LESS
@tabs-prefix-cls: rc-tabs; .@{tabs-prefix-cls} { &-rtl { direction: rtl; } &-dropdown-rtl { direction: rtl; } }
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/basic.tsx
TypeScript (TSX)
import React from 'react'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; export default () => { const [destroy, setDestroy] = React.useState(false); const [children, setChildren] = React.useState([ <TabPane key="light" tab="light"> Light </TabPane>, <TabPane key="bamboo" ...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/extra.tsx
TypeScript (TSX)
/* eslint-disable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ import React from 'react'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; const tabs: React.ReactElement[] = []; for (let i = 0; i < 50; i += 1) { tabs.push( <TabPane key={i} tab={`Tab ${i}`}> Conten...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/mix.tsx
TypeScript (TSX)
/* eslint-disable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ import React from 'react'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; function getTabPanes(count = 50) { const tabs: React.ReactElement[] = []; for (let i = 0; i < count; i += 1) { tabs.push( <T...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/overflow.tsx
TypeScript (TSX)
/* eslint-disable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ import React from 'react'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; const tabs: React.ReactElement[] = []; for (let i = 0; i < 50; i += 1) { tabs.push( <TabPane key={i} tab={`Tab ${i}`}> Conten...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/position.tsx
TypeScript (TSX)
/* eslint-disable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ import React from 'react'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; export default () => { const [position, setPosition] = React.useState<any>('left'); const [gutter, setGutter] = React.useState(false);...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/renderTabBar-dragable.tsx
TypeScript (TSX)
/* eslint-disable import/no-named-as-default-member */ import React from 'react'; import { DndProvider, DragSource, DropTarget } from 'react-dnd'; import HTML5Backend from 'react-dnd-html5-backend'; import Tabs from '../src'; import '../assets/index.less'; const { TabPane } = Tabs; // Drag & Drop node class TabNode e...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/renderTabBar-sticky.tsx
TypeScript (TSX)
import React from 'react'; import { StickyContainer, Sticky } from 'react-sticky'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; const renderTabBar = (props, DefaultTabBar) => ( <Sticky bottomOffset={80}> {({ style }) => ( <DefaultTabBar {...props} className="site-c...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
examples/renderTabBar-use-panes.tsx
TypeScript (TSX)
import React from 'react'; import Tabs, { TabPane } from '../src'; import '../assets/index.less'; const renderTabBar = props => { return ( <div> {props.panes.map(pane => { const key = pane.key; return <span key={key}>{key}</span>; })} </div> ); }; export default () => { retur...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
jest.config.js
JavaScript
module.exports = { setupFiles: ['./tests/setup.js'], snapshotSerializers: [require.resolve('enzyme-to-json/serializer')], };
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabContext.ts
TypeScript
import { createContext } from 'react'; import { Tab } from './interface'; export interface TabContextProps { tabs: Tab[]; prefixCls: string; } export default createContext<TabContextProps>(null);
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabNavList/AddButton.tsx
TypeScript (TSX)
import * as React from 'react'; import { EditableConfig, TabsLocale } from '../interface'; export interface AddButtonProps { prefixCls: string; editable?: EditableConfig; locale?: TabsLocale; style?: React.CSSProperties; } function AddButton( { prefixCls, editable, locale, style }: AddButtonProps, ref: Re...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabNavList/OperationNode.tsx
TypeScript (TSX)
import * as React from 'react'; import classNames from 'classnames'; import { useState, useEffect } from 'react'; import KeyCode from 'rc-util/lib/KeyCode'; import Menu, { MenuItem } from 'rc-menu'; import Dropdown from 'rc-dropdown'; import { Tab, TabsLocale, EditableConfig } from '../interface'; import AddButton from...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabNavList/TabNode.tsx
TypeScript (TSX)
import * as React from 'react'; import classNames from 'classnames'; import KeyCode from 'rc-util/lib/KeyCode'; import { Tab, TabPosition, EditableConfig } from '../interface'; export interface TabNodeProps { id: string; prefixCls: string; tab: Tab; active: boolean; rtl: boolean; closable?: boolean; edit...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabNavList/index.tsx
TypeScript (TSX)
import * as React from 'react'; import { useState, useRef, useEffect } from 'react'; import classNames from 'classnames'; import raf from 'raf'; import ResizeObserver from 'rc-resize-observer'; import useRaf, { useRafState } from '../hooks/useRaf'; import TabNode from './TabNode'; import { TabSizeMap, TabPosition, ...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabPanelList/TabPane.tsx
TypeScript (TSX)
import * as React from 'react'; import classNames from 'classnames'; export interface TabPaneProps { tab?: React.ReactNode; className?: string; style?: React.CSSProperties; disabled?: boolean; children?: React.ReactNode; forceRender?: boolean; closable?: boolean; closeIcon?: React.ReactNode; // Pass...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/TabPanelList/index.tsx
TypeScript (TSX)
import * as React from 'react'; import classNames from 'classnames'; import TabContext from '../TabContext'; import { TabPosition, AnimatedConfig } from '../interface'; export interface TabPanelListProps { activeKey: React.Key; id: string; rtl: boolean; animated?: AnimatedConfig; tabPosition?: TabPosition; ...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/Tabs.tsx
TypeScript (TSX)
// Accessibility https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Tab_Role import * as React from 'react'; import { useEffect, useState } from 'react'; import classNames from 'classnames'; import toArray from 'rc-util/lib/Children/toArray'; import useMergedState from 'rc-util/lib/hooks/useMergedSta...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/hooks/useOffsets.ts
TypeScript
import { useMemo } from 'react'; import { TabSizeMap, TabOffsetMap, Tab, TabOffset } from '../interface'; const DEFAULT_SIZE = { width: 0, height: 0, left: 0, top: 0 }; export default function useOffsets(tabs: Tab[], tabSizes: TabSizeMap, holderScrollWidth: number) { return useMemo(() => { const map: TabOffsetM...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/hooks/useRaf.ts
TypeScript
import { useRef, useState, useEffect } from 'react'; import raf from 'raf'; export default function useRaf<Callback extends Function>(callback: Callback) { const rafRef = useRef<number>(); const removedRef = useRef(false); function trigger(...args: any[]) { if (!removedRef.current) { raf.cancel(rafRef...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/hooks/useRefs.ts
TypeScript
import * as React from 'react'; import { useRef } from 'react'; export default function useRefs<RefType>(): [ (key: React.Key) => React.RefObject<RefType>, (key: React.Key) => void, ] { const cacheRefs = useRef(new Map<React.Key, React.RefObject<RefType>>()); function getRef(key: React.Key) { if (!cacheRe...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/hooks/useSyncState.ts
TypeScript
import * as React from 'react'; type Updater<T> = (prev: T) => T; export default function useSyncState<T>( defaultState: T, onChange: (newValue: T, prevValue: T) => void, ): [T, (updater: T | Updater<T>) => void] { const stateRef = React.useRef<T>(defaultState); const [, forceUpdate] = React.useState({}); ...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/hooks/useTouchMove.ts
TypeScript
import * as React from 'react'; import { useState, useRef } from 'react'; type TouchEventHandler = (e: TouchEvent) => void; type WheelEventHandler = (e: WheelEvent) => void; const MIN_SWIPE_DISTANCE = 0.1; const STOP_SWIPE_DISTANCE = 0.01; const REFRESH_INTERVAL = 20; const SPEED_OFF_MULTIPLE = 0.995 ** REFRESH_INTER...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/hooks/useVisibleRange.ts
TypeScript
import { useMemo } from 'react'; import { Tab, TabOffsetMap } from '../interface'; import { TabNavListProps } from '../TabNavList'; const DEFAULT_SIZE = { width: 0, height: 0, left: 0, top: 0, right: 0 }; export default function useVisibleRange( tabOffsets: TabOffsetMap, containerSize: { width: number; height: nu...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/index.ts
TypeScript
import Tabs, { TabsProps } from './Tabs'; import TabPane, { TabPaneProps } from './TabPanelList/TabPane'; export { TabPane, TabsProps, TabPaneProps }; export default Tabs;
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
src/interface.ts
TypeScript
import { TabPaneProps } from './TabPanelList/TabPane'; export type TabSizeMap = Map< React.Key, { width: number; height: number; left: number; top: number } >; export interface TabOffset { width: number; height: number; left: number; right: number; top: number; } export type TabOffsetMap = Map<React.Key...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/common/util.tsx
TypeScript (TSX)
import React from 'react'; import { ReactWrapper } from 'enzyme'; import Tabs, { TabPane } from '../../src'; import { TabsProps } from '../../src/Tabs'; export function getOffsetSizeFunc( info: { list?: number; wrapper?: number; add?: number; operation?: number; more?: number; dropdown?: numb...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/index.test.tsx
TypeScript (TSX)
import React from 'react'; import { mount, ReactWrapper } from 'enzyme'; import KeyCode from 'rc-util/lib/KeyCode'; import Tabs, { TabPane } from '../src'; import { TabsProps } from '../src/Tabs'; describe('Tabs.Basic', () => { function getTabs(props: TabsProps = null) { const mergedProps = { children: [ ...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/mobile.test.tsx
TypeScript (TSX)
import React from 'react'; import { mount, ReactWrapper } from 'enzyme'; import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { act } from 'react-dom/test-utils'; import Tabs, { TabPane } from '../src'; import { TabsProps } from '../src/Tabs'; import { getTransformX } from './common/util'; describe(...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/operation-overflow.test.tsx
TypeScript (TSX)
import { mount } from 'enzyme'; import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { act } from 'react-dom/test-utils'; import { getOffsetSizeFunc, getTabs, triggerResize } from './common/util'; describe('Tabs.Operation-Overflow', () => { let domSpy: ReturnType<typeof spyElementPrototypes>; le...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/overflow.test.tsx
TypeScript (TSX)
import React from 'react'; import { mount } from 'enzyme'; import KeyCode from 'rc-util/lib/KeyCode'; import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { act } from 'react-dom/test-utils'; import { getOffsetSizeFunc, getTabs, triggerResize, getTransformX, getTransformY, } from './common/...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/rtl.test.tsx
TypeScript (TSX)
import { mount } from 'enzyme'; import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; import { act } from 'react-dom/test-utils'; import { getOffsetSizeFunc, getTabs, triggerResize, getTransformX } from './common/util'; // Same as `overflow.test.tsx` but use in RTL describe('Tabs.RTL', () => { let domSpy...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/setup.js
JavaScript
global.requestAnimationFrame = function requestAnimationFrame(cb) { return setTimeout(cb, 0); }; const Enzyme = require('enzyme'); const Adapter = require('enzyme-adapter-react-16'); Enzyme.configure({ adapter: new Adapter() });
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
tests/swipe.js
JavaScript
/* eslint-disable no-undef */ import React, { Component } from 'react'; import { mount, render } from 'enzyme'; import { renderToJson } from 'enzyme-to-json'; import Tabs, { TabPane } from '../src'; import SwipeableTabContent from '../src/SwipeableTabContent'; import SwipeableInkTabBar from '../src/SwipeableInkTabBar';...
zombieJ/test-style
0
Test for `css in js` solution.
TypeScript
zombieJ
二货爱吃白萝卜
alipay
android/build.gradle
Gradle
buildscript { ext.safeExtGet = {prop, fallback -> rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } repositories { google() gradlePluginPortal() } dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "2.1.2...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
android/src/main/java/com/zoontek/rnnavigationbar/NavigationBarModuleImpl.kt
Kotlin
package com.zoontek.rnnavigationbar import android.app.Activity import android.graphics.Color import android.os.Build.VERSION import android.os.Build.VERSION_CODES import android.util.TypedValue import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat import com.facebook.co...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
android/src/main/java/com/zoontek/rnnavigationbar/NavigationBarPackage.kt
Kotlin
package com.zoontek.rnnavigationbar import com.facebook.react.BaseReactPackage import com.facebook.react.bridge.NativeModule import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.module.model.ReactModuleInfo import com.facebook.react.module.model.ReactModuleInfoProvider class NavigationBa...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
android/src/newarch/com/zoontek/rnnavigationbar/NavigationBarModule.kt
Kotlin
package com.zoontek.rnnavigationbar import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.module.annotations.ReactModule @ReactModule(name = NavigationBarModuleImpl.NAME) class NavigationBarModule(reactContext: ReactApplicationContext) : NativeNavigationBarModuleSpec(reactContext) { ...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
android/src/oldarch/com/zoontek/rnnavigationbar/NavigationBarModule.kt
Kotlin
package com.zoontek.rnnavigationbar import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactMethod import com.facebook.react.module.annotations.ReactModule @ReactModule(name = NavigationBarModuleImpl.NAME) class Navigat...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
app.plugin.js
JavaScript
module.exports = require("./dist/commonjs/expo");
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/android/app/build.gradle
Gradle
apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */ react { /* Folde...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/android/app/src/main/java/com/rnnavigationbarexample/MainActivity.kt
Kotlin
package com.rnnavigationbarexample import com.facebook.react.ReactActivity import com.facebook.react.ReactActivityDelegate import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled import com.facebook.react.defaults.DefaultReactActivityDelegate class MainActivity : ReactActivity() { /** ...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/android/app/src/main/java/com/rnnavigationbarexample/MainApplication.kt
Kotlin
package com.rnnavigationbarexample import android.app.Application import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactHost import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative import com.facebook.react.defaults.DefaultReactHost.getDefaul...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/android/build.gradle
Gradle
buildscript { ext { buildToolsVersion = "36.0.0" minSdkVersion = 24 compileSdkVersion = 36 targetSdkVersion = 36 ndkVersion = "27.1.12297006" kotlinVersion = "2.1.20" } repositories { google() mavenCentral() } dependencies { cla...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/android/settings.gradle
Gradle
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } plugins { id("com.facebook.react.settings") } extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } rootProject.name = 'RNNavigationBarExample' include ':app' includeBuild('../node_modul...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/babel.config.js
JavaScript
const path = require("path"); const pkg = require("../package.json"); const resolverConfig = { extensions: [".ts", ".tsx", ".js", ".jsx", ".json"], alias: { [pkg.name]: path.resolve(__dirname, "../src") }, }; module.exports = { presets: ["module:@react-native/babel-preset"], plugins: [["module-resolver", reso...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/index.js
JavaScript
import { AppRegistry } from "react-native"; import { name as appName } from "./app.json"; import { App } from "./src/App"; AppRegistry.registerComponent(appName, () => App);
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/ios/RNNavigationBarExample/AppDelegate.swift
Swift
import UIKit import React import React_RCTAppDelegate import ReactAppDependencyProvider @main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var reactNativeDelegate: ReactNativeDelegate? var reactNativeFactory: RCTReactNativeFactory? func application( _ application: UIAppli...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/metro.config.js
JavaScript
const path = require("path"); const pkg = require("../package.json"); const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config"); const escape = require("escape-string-regexp"); const peerDependencies = Object.keys(pkg.peerDependencies); const root = path.resolve(__dirname, ".."); const projectNo...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
example/src/App.tsx
TypeScript (TSX)
import SegmentedControl from "@react-native-segmented-control/segmented-control"; import { NavigationBar, type NavigationBarStyle, } from "@zoontek/react-native-navigation-bar"; import { useEffect, useState, type ReactNode } from "react"; import { Appearance, Text as BaseText, StatusBar, StyleSheet, Switc...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
src/NavigationBar.ts
TypeScript
import { useEffect, useMemo, useRef } from "react"; import NativeModule from "./specs/NativeNavigationBarModule"; import type { NavigationBarProps, NavigationBarStyle } from "./types"; // Merges the entries stack function mergeEntriesStack(entriesStack: NavigationBarProps[]) { return entriesStack.reduce<{ barSty...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
src/expo.ts
TypeScript
import { type ConfigPlugin, createRunOncePlugin, withAndroidStyles, } from "@expo/config-plugins"; type AndroidProps = { enforceNavigationBarContrast?: boolean; }; type Props = { android?: AndroidProps } | undefined; const withAndroidNavigationBarStyles: ConfigPlugin<Props> = ( config, props = {}, ) => {...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
src/index.ts
TypeScript
export { NavigationBar } from "./NavigationBar"; export type { NavigationBarProps, NavigationBarStyle } from "./types";
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
src/specs/NativeNavigationBarModule.ts
TypeScript
import type { TurboModule } from "react-native"; import { Platform, TurboModuleRegistry } from "react-native"; interface Spec extends TurboModule { setStyle(style: string): void; setHidden(hidden: boolean): void; } export default Platform.OS === "android" ? TurboModuleRegistry.getEnforcing<Spec>("RNNavigationBa...
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
src/specs/NativeNavigationBarModule.web.ts
TypeScript
export default null;
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
src/types.ts
TypeScript
export type NavigationBarStyle = "default" | "light-content" | "dark-content"; export type NavigationBarProps = { barStyle?: NavigationBarStyle; hidden?: boolean; };
zoontek/react-native-navigation-bar
81
React Native StatusBar long-lost twin: A component to control your Android app's navigation bar.
TypeScript
zoontek
Mathieu Acthernoene
Swan
ascii.go
Go
package codec var printableASCII [256]bool func init() { for b := 0; b < len(printableASCII); b++ { if '\x08' < b && b < '\x7f' { printableASCII[b] = true } } } // isPrintableASCII returns true if all bytes are printable ASCII func isPrintableASCII(b []byte) bool { for _, c := range b { if !printableASCI...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
base64.go
Go
package codec import ( "encoding/base64" ) // likelyBase64Chars is a set of characters that you would expect to find at // least one of in base64 encoded data. This risks missing about 1% of // base64 encoded data that doesn't contain these characters, but gives you // the performance gain of not trying to decode a ...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
decoder.go
Go
package codec import ( "bytes" "github.com/betterleaks/betterleaks/logging" ) // Decoder decodes various types of data in place type Decoder struct { decodedMap map[string]string } // NewDecoder creates a default decoder struct func NewDecoder() *Decoder { return &Decoder{ decodedMap: make(map[string]string),...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
decoder_test.go
Go
package codec import ( "encoding/hex" "net/url" "strings" "testing" "github.com/stretchr/testify/assert" ) func TestDecode(t *testing.T) { tests := []struct { chunk string expected string name string }{ { name: "only b64 chunk", chunk: `bG9uZ2VyLWVuY29kZWQtc2VjcmV0LXRlc3Q=`, exp...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
encodings.go
Go
package codec import ( "math" ) // Lookup tables for byte classification. var ( isHexChar [256]bool // 0-9, A-F, a-f isB64Char [256]bool // 0-9, A-Z, a-z, _, /, +, - (matches [\w\/+-]) isB64NotHex [256]bool // b64 chars that are NOT hex (G-Z, g-z, _, /, +, -) isWhitespace [256]bool // space, tab, \n, \r,...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
hex.go
Go
package codec // hexMap is a precalculated map of hex nibbles const hexMap = "" + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + "\x00\x01\x02\x03\x04\x05\...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
percent.go
Go
package codec // decodePercent decodes percent encoded strings func decodePercent(encodedValue string) string { encLen := len(encodedValue) decodedValue := make([]byte, encLen) decIndex := 0 encIndex := 0 for encIndex < encLen { if encodedValue[encIndex] == '%' && encIndex+2 < encLen { n1 := hexMap[encodedV...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
segment.go
Go
package codec import ( "fmt" ) // EncodedSegment represents a portion of text that is encoded in some way. type EncodedSegment struct { // predecessors are all of the segments from the previous decoding pass predecessors []*EncodedSegment // original start/end indices before decoding original startEnd // enco...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
start_end.go
Go
package codec import ( "fmt" ) // startEnd represents the start and end of some data. It mainly exists as a // helper when referencing the values type startEnd struct { start int end int } // sub subtracts the values of two startEnds func (s startEnd) sub(o startEnd) startEnd { return startEnd{ s.start - o.s...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
unicode.go
Go
package codec import ( "strings" "unicode/utf8" ) // Unicode characters are encoded as 1 to 4 bytes per rune. const maxBytesPerRune = 4 // parseHex4 parses exactly 4 hex characters into a rune value. // Returns the rune and true on success, 0 and false on failure. func parseHex4(s string, offset int) (rune, bool) ...
zricethezav/codec
0
optimized codec
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
searcher.go
Go
package icanhazwordz import ( "sort" "strings" ahocorasick "github.com/BobuSumisu/aho-corasick" ) // Default filter ignores single character words. // If you want to include them, set MinLength to 1. var DefaultFilter = Filter{MinLength: 2, MaxLength: 0, PreferLongestNonOverlapping: false} // Match represents a ...
zricethezav/icanhazwordz
0
does this string contain words?
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
searcher_test.go
Go
package icanhazwordz import ( "testing" ) func TestSearcherFindExact(t *testing.T) { // Use a simple filter for testing searcher := NewSearcher(Filter{ExactLength: 5}) tests := []struct { name string text string numMatches int }{ { name: "exact filter", text: "hello world",...
zricethezav/icanhazwordz
0
does this string contain words?
Go
zricethezav
Zachary Rice
gitleaks trufflesecurity
gitleaks.js
JavaScript
/** * Gitleaks WASM Integration and UI Management * * This file ties together our secret scanning logic (powered by Gitleaks via WASM) * with the browser's UI. It handles scanning operations, displays findings, * and integrates with the Rule Wizard. */ // ============================================= // Global V...
zricethezav/wasmleaks
3
gitleaks wasm browser
JavaScript
zricethezav
Zachary Rice
gitleaks trufflesecurity
index.html
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>WASMLeaks | WASM Gitleaks Playground</title> <meta name="description" content="WASMLeaks is a free, browser-based tool powered by Gitleaks. 100% client-side with no server uploads." /> <meta name="viewport" content="width=device-width, init...
zricethezav/wasmleaks
3
gitleaks wasm browser
JavaScript
zricethezav
Zachary Rice
gitleaks trufflesecurity
main.go
Go
package main import ( "bytes" "fmt" "syscall/js" "time" "github.com/rs/zerolog" "github.com/spf13/viper" "github.com/zricethezav/gitleaks/v8/config" "github.com/zricethezav/gitleaks/v8/detect" "github.com/zricethezav/gitleaks/v8/logging" "github.com/zricethezav/gitleaks/v8/report" ) /* Gitleaks WASM Ent...
zricethezav/wasmleaks
3
gitleaks wasm browser
JavaScript
zricethezav
Zachary Rice
gitleaks trufflesecurity
styles.css
CSS
/* Base styles and reset */ :root { --primary-color: #2563eb; --primary-dark: #1d4ed8; --primary-light: #3b82f6; --secondary-color: #f3f4f6; --surface-color: #ffffff; --border-color: #e5e7eb; --text-color: #374151; --text-light: #6b7280; --text-inverse: #ffffff; --error-color: #ef4444; --warning-c...
zricethezav/wasmleaks
3
gitleaks wasm browser
JavaScript
zricethezav
Zachary Rice
gitleaks trufflesecurity
ui.js
JavaScript
/** * UI JavaScript for Secret Scanning * * This script handles all UI interactions including: * - Tab switching * - Theme toggling * - CodeMirror initialization * - Entropy calculation * - Resizable editor functionality * - State sharing via URL fragments */ // Global variables let editor; //...
zricethezav/wasmleaks
3
gitleaks wasm browser
JavaScript
zricethezav
Zachary Rice
gitleaks trufflesecurity
.eslintrc.js
JavaScript
module.exports = { parser: "@typescript-eslint/parser", // Specifies the ESLint parser parserOptions: { ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features sourceType: "module" // Allows for the use of imports }, extends: [ "plugin:@typescript-eslint/recomm...
zsarnett/Custom-Grid-View
109
Custom Drag and Drop Grid for Home Assistant
TypeScript
zsarnett
Zack Barett
.prettierrc.js
JavaScript
module.exports = { semi: true, trailingComma: 'all', singleQuote: true, printWidth: 120, tabWidth: 2, };
zsarnett/Custom-Grid-View
109
Custom Drag and Drop Grid for Home Assistant
TypeScript
zsarnett
Zack Barett
rollup.config.dev.js
JavaScript
import json from '@rollup/plugin-json'; import babel from 'rollup-plugin-babel'; import resolve from 'rollup-plugin-node-resolve'; import serve from 'rollup-plugin-serve'; import { terser } from 'rollup-plugin-terser'; import typescript from 'rollup-plugin-typescript2'; export default { input: ['src/grid-view.ts'], ...
zsarnett/Custom-Grid-View
109
Custom Drag and Drop Grid for Home Assistant
TypeScript
zsarnett
Zack Barett