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/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/pages/index.js | // to detect language and automatically redirect to the approprate/[locale] page
import { Redirect } from '../lib/redirect'
export default Redirect
// to keep this root page with the defaultLocale
// import Homepage, { getStaticProps } from './[locale]/index'
// export default Homepage
// export { getStaticProps }
| 8,800 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/pages/second-page.js | // to detect language and automatically redirect to the approprate/[locale] page
import { Redirect } from '../lib/redirect'
export default Redirect
// to keep this root page with the defaultLocale
// import SecondPage, { getStaticProps } from './[locale]/second-page'
// export default SecondPage
// export { getStaticP... | 8,801 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/pages | petrpan-code/i18next/next-i18next/examples/ssg/pages/[locale]/404.js | import { useTranslation } from 'next-i18next'
import { getStaticPaths, makeStaticProps } from '../../lib/getStatic'
import { Header } from '../../components/Header'
import { Footer } from '../../components/Footer'
import Link from '../../components/Link'
const Homepage = () => {
const { t } = useTranslation(['404'... | 8,802 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/pages | petrpan-code/i18next/next-i18next/examples/ssg/pages/[locale]/index.js | import { useTranslation } from 'next-i18next'
import { getStaticPaths, makeStaticProps } from '../../lib/getStatic'
import { Header } from '../../components/Header'
import { Footer } from '../../components/Footer'
import Link from '../../components/Link'
const Homepage = () => {
const { t } = useTranslation(['comm... | 8,803 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/pages | petrpan-code/i18next/next-i18next/examples/ssg/pages/[locale]/second-page.js | import Link from '../../components/Link'
import { useTranslation } from 'next-i18next'
import {
getStaticPaths /*, makeStaticProps*/,
getI18nProps,
} from '../../lib/getStatic'
import { Header } from '../../components/Header'
import { Footer } from '../../components/Footer'
const SecondPage = ({ someOtherData })... | 8,804 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/public/app.css | #__next {
font-family: 'Open Sans', sans-serif;
text-align: center;
background-image: linear-gradient(
to left top,
#ffffff,
#f5f5f5,
#eaeaea,
#e0e0e0,
#d6d6d6
);
display: flex;
flex-direction: column;
margin: 0;
min-height: 100vh;
min-width: 100vw;
}
h1,
h2 {
font-family: '... | 8,805 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/de/404.json | {
"h1": "Die von Ihnen gesuchte Seite ist nicht verfügbar oder gehört nicht zu dieser Website!",
"title": "Seite nicht gefunden"
}
| 8,806 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/de/common.json | {
"back-to-home": "Zurück zur Hauptseite",
"error-with-status": "Auf dem Server ist ein Fehler ({{statusCode}}) aufgetreten",
"error-without-status": "Auf dem Server ist ein Fehler aufgetreten",
"h1": "Ein einfaches Beispiel",
"title": "Hauptseite | next-i18next",
"to-second-page": "Zur zweiten Seite"
}
| 8,807 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/de/footer.json | {
"change-locale": "Sprache wechseln",
"description": "Dies ist eine Nicht-Seitenkomponente, die einen eigenen Namespace erfordert"
}
| 8,808 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/de/second-page.json | {
"h1": "Eine zweite Seite, um das Routing zu demonstrieren",
"title": "Zweite Seite | next-i18next"
}
| 8,809 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/en/404.json | {
"h1": "The page you are looking for is not available or doesn't belong to this website!",
"title": "Page not found"
}
| 8,810 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/en/common.json | {
"back-to-home": "Back to home",
"error-with-status": "A {{statusCode}} error occurred on server",
"error-without-status": "An error occurred on the server",
"h1": "A simple example",
"title": "Home | next-i18next",
"to-second-page": "To second page"
}
| 8,811 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/en/footer.json | {
"change-locale": "Change locale",
"description": "This is a non-page component that requires its own namespace"
}
| 8,812 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/en/second-page.json | {
"h1": "A second page, to demonstrate routing",
"title": "Second page | next-i18next"
}
| 8,813 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/it/404.json | {
"h1": "La pagina che stai cercando non è disponibile o non appartiene a questo sito!",
"title": "Pagina non trovata"
}
| 8,814 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/it/common.json | {
"back-to-home": "Torna alla pagina principale",
"error-with-status": "Sul server si verificato un errore ({{statusCode}})",
"error-without-status": "Sul server si verificato un errore",
"h1": "Un semplice esempio",
"title": "Pagina principale | next-i18next",
"to-second-page": "Vai alla seconda pagina"
}
| 8,815 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/it/footer.json | {
"change-locale": "Cambia lingua",
"description": "Questo è un componente non di pagina che richiede il proprio namespace"
}
| 8,816 |
0 | petrpan-code/i18next/next-i18next/examples/ssg/public/locales | petrpan-code/i18next/next-i18next/examples/ssg/public/locales/it/second-page.json | {
"h1": "Una seconda pagina per dimostrare il routing",
"title": "Seconda pagina | next-i18next"
}
| 8,817 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/appWithTranslation.client.test.tsx | /**
* @jest-environment jsdom
*/
import React from 'react'
import fs from 'fs'
import { screen, render } from '@testing-library/react'
import { I18nextProvider } from 'react-i18next'
import createClient from './createClient'
import { appWithTranslation } from './appWithTranslation'
import { NextRouter } from 'next/... | 8,818 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/appWithTranslation.server.test.tsx | /**
* @jest-environment node
*/
import React from 'react'
import fs from 'fs'
import { I18nextProvider } from 'react-i18next'
import { renderToString } from 'react-dom/server'
import { appWithTranslation } from './appWithTranslation'
import { AppProps } from 'next/app'
jest.mock('fs', () => ({
existsSync: jest.f... | 8,819 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/appWithTranslation.tsx | import React, { useMemo, useRef } from 'react'
import hoistNonReactStatics from 'hoist-non-react-statics'
import { I18nextProvider } from 'react-i18next'
import type { AppProps as NextJsAppProps } from 'next/app'
import { createConfig } from './config/createConfig'
import createClient from './createClient'
import { S... | 8,820 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/index.tsx | export {
I18nContext,
Trans,
Translation,
useTranslation,
withTranslation,
} from 'react-i18next'
export {
appWithTranslation,
globalI18n as i18n,
} from './appWithTranslation'
| 8,821 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/serverSideTranslations.test.tsx | /**
* @jest-environment node
*/
import React from 'react'
import fs from 'fs'
import { SSRConfig, UserConfig } from './types'
import { serverSideTranslations } from './serverSideTranslations'
import { globalI18n } from './appWithTranslation'
import { renderToString } from 'react-dom/server'
import { appWithTranslati... | 8,822 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/serverSideTranslations.ts | import fs from 'fs'
import path from 'path'
import { createConfig } from './config/createConfig'
import createClient from './createClient/node'
import { globalI18n } from './appWithTranslation'
import { UserConfig, SSRConfig } from './types'
import { getFallbackForLng, unique } from './utils'
import { Module, Namesp... | 8,823 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/types.ts | /* tslint:disable no-explicit-any */
import {
I18nContext,
useTranslation,
Trans,
withTranslation,
WithTranslation as ReactI18nextWithTranslation,
Translation,
} from 'react-i18next'
import {
InitOptions,
i18n as I18NextClient,
TFunction as I18NextTFunction,
TypeOptions,
} from 'i18next'
import { ap... | 8,824 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/src/utils.ts | import { FallbackLng, FallbackLngObjList } from 'i18next'
import { useLayoutEffect, useEffect } from 'react'
export const getFallbackForLng = (
lng: string,
fallbackLng: false | FallbackLng
): string[] => {
if (typeof fallbackLng === 'string') {
return [fallbackLng]
}
if (Array.isArray(fallbackLng)) {
... | 8,825 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/config/createConfig.test.ts | import fs from 'fs'
import path from 'path'
import { createConfig } from './createConfig'
import { UserConfig } from '../types'
jest.mock('fs', () => ({
existsSync: jest.fn(),
readdirSync: jest.fn(),
statSync: jest.fn(),
}))
describe('createConfig', () => {
/**
* @jest-environment node
*/
describe('s... | 8,826 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/config/createConfig.ts | import { defaultConfig } from './defaultConfig'
import { InternalConfig, UserConfig } from '../types'
import { getFallbackForLng, unique } from '../utils'
import { FallbackLngObjList, Module } from 'i18next'
const deepMergeObjects = ['backend', 'detection'] as (keyof Pick<
UserConfig,
'backend' | 'detection'
>)[]
... | 8,827 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/config/defaultConfig.ts | const DEFAULT_LOCALE = 'en'
const LOCALES = ['en']
const DEFAULT_NAMESPACE = 'common'
const LOCALE_PATH = './public/locales'
const LOCALE_STRUCTURE = '{{lng}}/{{ns}}'
const LOCALE_EXTENSION = 'json'
export const defaultConfig = {
defaultNS: DEFAULT_NAMESPACE,
errorStackTraceLimit: 0,
i18n: {
defaultLocale: D... | 8,828 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/createClient/browser.test.ts | /**
* @jest-environment jsdom
*/
import createClientBrowser from './browser'
let onPreInitI18nextCalled: any
const config = {
defaultLocale: 'en',
locales: ['en', 'de'],
onPreInitI18next: (i18n: any) => {
onPreInitI18nextCalled = i18n
},
use: [],
} as any
describe('createClientBrowser', () => {
be... | 8,829 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/createClient/browser.ts | import i18n, { Module } from 'i18next'
import {
InternalConfig,
CreateClientReturn,
InitPromise,
I18n,
} from '../types'
export default (config: InternalConfig): CreateClientReturn => {
if (config.ns === undefined) config.ns = []
const instance = i18n.createInstance(config) as I18n
let initPromise: Init... | 8,830 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/createClient/node.test.ts | /**
* @jest-environment node
*/
import createClientNode from './node'
let onPreInitI18nextCalled: any
const config = {
defaultLocale: 'en',
locales: ['en', 'de'],
onPreInitI18next: (i18n: any) => {
onPreInitI18nextCalled = i18n
},
use: [],
} as any
describe('createClientNode', () => {
let client: ... | 8,831 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/createClient/node.ts | import i18n, { Module } from 'i18next'
import i18nextFSBackend from 'i18next-fs-backend'
import {
InternalConfig,
CreateClientReturn,
InitPromise,
I18n,
} from '../types'
let globalInstance: I18n
export default (config: InternalConfig): CreateClientReturn => {
if (config.ns === undefined) config.ns = []
... | 8,832 |
0 | petrpan-code/i18next/next-i18next/src | petrpan-code/i18next/next-i18next/src/createClient/package.json | {
"name": "next-i18next-create-client",
"browser": "./browser.js",
"main": "./node.js"
}
| 8,833 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/.eslintignore | **/node_modules/
**/lib/
**/dist/
**/public/
**/static/
packages/docs/
| 8,834 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/.eslintrc | {
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"react-hooks",
"import"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"settings": {
"react... | 8,835 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/.prettierignore | **/*.md
**/*.svg
**/*.ejs
**/*.html
package.json
.umi
.umi-production
| 8,836 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/.prettierrc | {
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
]
}
| 8,837 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/.travis.yml | #指定运行环境
language: node_js
#指定nodejs版本,可以指定多个
node_js: node
install:
- npm install -g yarn
- yarn install
#运行的脚本命令
after_success:
- bash <(curl -s https://codecov.io/bash)
#指定分支,只有指定的分支提交时才会运行脚本
branches:
only:
- master
| 8,838 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/.umirc.js | import { defineConfig } from 'dumi'
export default defineConfig({
mode: 'site',
title: 'Brick Design',
hash: true,
menus:{
'/guide': [
{
title: '简介',
children: ['guide/index', 'guide/getting-started'],
},
{
title: '基础配置',
children: ['guide/configs','guide/component-schema'],
},
{
... | 8,839 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/LICENSE |
MIT License
Copyright (c) 2020 anye
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
to use, copy, modify, merge, publish, distribute,... | 8,840 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/README.md | <h1 align='center'>Brick Design</h1>
https://user-images.githubusercontent.com/15995127/206958247-d1867643-8706-4172-8a1c-8edeeecaa6b9.MP4
找工作、找工作、找工作 ,有合适岗位的望联系我,坐标北京,谢谢~~~
## 描述
新版本正在开发中》》》》》》》》》》
### 快捷键
>command/control+"+" 放大
>
>command/control+"-" 缩小
>
>command/control+U 全局查看与窗口查看切换
>
>command/c... | 8,841 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/babel.config.js | module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
browsers: ['>0.25%, not dead'],
},
},
],
'@babel/preset-typescript',
],
plugins: [
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
],
}
| 8,842 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/commitlint.config.js | module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
// 72 is too constricting, especially with a required subject
'header-max-length': [2, 'always', '120'],
},
};
// config-conventional defines the following subjects:
// 'build',
// 'chore',
// 'ci',
// 'docs',
// 'feat',
// 'fix',
// 'per... | 8,843 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/lerna.json | {
"npmClient": "yarn",
"version": "1.0.0-alpha.17",
"useWorkspaces": true,
"packages": [
"packages/*",
"examples/*"
]
}
| 8,844 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/package.json | {
"name": "root",
"private": true,
"author": "anye931123 <1278998669@qq.com> (https://github.com/anye931123)",
"repository": {
"type": "git",
"url": "https://github.com/brick-design/brick-design.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"keywords": [
"react"... | 8,845 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/tsconfig.base.json | {
"compilerOptions": {
"incremental": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"lib": [
"esnext",
"dom"
],
"strict": false,
"experimentalDecorators": true,
"noUnusedLocals": true,
"jsx": "react",
"forceConsistentCasingInFileNames... | 8,846 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/tsconfig.jest.json | {
"extends": "./tsconfig.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowJs": true
}
}
| 8,847 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/tsconfig.json | {
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"allowSyntheticDefaultImports": true,
"paths": {
"@brickd/canvas": [
"packages/canvas/src/index"
],
"@brickd/canvas/*": [
"packages/canvas/src/*"
],
"@brickd/core": [
"packages... | 8,848 |
0 | petrpan-code/brick-design | petrpan-code/brick-design/brick-design/yarn.lock | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@ant-design/colors@^3.1.0":
version "3.2.2"
resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-3.2.2.tgz#5ad43d619e911f3488ebac303d606e66a8423903"
integrity sha512-YKgNbG2dlzqMhA9NtI3/pbY16m3Yl/EeWBRa+lB1X1YaYxH... | 8,849 |
0 | petrpan-code/brick-design/brick-design | petrpan-code/brick-design/brick-design/docs/index.md | ---
title: Brick Design - 全场景自然流布局页面编辑器
order: 10
hero:
title: Brick Design
desc: 全场景自然流布局页面编辑器
actions:
- text: 快速上手
link: /guide/getting-started
features:
- icon: https://gw.alipayobjects.com/zos/bmw-prod/881dc458-f20b-407b-947a-95104b5ec82b/k79dm8ih_w144_h144.png
title: 简单集成
desc: 简单的组件调用式集... | 8,850 |
0 | petrpan-code/brick-design/brick-design/docs | petrpan-code/brick-design/brick-design/docs/guide/component-schema.md | ---
title: 组件的配置介绍
order: 9
nav:
order: 10
---
### 介绍
为了让编辑器识别组件与组件的特性,需要将组件特性抽象成相应的对象。
以下为Ant Design中Layout组件的标准配置对象。
Layout.ts
```ts
import {ComponentSchemaType,NODE_PROPS_TYPES,PROPS_TYPES} from '@brickd/react'
const Layout: ComponentSchemaType = {
propsConfig: {
hasSider: {
label: '子元素是否有sider',
tip... | 8,851 |
0 | petrpan-code/brick-design/brick-design/docs | petrpan-code/brick-design/brick-design/docs/guide/configs.md | ---
title: 全局总配置
order: 9
nav:
order: 10
---
### 介绍
全局总配置供brick design各个功能组件全局使用,包括组件配置集合、组件集合、warn回调、以及容器组件集合。
```ts
import * as Ants from 'antd/es'
import componentSchemas from './componentSchemas'
import { ConfigType } from '@brickd/react'
/**
* 设计面板iframe 模板,如果集成到项目中,需要将拖拽组件所依赖的样式在模板中设置,
* 否则设计面板渲染的页面将是无样式的效果... | 8,852 |
0 | petrpan-code/brick-design/brick-design/docs | petrpan-code/brick-design/brick-design/docs/guide/getting-started.md | ---
title: 快速上手
order: 9
nav:
order: 10
---
### 安装组件
```bash
yarn add @brickd/react @brickd/components @brickd/render
```
OR
```bash
npm install @brickd/react @brickd/components @brickd/render
```
目前主要是三个库,其中核心库是@brickd/react库,该库包含了brick design的所有能力与功能。剩下的两个库算是扩展库,components实现了预览版面板组件、属性配置面板组件、样式配置面板组件,可以说是一个功能组件库集... | 8,853 |
0 | petrpan-code/brick-design/brick-design/docs | petrpan-code/brick-design/brick-design/docs/guide/index.md | ---
title: 介绍
nav:
title: 指南
order: 1
---
### 什么是 brick design?
是一款开源的,基于自然流布局设计,支持多维组件拖拽嵌套组合所见即所得的H5编辑器。组件就像高楼大厦中的每一块砖,它是建设复杂炫酷页面的基础。brick design 赋予了组件很多实用的能力,让你编辑页面更简单。
##### 什么是自然流布局?
自然流布局我认为组件之间根据CSS布局样式约束展现的布局模式,涵盖了CSS的所有布局模式,自然流布局可以让你在编辑页面时像是在写页面代码一样完成页面的编辑,自然流布局赋予了brick design更多可能性,也是brick design与其他页面编辑... | 8,854 |
0 | petrpan-code/brick-design/brick-design/docs/guide | petrpan-code/brick-design/brick-design/docs/guide/types/ComponentSchemaTypes.md | ---
title: ComponentSchemaType
order: 9
nav:
order: 10
---
### 定义
```ts
interface ComponentSchemaType {
isNonContainer?:boolen
childNodesRule?: string[]
fatherNodesRule?: string[]
nodePropsConfig?: NodePropsConfigType
mirrorModalField?: MirrorModalFieldType
propsConfig: PropsConfigType
isRequired?: bool... | 8,855 |
0 | petrpan-code/brick-design/brick-design/docs/guide | petrpan-code/brick-design/brick-design/docs/guide/types/ConfigType.md | ---
title: ConfigType
order: 9
nav:
order: 10
---
定义
```ts
interface ConfigType {
componentsMap: ComponentsMapType //所有的React原始组件
//所有的组件配置汇总
componentSchemasMap: ComponentSchemasMapType
}
```
### componentsMap
所有React原始组件集合,主要供预览与页面编辑区识别并获取组件
##### ComponentsMapType
定义
```ts
interface ComponentsMapType {
... | 8,856 |
0 | petrpan-code/brick-design/brick-design/docs | petrpan-code/brick-design/brick-design/docs/react/getting-started.md | ---
title: 快速上手
order: 9
nav:
order: 10
---
### 安装组件
```bash
yarn add @brickd/react
```
OR
```bash
npm install @brickd/react
```
## 在项目中使用
```jsx | pure
import {createElement} from 'react';
import {BrickDesign,BrickTree,BrickProvider,useSelector,createActions} from '@brickd/react';
const plugins=[(vDom,componentConf... | 8,857 |
0 | petrpan-code/brick-design/brick-design/docs | petrpan-code/brick-design/brick-design/docs/react/index.md | ---
title: 介绍
order: 9
nav:
order: 10
---
### 介绍
@brickd/react 主要包含了,编辑区域的所有功能,以及core库的所有api输出,是整个brick design的核心。
### 预览
<img src="../assets/brick-design.gif"/>
| 8,858 |
0 | petrpan-code/brick-design/brick-design/docs/react | petrpan-code/brick-design/brick-design/docs/react/api/functions.md | ---
title: 功能方法
order: 9
nav:
order: 10
---
### createTemplate(state)
生成模板,当在页面编辑区选中任意个组件,执行这个方法会就会生成模板,模板也可以叫模板组件,可以像组件一样拖拽添加。
返回值为对象包含模板配置信息以及自定义模板属性配置信息。
返回值属性如下
| 属性 | 类型 | 描述 |
| ----- | ------ | ------------ |
| templateConfigs | object | 模板配置信息 |
| templatePropsConfigSheet | object | 模板属性配置信息|
... | 8,859 |
0 | petrpan-code/brick-design/brick-design/docs/react | petrpan-code/brick-design/brick-design/docs/react/api/state.md | ---
title: state相关
order: 9
nav:
order: 10
---
### createAction({type,payload})
createAction 生成一个redux action 并触发。如果你在BrickProvider写了自定义的reducer那么你就需要使用createAction来触发你的reducer,
该方法必须返回state。方法参数为action对象。
| 属性 | 类型 | 描述 |
| ----- | ------ | ------------ |
| type | string | action type用户区分action |
| pay... | 8,860 |
0 | petrpan-code/brick-design/brick-design/docs/react | petrpan-code/brick-design/brick-design/docs/react/components/BrickDesign.md | ---
title: BrickTree
order: 9
nav:
order: 10
---
### 介绍
BrickTree作为brick design 编辑器的组件树,同时也展示了页面的结构,如果页面编辑不方便的话,可以通过修改一组件树结构来实现想要的效果,
BrickTree与BrickDesign是实时同步的,并且同样支持增、删、改,支持跨组件拖拽更改顺序等功能。
### 属性
#### className
className 目前只有这一个属性,作用在组件树的最外层div上。
| 8,861 |
0 | petrpan-code/brick-design/brick-design/docs/react | petrpan-code/brick-design/brick-design/docs/react/components/BrickProvider.md | ---
title: BrickProvider
order: 9
nav:
order: 10
---
### 介绍
BrickProvider作为brick design 编辑器的根组件,将处理好的状态,传到给所有需要的组件。
### 属性
#### initState
initState 初始化页面非必填。
| 属性 | 类型 | 描述 |
| ----- | ------ | ------------ |
| componentConfigs | object | 页面配置信息 |
#### customReducer(state,action)
customReducer 自定义... | 8,862 |
0 | petrpan-code/brick-design/brick-design/docs/react | petrpan-code/brick-design/brick-design/docs/react/components/BrickTree.md | ---
title: BrickDesign
order: 9
nav:
order: 10
---
### 介绍
BrickDesign作为brick design 编辑器的核心组件,也就是画板或者页面编辑组件,包含页面编辑,实时预览、辅助线、拖拽大小、拖拽嵌套等功能。
依赖于BrickProvider,所以应该作为BrickProvider的子组件或者子孙组件使用。
### 属性
#### onLoadEnd()
onLoadEnd iframe的加载完毕方法,也标明BrickDesign加载完毕可以进编辑等操作,如果你需要在BrickDesign加载完毕后做一些其他事情,请在这里处理。
| 8,863 |
0 | petrpan-code/brick-design/brick-design/examples | petrpan-code/brick-design/brick-design/examples/react-example/README.md | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will ... | 8,864 |
0 | petrpan-code/brick-design/brick-design/examples | petrpan-code/brick-design/brick-design/examples/react-example/package.json | {
"name": "brickd-example",
"version": "1.0.0-alpha.16",
"private": true,
"homepage": "https://github.com/brick-design/brick-design",
"dependencies": {
"@brickd/canvas": "^1.0.0-alpha.16",
"@brickd/components": "^1.0.0-alpha.16",
"@brickd/render": "^1.0.0-alpha.16",
"animate.css": "^3.7.2",
... | 8,865 |
0 | petrpan-code/brick-design/brick-design/examples | petrpan-code/brick-design/brick-design/examples/react-example/tsconfig.json | {
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"jsx": "react",
"esModuleInterop": true,
"sourceMap": true,
"baseUrl": "./",
"strict": true,
"paths": {
"@/*": ["src/*"]
},
"allowSyntheticDefaultImpo... | 8,866 |
0 | petrpan-code/brick-design/brick-design/examples | petrpan-code/brick-design/brick-design/examples/react-example/typings.d.ts | declare module '*.less'
declare module '*.png'
declare module '*.jpg'
declare module '*.json'
| 8,867 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/env.js | 'use strict'
const fs = require('fs')
const path = require('path')
const paths = require('./paths')
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')]
const NODE_ENV = process.env.NODE_ENV
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV env... | 8,868 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/getHttpsConfig.js | 'use strict'
const fs = require('fs')
const path = require('path')
const crypto = require('crypto')
const chalk = require('react-dev-utils/chalk')
const paths = require('./paths')
// Ensure the certificate and key provided are valid and if not
// throw an easy to debug error
function validateKeyAndCerts({ cert, key, ... | 8,869 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/modules.js | 'use strict'
const fs = require('fs')
const path = require('path')
const paths = require('./paths')
const chalk = require('react-dev-utils/chalk')
const resolve = require('resolve')
/**
* Get additional module paths based on the baseUrl of a compilerOptions object.
*
* @param {Object} options
*/
function getAddit... | 8,870 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/paths.js | 'use strict'
const path = require('path')
const fs = require('fs')
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath')
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebook/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd())
const... | 8,871 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/pnpTs.js | 'use strict'
const { resolveModuleName } = require('ts-pnp')
exports.resolveModuleName = (
typescript,
moduleName,
containingFile,
compilerOptions,
resolutionHost,
) => {
return resolveModuleName(
moduleName,
containingFile,
compilerOptions,
resolutionHost,
typescript.resolveModuleName,
)
}
exports.... | 8,872 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/webpack.config.js |
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const resolve = require('resolve')
const PnpWebpackPlugin = require('pnp-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
co... | 8,873 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/config/webpackDevServer.config.js | 'use strict'
const fs = require('fs')
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware')
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware')
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware')
const ignoredFiles = requi... | 8,874 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/config | petrpan-code/brick-design/brick-design/examples/react-example/config/jest/babelTransform.js | 'use strict';
const babelJest = require('babel-jest').default;
const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
return false;
}
try {
require.resolve('react/jsx-runtime');
return true;
} catch (e) {
return false;
}
})();
module.exports = babelJest.crea... | 8,875 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/config | petrpan-code/brick-design/brick-design/examples/react-example/config/jest/cssTransform.js | 'use strict'
// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process() {
return 'module.exports = {};'
},
getCacheKey() {
// The output is always the same.
return 'cssTransform'
},
}
| 8,876 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/config | petrpan-code/brick-design/brick-design/examples/react-example/config/jest/fileTransform.js | 'use strict'
const path = require('path')
const camelcase = require('camelcase')
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {
const assetFilename = JSON.stringify(path.basename(filename)... | 8,877 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/config/webpack | petrpan-code/brick-design/brick-design/examples/react-example/config/webpack/persistentCache/createEnvironmentHash.js | 'use strict';
const { createHash } = require('crypto');
module.exports = env => {
const hash = createHash('md5');
hash.update(JSON.stringify(env));
return hash.digest('hex');
};
| 8,878 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/public/index.html | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1.0, maximum-scale=1.0,user-scalable=0" />
<meta name="theme-color" content="#000000" />
<meta
name="descrip... | 8,879 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/public/manifest.json | {
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
... | 8,880 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/public/robots.txt | # https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
| 8,881 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/scripts/build.js | 'use strict'
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production'
process.env.NODE_ENV = 'production'
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// te... | 8,882 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/scripts/start.js | 'use strict'
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development'
process.env.NODE_ENV = 'development'
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// ... | 8,883 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/scripts/test.js | 'use strict'
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test'
process.env.NODE_ENV = 'test'
process.env.PUBLIC_URL = ''
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not ha... | 8,884 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/App.tsx | import React from 'react'
import 'antd/dist/antd.css'
import 'animate.css/animate.min.css'
import config, { CONTAINER_CATEGORY } from './configs'
import initData from './xiaomi'
import { BrickEdifice } from '@brickd/components'
export default function App() {
return (<BrickEdifice
componentsCategory={CONTAINER_CA... | 8,885 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/Demo.tsx | import React from 'react'
import styles from './index.less';
interface DemoProps extends React.HTMLProps<HTMLDivElement>{
subClassName0?:string
subClassName1?:string
}
function Demo(props:DemoProps){
const {className,subClassName0,subClassName1,...rest}=props
return <div className={`${styles['demo-container']} ${c... | 8,886 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/PreviewPanel.tsx | import React from 'react'
import styles from './index.less'
import { useSelector } from '@brickd/canvas'
import {BrickRender} from '@brickd/render'
import config from './configs'
export default function PreviewPanel() {
const { platformInfo,pageConfig } = useSelector(['platformInfo','pageConfig'])
const { size } = p... | 8,887 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/global.less | @content-height: calc(100vh - 120px);
.rotate180 {
transform: rotate(180deg);
}
.rotate90 {
transform: rotate(90deg);
}
.dnd-container {
border: 0;
width: 100%;
height: 100%;
}
.browser-mockup {
display: flex;
flex:1;
position: relative;
border-radius: 3px 3px 0 0;
-webkit-box-shadow: 0 0.1em 0.5em 0 rgba(... | 8,888 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/index.less | @import 'global';
.wrapper {
background: rgb(247,247,247);
display: flex;
flex-direction: column;
box-shadow: 2px 0 4px 0 rgba(174, 174, 174, 0.5);
}
.content {
display: flex;
flex: 1;
flex-direction: row;
}
.left-preview {
height: 100vh;
overflow-x: hidden;
background: #00000000;
}
.props-shadow {
overf... | 8,889 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/index.tsx | import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
ReactDOM.render(<App />, document.getElementById('root'))
| 8,890 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/initData.ts | import { PageConfigType } from '@brickd/core'
const images=[
'https://t7.baidu.com/it/u=3435942975,1552946865&fm=193&f=GIF',
'https://t7.baidu.com/it/u=2621658848,3952322712&fm=193&f=GIF',
'https://t7.baidu.com/it/u=1415984692,3889465312&fm=193&f=GIF',
'https://t7.baidu.com/it/u=4080826490,615918710&fm=193&f=GIF',... | 8,891 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/xiaomi.ts | import { PageConfigType } from '@brickd/core'
import { borderColors, guides, headerData, ProductData, seckillResult, users } from './xiaomiData'
import styles from './global.less'
const banner = [
'https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/c7fd00fa846cefaaa73572ea55832854.jpg?w=2452&h=920',
'https://cdn.cnbj1.fds... | 8,892 |
0 | petrpan-code/brick-design/brick-design/examples/react-example | petrpan-code/brick-design/brick-design/examples/react-example/src/xiaomiData.ts | import {chunk} from 'lodash';
const product = [{
'product_id': 1,
'product_name': 'Redmi K30',
'category_id': 1,
'product_title': '120Hz流速屏,全速热爱',
'product_intro': '120Hz高帧率流速屏/ 索尼6400万前后六摄 / 6.67\'小孔径全面屏 / 最高可选8GB+256GB大存储 / 高通骁龙730G处理器 / 3D四曲面玻璃机身 / 4500mAh+27W快充 / 多功能NFC',
'product_picture': 'https://cdn.cnbj1... | 8,893 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/src | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/index.ts | import { reactContainers } from './reactCategory'
import * as Ants from 'antd/es'
import componentSchemas from './componentSchemas'
import { ConfigType } from '@brickd/canvas'
import Demo from '../Demo'
/**
* 容器组件分类
*/
export const CONTAINER_CATEGORY = { ...reactContainers, HTMLTag: {
div: null,
a: null,
span: ... | 8,894 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/src | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/reactCategory.ts | import { CategoryType } from '@brickd/components'
// @ts-ignore
export const reactContainers: any = {
Layout: {
Layout:[{props:{
style: {
height: '100%',
width:'100%',
}}}],
'Layout.Header': [{
props:{
style: {
height: 50,
},
}
}],
'Layout.Footer': [{
props: {
style... | 8,895 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/src/configs | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas/index.ts | import * as HTML from './HTML'
import Ant from './Ant'
import Demo from './Demos/Demo'
export default {
...HTML,
...Ant,
Demo
}
| 8,896 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas/Ant/Affix.ts | import { ComponentSchemaType, PROPS_TYPES } from '@brickd/canvas'
const Affix: ComponentSchemaType = {
propsConfig: {
offsetBottom: {
label: '达到偏移量后触发',
tip: '距离窗口底部达到指定偏移量后触发',
type: PROPS_TYPES.number,
},
offsetTop: {
label: '达到偏移量后触发',
tip: '距离窗口顶部达到指定偏移量后触发',
type: PROPS_TYPES.number,
},... | 8,897 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas/Ant/Alert.ts | import { ComponentSchemaType, PROPS_TYPES } from '@brickd/canvas'
const Alert: ComponentSchemaType = {
propsConfig: {
message: {
label: '警告提示内容',
type: PROPS_TYPES.string,
rules: [
{
required: true,
message: '请输入提示信息',
},
],
},
showIcon: {
label: '是否显示辅助图标',
type: PROPS_TYPES... | 8,898 |
0 | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas | petrpan-code/brick-design/brick-design/examples/react-example/src/configs/componentSchemas/Ant/Anchor.ts | import {
ComponentSchemaType,
NODE_PROPS_TYPES,
PROPS_TYPES,
} from '@brickd/canvas'
const Anchor: ComponentSchemaType = {
nodePropsConfig: {
children: {
type: NODE_PROPS_TYPES.reactNode,
childNodesRule: ['Anchor.Link'],
},
},
propsConfig: {
affix: {
label: '固定模式',
type: PROPS_TYPES.boolean,
... | 8,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.