index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/exit-break/onKeyDownExitBreak.ts | import {
getBlockAbove,
isHotkey,
KeyboardHandlerReturnType,
PlateEditor,
queryNode,
Value,
WithPlatePlugin,
} from '@udecode/plate-common';
import { exitBreak } from './transforms/exitBreak';
import { ExitBreakPlugin } from './types';
export const onKeyDownExitBreak =
<V extends Value = Value, E exte... | 9,100 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/exit-break/types.ts | import { QueryNodeOptions } from '@udecode/plate-common';
export interface ExitBreakRule {
/**
* Hotkey to trigger exit break.
*/
hotkey: string;
/**
* @see {@link QueryNodeOptions}
*/
query?: QueryNodeOptions & {
/**
* When the selection is at the start of the block above.
*/
st... | 9,101 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/end.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>
te
<anchor />
st
<focu... | 9,102 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/invalid-hotkey.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>
test
<cursor />
</hp>
</editor>
) as any;
const event = new KeyboardEvent('k... | 9,103 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/invalid-query.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { ELEMENT_H1 } from '@udecode/plate-heading';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
... | 9,104 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/start-end-not-valid.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>
te
<cursor />
st
</hp>
... | 9,105 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/start.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>
<cursor />
test
</hp>
</edit... | 9,106 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/valid-before.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>
te
<cursor />
st
</hp>
... | 9,107 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/valid.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>
te
<cursor />
st
</hp>
... | 9,108 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/exit-break/__tests__/onKeyDownExitBreak/without-selection.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownExitBreak } from '../../onKeyDownExitBreak';
jsx;
const input = (
<editor>
<hp>test</hp>
</editor>
) as any;
const event = ... | 9,109 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break | petrpan-code/udecode/plate/packages/break/src/exit-break/queries/exitBreakAtEdges.ts | import {
isExpanded,
isSelectionAtBlockEnd,
isSelectionAtBlockStart,
TEditor,
Value,
} from '@udecode/plate-common';
/**
* Check if the selection is at the edge of its parent block.
* If it is and if the selection is expanded, delete its content.
*/
export const exitBreakAtEdges = <V extends Value>(
edi... | 9,110 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break | petrpan-code/udecode/plate/packages/break/src/exit-break/queries/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './exitBreakAtEdges';
| 9,111 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break | petrpan-code/udecode/plate/packages/break/src/exit-break/transforms/exitBreak.ts | import {
ELEMENT_DEFAULT,
getPath,
getPluginType,
insertElements,
PlateEditor,
Value,
} from '@udecode/plate-common';
import { Path } from 'slate';
import { exitBreakAtEdges } from '../queries/exitBreakAtEdges';
import { ExitBreakRule } from '../types';
export const exitBreak = <V extends Value>(
editor... | 9,112 |
0 | petrpan-code/udecode/plate/packages/break/src/exit-break | petrpan-code/udecode/plate/packages/break/src/exit-break/transforms/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './exitBreak';
| 9,113 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/single-line/createSingleLinePlugin.ts | import { createPluginFactory } from '@udecode/plate-common';
import { onKeyDownSingleLine } from './onKeyDownSingleLine';
import { withSingleLine } from './withSingleLine';
export const KEY_SINGLE_LINE = 'singleLine';
/**
* Forces editor to only have one line.
*/
export const createSingleLinePlugin = createPluginF... | 9,114 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/single-line/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './createSingleLinePlugin';
export * from './onKeyDownSingleLine';
export * from './withSingleLine';
| 9,115 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/single-line/onKeyDownSingleLine.ts | import { Hotkeys, KeyboardHandlerReturnType } from '@udecode/plate-common';
export const onKeyDownSingleLine = (): KeyboardHandlerReturnType => (event) => {
if (event.defaultPrevented) return;
if (Hotkeys.isSplitBlock(event)) {
event.preventDefault();
}
};
| 9,116 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/single-line/withSingleLine.ts | import { PlateEditor, removeNodes, Value } from '@udecode/plate-common';
export const withSingleLine = <
V extends Value = Value,
E extends PlateEditor<V> = PlateEditor<V>,
>(
editor: E
) => {
const { normalizeNode } = editor;
editor.insertBreak = () => null;
editor.normalizeNode = (entry) => {
if (e... | 9,117 |
0 | petrpan-code/udecode/plate/packages/break/src/single-line/__tests__ | petrpan-code/udecode/plate/packages/break/src/single-line/__tests__/onKeyDownSingleLine/enter.spec.tsx | /** @jsx jsx */
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownSingleLine } from '../../onKeyDownSingleLine';
jsx;
const input = (
<editor>
<hp>
test
<cursor />
</hp>
</editor>
) as any;
const event = new KeyboardEvent('keydown', { key: 'Enter' }) as any;
const output =... | 9,118 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/soft-break/createSoftBreakPlugin.ts | import { createPluginFactory } from '@udecode/plate-common';
import { onKeyDownSoftBreak } from './onKeyDownSoftBreak';
import { SoftBreakPlugin } from './types';
export const KEY_SOFT_BREAK = 'softBreak';
/**
* Insert soft break following configurable rules.
* Each rule specifies a hotkey and query options.
*/
e... | 9,119 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/soft-break/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './createSoftBreakPlugin';
export * from './onKeyDownSoftBreak';
export * from './types';
| 9,120 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/soft-break/onKeyDownSoftBreak.ts | import {
getBlockAbove,
isHotkey,
KeyboardHandlerReturnType,
PlateEditor,
queryNode,
Value,
WithPlatePlugin,
} from '@udecode/plate-common';
import { SoftBreakPlugin } from './types';
export const onKeyDownSoftBreak =
<V extends Value = Value, E extends PlateEditor<V> = PlateEditor<V>>(
editor: E,... | 9,121 |
0 | petrpan-code/udecode/plate/packages/break/src | petrpan-code/udecode/plate/packages/break/src/soft-break/types.ts | import { QueryNodeOptions } from '@udecode/plate-common';
export interface SoftBreakRule {
hotkey: string;
/**
* Filter the block types where the rule applies.
*/
query?: QueryNodeOptions;
}
export interface SoftBreakPlugin {
rules?: SoftBreakRule[];
}
| 9,122 |
0 | petrpan-code/udecode/plate/packages/break/src/soft-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/soft-break/__tests__/onKeyDownSoftBreak/invalid-hotkey.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownSoftBreak } from '../../onKeyDownSoftBreak';
jsx;
const input = (
<editor>
<hp>
test
<cursor />
</hp>
</editor>
) as any;
const event = new KeyboardEvent('k... | 9,123 |
0 | petrpan-code/udecode/plate/packages/break/src/soft-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/soft-break/__tests__/onKeyDownSoftBreak/invalid-query.spec.tsx | /** @jsx jsx */
import { ELEMENT_CODE_BLOCK } from '@udecode/plate-code-block';
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownSoftBreak } from '../../onKeyDownSoftBreak';
jsx;
const input = (
... | 9,124 |
0 | petrpan-code/udecode/plate/packages/break/src/soft-break/__tests__ | petrpan-code/udecode/plate/packages/break/src/soft-break/__tests__/onKeyDownSoftBreak/valid.spec.tsx | /** @jsx jsx */
import { mockPlugin } from '@udecode/plate-common';
import * as isHotkey from '@udecode/plate-core';
import { jsx } from '@udecode/plate-test-utils';
import { onKeyDownSoftBreak } from '../../onKeyDownSoftBreak';
jsx;
const input = (
<editor>
<hp>
test
<cursor />
</hp>
</edit... | 9,125 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/caption/.npmignore | __tests__
__test-utils__
__mocks__
| 9,126 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/caption/CHANGELOG.md | # @udecode/plate-caption
## 25.0.1
## 25.0.0
## 24.5.2
## 24.4.0
### Minor Changes
- [#2675](https://github.com/udecode/plate/pull/2675) by [@zbeyens](https://github.com/zbeyens) – Support slate-react 0.99.0
## 24.3.6
## 24.3.5
## 24.3.3
### Patch Changes
- [`f47fdba0`](https://github.com/udecode/plate/commi... | 9,127 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/caption/README.md | # Caption
## Documentation
WIP
## License
[MIT](../../LICENSE)
| 9,128 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/caption/package.json | {
"name": "@udecode/plate-caption",
"version": "25.0.1",
"description": "Primitive components for caption.",
"license": "MIT",
"homepage": "https://platejs.org",
"repository": {
"type": "git",
"url": "https://github.com/udecode/plate.git",
"directory": "packages/caption"
},
"bugs": {
"ur... | 9,129 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/caption/tsconfig.json | {
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
}
| 9,130 |
0 | petrpan-code/udecode/plate/packages/caption | petrpan-code/udecode/plate/packages/caption/src/TCaptionElement.ts | import { TDescendant, TElement } from '@udecode/plate-common';
export interface TCaptionElement extends TElement {
caption?: TDescendant[];
}
| 9,131 |
0 | petrpan-code/udecode/plate/packages/caption | petrpan-code/udecode/plate/packages/caption/src/captionGlobalStore.ts | import { createStore, TPath } from '@udecode/plate-common';
export const captionGlobalStore = createStore('caption')({
/**
* When defined, focus end of caption textarea with the same path.
*/
focusEndCaptionPath: null as TPath | null,
/**
* When defined, focus start of caption textarea with the same pa... | 9,132 |
0 | petrpan-code/udecode/plate/packages/caption | petrpan-code/udecode/plate/packages/caption/src/createCaptionPlugin.ts | import { createPluginFactory } from '@udecode/plate-common';
import { onKeyDownCaption } from './onKeyDownCaption';
import { withCaption } from './withCaption';
export interface CaptionPlugin {
/**
* Plugin keys to enable caption.
*/
pluginKeys?: string[];
}
export const KEY_CAPTION = 'caption';
/**
* En... | 9,133 |
0 | petrpan-code/udecode/plate/packages/caption | petrpan-code/udecode/plate/packages/caption/src/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './TCaptionElement';
export * from './captionGlobalStore';
export * from './createCaptionPlugin';
export * from './onKeyDownCaption';
export * from './withCaption';
export * from './components/index';
export * from './hooks/index';
| 9,134 |
0 | petrpan-code/udecode/plate/packages/caption | petrpan-code/udecode/plate/packages/caption/src/onKeyDownCaption.ts | import {
getBlockAbove,
getPluginTypes,
isHotkey,
KeyboardHandler,
} from '@udecode/plate-common';
import { captionGlobalStore } from './captionGlobalStore';
import { CaptionPlugin } from './createCaptionPlugin';
export const onKeyDownCaption: KeyboardHandler<CaptionPlugin> =
(editor, { options }) =>
(e) ... | 9,135 |
0 | petrpan-code/udecode/plate/packages/caption | petrpan-code/udecode/plate/packages/caption/src/withCaption.ts | import {
getAboveNode,
getNodeString,
getPluginTypes,
isCollapsed,
isHotkey,
PlateEditor,
Value,
WithPlatePlugin,
} from '@udecode/plate-common';
import { Range } from 'slate';
import { captionGlobalStore } from './captionGlobalStore';
import { CaptionPlugin } from './createCaptionPlugin';
/**
* TODO... | 9,136 |
0 | petrpan-code/udecode/plate/packages/caption/src | petrpan-code/udecode/plate/packages/caption/src/components/Caption.tsx | import { ComponentPropsWithoutRef } from 'react';
import { createPrimitiveComponent } from '@udecode/plate-common';
import { useReadOnly, useSelected } from 'slate-react';
import { useCaptionString } from '../hooks/useCaptionString';
export interface CaptionOptions {
readOnly?: boolean;
}
export interface CaptionP... | 9,137 |
0 | petrpan-code/udecode/plate/packages/caption/src | petrpan-code/udecode/plate/packages/caption/src/components/CaptionTextarea.tsx | import React, {
RefObject,
useCallback,
useEffect,
useRef,
useState,
} from 'react';
import {
createPrimitiveComponent,
findNodePath,
focusEditor,
getNodeString,
getPointAfter,
isHotkey,
setNodes,
TElement,
useEditorRef,
useElement,
} from '@udecode/plate-common';
import { TextareaAutosize... | 9,138 |
0 | petrpan-code/udecode/plate/packages/caption/src | petrpan-code/udecode/plate/packages/caption/src/components/TextareaAutosize.tsx | import React, { forwardRef, useState } from 'react';
import { useIsomorphicLayoutEffect } from '@udecode/plate-common';
import ReactTextareaAutosize, {
TextareaAutosizeProps,
} from 'react-textarea-autosize';
/**
* `<textarea />` component for React which grows with content.
* @see https://github.com/Andarist/reac... | 9,139 |
0 | petrpan-code/udecode/plate/packages/caption/src | petrpan-code/udecode/plate/packages/caption/src/components/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './Caption';
export * from './CaptionTextarea';
export * from './TextareaAutosize';
| 9,140 |
0 | petrpan-code/udecode/plate/packages/caption/src | petrpan-code/udecode/plate/packages/caption/src/hooks/index.ts | /**
* @file Automatically generated by barrelsby.
*/
export * from './useCaptionString';
| 9,141 |
0 | petrpan-code/udecode/plate/packages/caption/src | petrpan-code/udecode/plate/packages/caption/src/hooks/useCaptionString.ts | import { useMemo } from 'react';
import { getNodeString, useElement } from '@udecode/plate-common';
import { TCaptionElement } from '../TCaptionElement';
export const useCaptionString = () => {
const { caption: nodeCaption = [{ children: [{ text: '' }] }] } =
useElement<TCaptionElement>();
return useMemo(() ... | 9,142 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/cli/CHANGELOG.md | # @udecode/plate-ui
## 24.1.1
### Patch Changes
- [`7b13d52a`](https://github.com/udecode/plate/commit/7b13d52a1de3639098eb19bbb2e2cba26659b988) by [@zbeyens](https://github.com/zbeyens) –
- Fixes #2641
## 24.1.0
### Minor Changes
- [#2642](https://github.com/udecode/plate/pull/2642) by [@zbeyens](https://githu... | 9,143 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/cli/LICENSE | The MIT License (MIT)
Copyright (c) Ziad Beyens, Dylan Schiemann, Joe Anderson, shadcn
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 limitation the rights... | 9,144 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/cli/README.md | # @udecode/plate-ui
A CLI for adding components to your project.
## Usage
Use the `init` command to initialize dependencies for a new project.
The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.js`, and CSS variables for the project.
```bash
npx @udecode/plate-ui@latest init
... | 9,145 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/cli/package.json | {
"name": "@udecode/plate-ui",
"version": "24.1.1",
"description": "Add Plate components to your apps.",
"license": "MIT",
"homepage": "https://platejs.org",
"repository": {
"type": "git",
"url": "https://github.com/udecode/plate.git",
"directory": "packages/cli"
},
"bugs": {
"url": "htt... | 9,146 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/cli/tsconfig.json | {
"extends": "../../config/tsconfig.build.json",
"compilerOptions": {
"declarationDir": "./dist",
"outDir": "./dist"
},
"include": ["src"]
}
| 9,147 |
0 | petrpan-code/udecode/plate/packages | petrpan-code/udecode/plate/packages/cli/tsup.config.ts | import { defineConfig } from 'tsup';
export default defineConfig({
clean: true,
dts: true,
entry: ['src/index.ts'],
format: ['esm'],
sourcemap: true,
target: 'esnext',
outDir: 'dist',
});
| 9,148 |
0 | petrpan-code/udecode/plate/packages/cli | petrpan-code/udecode/plate/packages/cli/src/index.ts | #!/usr/bin/env node
import { Command } from 'commander';
import { add } from './commands/add';
import { diff } from './commands/diff';
import { init } from './commands/init';
import { getPackageInfo } from './utils/get-package-info';
process.on('SIGINT', () => process.exit(0));
process.on('SIGTERM', () => process.exi... | 9,149 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/commands/add.ts | import { existsSync, promises as fs } from 'fs';
import path from 'path';
import chalk from 'chalk';
import { Command } from 'commander';
import { execa } from 'execa';
import ora from 'ora';
import prompts from 'prompts';
import * as z from 'zod';
import { getConfig } from '../utils/get-config';
import { getPackageMa... | 9,150 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/commands/diff.ts | import { existsSync, promises as fs } from 'fs';
import path from 'path';
import chalk from 'chalk';
import { Command } from 'commander';
import { diffLines } from 'diff';
import * as z from 'zod';
import { Config, getConfig } from '../utils/get-config';
import { handleError } from '../utils/handle-error';
import { lo... | 9,151 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/commands/init.ts | /* eslint-disable unicorn/no-process-exit */
import { existsSync, promises as fs } from 'fs';
import path from 'path';
import chalk from 'chalk';
import { Command } from 'commander';
import { execa } from 'execa';
import ora from 'ora';
import prompts from 'prompts';
import * as z from 'zod';
import {
DEFAULT_COMPO... | 9,152 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/get-config.ts | import path from 'path';
import { cosmiconfig } from 'cosmiconfig';
import { loadConfig } from 'tsconfig-paths';
import * as z from 'zod';
import { resolveImport } from './resolve-import';
/**
* This module is primarily concerned with loading and validating a project's
* configuration. It makes use of `cosmiconfig`... | 9,153 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/get-package-info.ts | import path from 'path';
import fs from 'fs-extra';
// eslint-disable-next-line import/no-extraneous-dependencies
import { type PackageJson } from 'type-fest';
/**
* This is a simple utility that reads and returns the contents of your
* project's package.json file.
*/
export function getPackageInfo() {
const pack... | 9,154 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/get-package-manager.ts | import { detect } from '@antfu/ni';
/**
* This script uses `@antfu/ni` to automatically detect the package manager used
* in the current project (yarn, pnpm, or npm).
*/
export async function getPackageManager(
targetDir: string
): Promise<'yarn' | 'pnpm' | 'bun' | 'npm'> {
const packageManager = await detect({... | 9,155 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/get-project-info.ts | import { existsSync } from 'fs';
import path from 'path';
import fs from 'fs-extra';
/**
* This file contains utility functions for retrieving project-level
* information, such as checking if certain directories exist and getting the
* contents of tsconfig.json.
*/
export async function getProjectInfo() {
const ... | 9,156 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/handle-error.ts | /* eslint-disable unicorn/no-process-exit */
import { logger } from './logger';
/**
* This module exports a function for handling errors in a standardized way
* across the project. It logs the error message and then terminates the process
* with a non-zero exit code.
*/
export function handleError(error: unknown) ... | 9,157 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/logger.ts | /* eslint-disable no-console */
import chalk from 'chalk';
/**
* This is a simple logging utility, which wraps console.log and
* prefixes messages with colored severity levels.
* This can be used throughout the project to log informative, warning, error,
* and success messages in a consistent way.
*/
export const... | 9,158 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/resolve-import.ts | import { createMatchPath } from 'tsconfig-paths';
import type { ConfigLoaderSuccessResult } from 'tsconfig-paths';
/**
* This module exports a function that helps to resolve import paths based on
* the configurations provided in tsconfig.json. This could be useful in cases
* where the project is using TypeScript p... | 9,159 |
0 | petrpan-code/udecode/plate/packages/cli/src | petrpan-code/udecode/plate/packages/cli/src/utils/templates.ts | export const UTILS = `import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
`;
export const TAILWIND_CONFIG = `/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ['class'],
content:... | 9,160 |
0 | petrpan-code/udecode/plate/packages/cli/src/utils | petrpan-code/udecode/plate/packages/cli/src/utils/registry/index.ts | /* eslint-disable turbo/no-undeclared-env-vars,no-console */
import path from 'path';
import { HttpsProxyAgent } from 'https-proxy-agent';
import fetch from 'node-fetch';
import * as z from 'zod';
import { Config } from '../get-config';
import {
registryBaseColorSchema,
registryIndexSchema,
registryItemWithCont... | 9,161 |
0 | petrpan-code/udecode/plate/packages/cli/src/utils | petrpan-code/udecode/plate/packages/cli/src/utils/registry/schema.ts | import * as z from 'zod';
// TODO: Extract this to a shared package.
export const registryItemSchema = z.object({
name: z.string(),
dependencies: z.array(z.string()).optional(),
registryDependencies: z.array(z.string()).optional(),
files: z.array(z.string()),
type: z.enum([
'components:plate-ui',
'co... | 9,162 |
0 | petrpan-code/udecode/plate/packages/cli/src/utils | petrpan-code/udecode/plate/packages/cli/src/utils/transformers/index.ts | import { promises as fs } from 'fs';
import { tmpdir } from 'os';
import path from 'path';
import { Project, QuoteKind, ScriptKind } from 'ts-morph';
import * as z from 'zod';
import { Config } from '../get-config';
import { registryBaseColorSchema } from '../registry/schema';
import { transformCssVars } from './trans... | 9,163 |
0 | petrpan-code/udecode/plate/packages/cli/src/utils | petrpan-code/udecode/plate/packages/cli/src/utils/transformers/transform-css-vars.ts | import { SyntaxKind } from 'ts-morph';
import * as z from 'zod';
import { registryBaseColorSchema } from '../registry/schema';
import { Transformer } from '../transformers';
export const transformCssVars: Transformer = async ({
sourceFile,
config,
baseColor,
}) => {
// No transform if using css variables.
i... | 9,164 |
0 | petrpan-code/udecode/plate/packages/cli/src/utils | petrpan-code/udecode/plate/packages/cli/src/utils/transformers/transform-import.ts | import { Transformer } from '.';
export const transformImport: Transformer = async ({ sourceFile, config }) => {
const importDeclarations = sourceFile.getImportDeclarations();
for (const importDeclaration of importDeclarations) {
const moduleSpecifier = importDeclaration.getModuleSpecifierValue();
// Rep... | 9,165 |
0 | petrpan-code/udecode/plate/packages/cli/src/utils | petrpan-code/udecode/plate/packages/cli/src/utils/transformers/transform-rsc.ts | import { SyntaxKind } from 'ts-morph';
import { Transformer } from '.';
export const transformRsc: Transformer = async ({ sourceFile, config }) => {
if (config.rsc) {
return sourceFile;
}
// Remove "use client" from the top of the file.
const first = sourceFile.getFirstChildByKind(SyntaxKind.ExpressionSt... | 9,166 |
0 | petrpan-code/udecode/plate/packages/cli/test | petrpan-code/udecode/plate/packages/cli/test/commands/init.test.ts | import fs from 'fs';
import path from 'path';
import { execa } from 'execa';
import { afterEach, expect, test, vi } from 'vitest';
import { runInit } from '../../src/commands/init';
import { getConfig } from '../../src/utils/get-config';
import * as getPackageManger from '../../src/utils/get-package-manager';
import *... | 9,167 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/colors/neutral.json | {
"inlineColors": {
"light": {
"background": "white",
"foreground": "neutral-950",
"muted": "neutral-100",
"muted-foreground": "neutral-500",
"popover": "white",
"popover-foreground": "neutral-950",
"border": "neutral-200",
"input": "neutral-200",
"card": "whi... | 9,168 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/colors/slate.json | {
"inlineColors": {
"light": {
"background": "white",
"foreground": "slate-950",
"muted": "slate-100",
"muted-foreground": "slate-500",
"popover": "white",
"popover-foreground": "slate-950",
"border": "slate-200",
"input": "slate-200",
"card": "white",
"... | 9,169 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/colors/stone.json | {
"inlineColors": {
"light": {
"background": "white",
"foreground": "stone-950",
"muted": "stone-100",
"muted-foreground": "stone-500",
"popover": "white",
"popover-foreground": "stone-950",
"border": "stone-200",
"input": "stone-200",
"card": "white",
"... | 9,170 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/colors/zinc.json | {
"inlineColors": {
"light": {
"background": "white",
"foreground": "zinc-950",
"muted": "zinc-100",
"muted-foreground": "zinc-500",
"popover": "white",
"popover-foreground": "zinc-950",
"border": "zinc-200",
"input": "zinc-200",
"card": "white",
"card-f... | 9,171 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-full/components.json | {
"style": "new-york",
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "zinc",
"cssVariables": true
},
"rsc": false,
"aliases": {
"utils": "~/lib/utils",
"components": "~/components"
}
}
| 9,172 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-full/package.json | {
"name": "test-cli-config-full",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,173 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-full/tsconfig.json | {
"compilerOptions": {
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolut... | 9,174 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-invalid/components.json | {
"cn": "./components",
"ui": "./ui",
"does-not-exist": "./does-not-exist"
}
| 9,175 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-invalid/package.json | {
"name": "test-cli-config-invalid",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,176 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-none/package.json | {
"name": "test-cli-config-none",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,177 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-partial/components.json | {
"style": "default",
"tailwind": {
"config": "./tailwind.config.ts",
"css": "./src/assets/css/tailwind.css",
"baseColor": "neutral",
"cssVariables": false
},
"aliases": {
"utils": "@/lib/utils",
"components": "@/components"
}
}
| 9,178 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-partial/package.json | {
"name": "test-cli-config-partial",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,179 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/config-partial/tsconfig.json | {
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
| 9,180 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next-src/next.config.js | /** @type {import('next').NextConfig} */
const nextConfig = {};
module.exports = nextConfig;
| 9,181 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next-src/package.json | {
"name": "text-cli-next-src",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
}
}
| 9,182 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next-src/tailwind.config.js | /** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-g... | 9,183 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next-src/tsconfig.json | {
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resol... | 9,184 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures/next-src/src | petrpan-code/udecode/plate/packages/cli/test/fixtures/next-src/src/app/globals.css | @tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-e... | 9,185 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next/next.config.js | /** @type {import('next').NextConfig} */
const nextConfig = {};
module.exports = nextConfig;
| 9,186 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next/package.json | {
"name": "test-cli-next",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@types/node": "20.2.5",
"@types/react": "18.2.7",
"@types/react-dom": "18.2.4",
"autoprefixe... | 9,187 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next/pnpm-lock.yaml | lockfileVersion: "6.0"
| 9,188 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next/tailwind.config.js | /** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ['class'],
content: [
'./pages/**/*.{ts,tsx}',
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
'./src/**/*.{ts,tsx}',
],
theme: {
container: {
center: true,
padding: '2rem',
screens: {
'2x... | 9,189 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/next/tsconfig.json | {
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resol... | 9,190 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures/next | petrpan-code/udecode/plate/packages/cli/test/fixtures/next/app/globals.css | @tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-e... | 9,191 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-bun/package.json | {
"name": "test-cli-project-bun",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,192 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-npm/package-lock.json | {
"name": "test-cli-npm-project",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "npm-project",
"version": "1.0.0",
"license": "MIT"
}
}
}
| 9,193 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-npm/package.json | {
"name": "test-cli-project-npm",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,194 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-pnpm/package.json | {
"name": "test-cli-project-pnpm",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
| 9,195 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-pnpm/pnpm-lock.yaml | lockfileVersion: '6.0'
| 9,196 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-src/components.json | {
"components": "src/components",
"ui": "src/ui",
"styles": "src/styles/main.css",
"utils": "src/lib/cn.ts",
"tailwindConfig": "tailwind.config.ts"
}
| 9,197 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-src/package-lock.json | {
"name": "test-cli-project-src",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "npm-project",
"version": "1.0.0",
"license": "MIT"
}
}
}
| 9,198 |
0 | petrpan-code/udecode/plate/packages/cli/test/fixtures | petrpan-code/udecode/plate/packages/cli/test/fixtures/project-src/package.json | {
"name": "project-src",
"version": "0.1.0",
"private": true
}
| 9,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.