Skip to content

Commit

Permalink
feat(@react-ui/core): add initial setting for @react-ui/core package
Browse files Browse the repository at this point in the history
  • Loading branch information
vigor-13 committed Dec 3, 2023
1 parent 2e4d450 commit b5c907d
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/ui/react/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
extends: ['custom/typescript'],
ignorePatterns: [],
ignorePatterns: ['babel.config.js'],
};
19 changes: 19 additions & 0 deletions packages/ui/react/core/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styleXPlugin from '@stylexjs/babel-plugin';

const config = {
plugins: [
[
styleXPlugin,
{
dev: true,
test: false,
unstable_moduleResolution: {
type: 'commonJS',
rootDir: __dirname,
},
},
],
],
};

export default config;
11 changes: 11 additions & 0 deletions packages/ui/react/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@
"lint": "eslint .",
"clean": ""
},
"peerDependencies": {
"react": ">=18"
},
"devDependencies": {
"@storybook/react": "^7.6.0",
"@stylexjs/babel-plugin": "0.2.0-beta.27",
"@types/react": "^18.2.39",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*"
},
"dependencies": {
"@stylexjs/shared": "0.1.0-beta.1",
"@stylexjs/stylex": "0.2.0-beta.27",
"react": "^18.2.0"
}
}
20 changes: 20 additions & 0 deletions packages/ui/react/core/src/core/core.factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { type DOMElements } from '../utils';
import { styled } from './core.styled';

class VigorFactory {
private readonly _cache = new Map<DOMElements, DOMElements>();

public init = (): any => {
return new Proxy(styled, {
get: (_, element: DOMElements) => {
if (!this._cache.has(element)) this._cache.set(element, element);

return this._cache.get(element);
},
});
};
}

const vigorFactory = new VigorFactory();

export const vigor = vigorFactory.init();
1 change: 1 addition & 0 deletions packages/ui/react/core/src/core/core.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function styled(): void {}
1 change: 1 addition & 0 deletions packages/ui/react/core/src/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './core.factory';
2 changes: 1 addition & 1 deletion packages/ui/react/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log('sdf');
export * from './core';
13 changes: 13 additions & 0 deletions packages/ui/react/core/src/stories/core.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { type Meta } from '@storybook/react';
import { vigor } from '../core';

const meta: Meta = {
title: 'React UI Component/Core',
tags: ['autodocs'],
};

export const RenderElement = (): any => (
<vigor.p>The mind is everything. What we think, we become.</vigor.p>
);

export default meta;
5 changes: 5 additions & 0 deletions packages/ui/react/core/src/stories/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Meta } from '@storybook/blocks';

<Meta title="React UI Component/Overview" />

작업중...
1 change: 1 addition & 0 deletions packages/ui/react/core/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './util.dom.type';
1 change: 1 addition & 0 deletions packages/ui/react/core/src/utils/util.dom.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type DOMElements = keyof JSX.IntrinsicElements;
2 changes: 1 addition & 1 deletion packages/ui/react/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"display": "React UI Tsocnfig",
"extends": "tsconfig/tsconfig.node.json",
"extends": "tsconfig/tsconfig.react.json",
"exclude": ["node_modules", "dist"],
"compilerOptions": {
"outDir": "dist"
Expand Down
75 changes: 70 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b5c907d

Please sign in to comment.