├── .nvmrc
├── .watchmanconfig
├── example
├── App.js
├── assets
│ ├── icon.png
│ ├── favicon.png
│ ├── splash.png
│ └── adaptive-icon.png
├── babel.config.js
├── metro.config.js
├── package.json
├── app.json
└── src
│ └── App.jsx
├── src
├── __tests__
│ └── index.test.tsx
├── types
│ ├── border.ts
│ ├── typography.ts
│ ├── flexbox.ts
│ ├── effects.ts
│ ├── layout.ts
│ └── spacing.ts
├── layout
│ ├── overflow.ts
│ ├── display.ts
│ ├── z-index.ts
│ ├── direction.ts
│ ├── object-fit.ts
│ ├── aspect.ts
│ └── position.ts
├── flexbox
│ ├── justify.ts
│ ├── place.ts
│ ├── align.ts
│ └── flex.ts
├── index.ts
├── sizing
│ ├── size.ts
│ ├── w.ts
│ └── h.ts
├── typography
│ ├── decoration.ts
│ └── text.ts
├── shadow
│ └── shadow.ts
├── effects
│ └── fx.ts
├── spacing
│ ├── margin.ts
│ └── padding.ts
├── utils
│ └── colorList.ts
└── border
│ └── bdr.ts
├── .gitattributes
├── assets
├── logo.png
├── main-branch.jpg
├── update-branch.png
├── badges
│ ├── kofi.svg
│ ├── patreon.svg
│ └── paypal.svg
└── display-name.svg
├── tsconfig.build.json
├── babel.config.js
├── .prettierrc
├── lefthook.yml
├── .editorconfig
├── .eslintignore
├── .prettierignore
├── bob.config.js
├── .eslintrc.json
├── .github
├── workflows
│ ├── labeler.yml
│ ├── issues.yml
│ ├── stale.yml
│ └── ci.yml
├── labeler.yml
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── bug_report.md
│ └── enhancement.md
├── actions
│ └── setup
│ │ └── action.yml
└── PULL_REQUEST_TEMPLATE.md
├── tsconfig.json
├── LICENSE.md
├── .gitignore
├── README.md
├── CONTRIBUTING.md
├── package.json
└── CODE_OF_CONDUCT.md
/.nvmrc:
--------------------------------------------------------------------------------
1 | v18
2 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/example/App.js:
--------------------------------------------------------------------------------
1 | export { default } from './src/App';
2 |
--------------------------------------------------------------------------------
/src/__tests__/index.test.tsx:
--------------------------------------------------------------------------------
1 | it.todo('write a test');
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 | # specific for windows script files
3 | *.bat text eol=crlf
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/assets/logo.png
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "exclude": ["example", "lib"]
4 | }
5 |
--------------------------------------------------------------------------------
/assets/main-branch.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/assets/main-branch.jpg
--------------------------------------------------------------------------------
/assets/update-branch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/assets/update-branch.png
--------------------------------------------------------------------------------
/example/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/example/assets/icon.png
--------------------------------------------------------------------------------
/example/assets/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/example/assets/favicon.png
--------------------------------------------------------------------------------
/example/assets/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/example/assets/splash.png
--------------------------------------------------------------------------------
/example/assets/adaptive-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nativeflowteam/nativeflowcss/HEAD/example/assets/adaptive-icon.png
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | ['module:react-native-builder-bob/babel-preset', { modules: 'commonjs' }],
4 | ],
5 | };
6 |
--------------------------------------------------------------------------------
/src/types/border.ts:
--------------------------------------------------------------------------------
1 | import type { TextStyle } from 'react-native';
2 |
3 | export interface BorderStyles {
4 | [key: string]: TextStyle | ((...args: any[]) => TextStyle);
5 | }
6 |
--------------------------------------------------------------------------------
/src/types/typography.ts:
--------------------------------------------------------------------------------
1 | import type { TextStyle } from 'react-native';
2 |
3 | export interface ColuredTextStyle {
4 | [key: string]: TextStyle | ((...args: any[]) => TextStyle);
5 | }
6 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "quoteProps": "consistent",
3 | "singleQuote": true,
4 | "tabWidth": 2,
5 | "trailingComma": "es5",
6 | "useTabs": false,
7 | "endOfLine": "auto",
8 | "semi": true
9 | }
10 |
--------------------------------------------------------------------------------
/src/layout/overflow.ts:
--------------------------------------------------------------------------------
1 | const overflow = {
2 | visible: { overflow: 'visible' },
3 | hidden: { overflow: 'hidden' },
4 | };
5 |
6 | // Example usage
7 | // console.log(overflow.visible); // { overflow: 'visible' }
8 | // console.log(overflow.hidden); // { overflow: 'hidden' }
9 |
10 | export default overflow;
11 |
--------------------------------------------------------------------------------
/src/types/flexbox.ts:
--------------------------------------------------------------------------------
1 | export type Flex = {
2 | flex?: number;
3 | gap?: number;
4 | flexWrap?: string;
5 | alignContent?: string;
6 | alignSelf?: string;
7 | flexDirection?: string;
8 | flexGrow?: number;
9 | flexShrink?: number;
10 | flexBasis?: number | 'auto';
11 | rowGap?: number;
12 | columnGap?: number;
13 | };
14 |
--------------------------------------------------------------------------------
/lefthook.yml:
--------------------------------------------------------------------------------
1 | pre-commit:
2 | parallel: true
3 | commands:
4 | lint:
5 | glob: '*.{js,ts,jsx,tsx}'
6 | run: npx eslint {staged_files}
7 | types:
8 | glob: '*.{js,ts, jsx, tsx}'
9 | run: npx tsc
10 | commit-msg:
11 | parallel: true
12 | commands:
13 | commitlint:
14 | run: npx commitlint --edit
15 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 |
9 | indent_style = space
10 | indent_size = 2
11 |
12 | end_of_line = lf
13 | charset = utf-8
14 | trim_trailing_whitespace = true
15 | insert_final_newline = true
16 |
--------------------------------------------------------------------------------
/src/types/effects.ts:
--------------------------------------------------------------------------------
1 | import type { ViewStyle, ImageStyle } from 'react-native';
2 |
3 | export interface BgStyles {
4 | [key: string]:
5 | | ViewStyle
6 | | ImageStyle
7 | | ((...args: any[]) => ViewStyle | ImageStyle);
8 | }
9 |
10 | export interface ShadowStyles {
11 | [key: string]: ViewStyle | ((...args: any[]) => ViewStyle);
12 | }
13 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | #node.js
2 | node_modules/
3 | lib/
4 | package-lock.json
5 | package.json
6 |
7 | #example
8 | example/
9 |
10 | # ci-cd
11 | workflows/
12 | lefthook.yml
13 |
14 | #config
15 | .editorconfig
16 | .eslintignore
17 | .eslintrc.json
18 | .gitattributes
19 | .gitignore
20 | .prettierrc
21 | .watchmanconfig
22 | .yarnrc.yml
23 | babel.config.js
24 | bob.config.js
25 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | #node.js
2 | node_modules/
3 | lib/
4 | package-lock.json
5 | package.json
6 |
7 | #example
8 | example/
9 |
10 | # ci-cd
11 | workflows/
12 | lefthook.yml
13 |
14 | #config
15 | .editorconfig
16 | .eslintignore
17 | .eslintrc.json
18 | .gitattributes
19 | .gitignore
20 | .prettierrc
21 | .watchmanconfig
22 | .yarnrc.yml
23 | babel.config.js
24 | bob.config.js
25 |
--------------------------------------------------------------------------------
/src/layout/display.ts:
--------------------------------------------------------------------------------
1 | import type { Display } from '../types/layout';
2 |
3 | const display: { [key: string]: Display } = {
4 | hidden: { display: 'none' },
5 | flex: { display: 'flex' },
6 | };
7 |
8 | // Example usage
9 | // const hiddenDisplay = display.hidden; // { display: 'none' }
10 | // const flexDisplay = display.flex; // { display: 'flex' }
11 |
12 | export default display;
13 |
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const { getConfig } = require('react-native-builder-bob/babel-config');
3 | const pkg = require('../package.json');
4 |
5 | const root = path.resolve(__dirname, '..');
6 |
7 | module.exports = function (api) {
8 | api.cache(true);
9 |
10 | return getConfig(
11 | {
12 | presets: ['babel-preset-expo'],
13 | },
14 | { root, pkg }
15 | );
16 | };
17 |
--------------------------------------------------------------------------------
/bob.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | source: 'src',
3 | output: 'lib',
4 | targets: [
5 | [
6 | 'commonjs',
7 | {
8 | esm: true,
9 | },
10 | ],
11 | [
12 | 'module',
13 | {
14 | esm: true,
15 | },
16 | ],
17 | [
18 | 'typescript',
19 | {
20 | project: 'tsconfig.build.json',
21 | esm: true,
22 | },
23 | ],
24 | ],
25 | };
26 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "extends": ["@react-native", "prettier"],
4 | "rules": {
5 | "react/react-in-jsx-scope": "off",
6 | "prettier/prettier": [
7 | "error",
8 | {
9 | "quoteProps": "consistent",
10 | "singleQuote": true,
11 | "tabWidth": 2,
12 | "trailingComma": "es5",
13 | "useTabs": false,
14 | "endOfLine": "auto"
15 | }
16 | ]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.github/workflows/labeler.yml:
--------------------------------------------------------------------------------
1 | name: "Pull Request Labeler"
2 | on:
3 | pull_request_target:
4 | types: [opened, synchronize, reopened]
5 |
6 | jobs:
7 | triage:
8 | permissions:
9 | contents: read
10 | pull-requests: write
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v2
14 | - uses: actions/labeler@v4
15 | with:
16 | repo-token: "${{ secrets.GITHUB_TOKEN }}"
17 |
--------------------------------------------------------------------------------
/.github/labeler.yml:
--------------------------------------------------------------------------------
1 | "Spacing":
2 | - "src/spacing/*"
3 |
4 | "Flexbox":
5 | - "src/flexbox/*"
6 |
7 | "Border":
8 | - "src/border/*"
9 |
10 | "Typography":
11 | - "src/typography/*"
12 |
13 | "Layout":
14 | - "src/layout/*"
15 |
16 | "Effects":
17 | - "src/effects/*"
18 |
19 | "Sizing":
20 | - "src/sizing/*"
21 |
22 | "Transforms":
23 | - "src/transforms/*"
24 |
25 | "Shadow":
26 | - "src/shadow/*"
27 |
28 | "CI":
29 | - ".github/**/*"
30 |
--------------------------------------------------------------------------------
/src/flexbox/justify.ts:
--------------------------------------------------------------------------------
1 | const justify = {
2 | center: {
3 | justifyContent: 'center',
4 | },
5 | start: {
6 | justifyContent: 'flex-start',
7 | },
8 | end: {
9 | justifyContent: 'flex-end',
10 | },
11 | between: {
12 | justifyContent: 'space-between',
13 | },
14 | around: {
15 | justifyContent: 'space-around',
16 | },
17 | evenly: {
18 | justifyContent: 'space-evenly',
19 | },
20 | };
21 |
22 | export default justify;
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: 📰 Documentation website
4 | url: https://nativeflowcssteam/documentation
5 | about: This repository is for the npm library. For code related to the documentation, please visit the documentation repository.
6 | - name: 📟 Join us on Discord
7 | url: https://discord.gg/your-discord-invite-link
8 | about: Ask questions and get help from the community on our Discord server.
9 |
--------------------------------------------------------------------------------
/src/types/layout.ts:
--------------------------------------------------------------------------------
1 | export type AspectRatio = {
2 | aspectRatio: number | string;
3 | };
4 |
5 | export type Direction = {
6 | direction: 'inherit' | 'ltr' | 'rtl';
7 | };
8 |
9 | export type Display = {
10 | display: 'none' | 'flex';
11 | };
12 |
13 | export type SizeMode =
14 | | 'cover'
15 | | 'contain'
16 | | 'stretch'
17 | | 'repeat'
18 | | 'center'
19 | | 'fill'
20 | | 'scale_down';
21 |
22 | export type PositionValue = { [key: string]: number | string };
23 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const { getDefaultConfig } = require('@expo/metro-config');
3 | const { getConfig } = require('react-native-builder-bob/metro-config');
4 | const pkg = require('../package.json');
5 |
6 | const root = path.resolve(__dirname, '..');
7 |
8 | /**
9 | * Metro configuration
10 | * https://facebook.github.io/metro/docs/configuration
11 | *
12 | * @type {import('metro-config').MetroConfig}
13 | */
14 | module.exports = getConfig(getDefaultConfig(__dirname), {
15 | root,
16 | pkg,
17 | project: __dirname,
18 | });
19 |
--------------------------------------------------------------------------------
/src/types/spacing.ts:
--------------------------------------------------------------------------------
1 | export type Padding = {
2 | padding?: number;
3 | paddingTop?: number;
4 | paddingBottom?: number;
5 | paddingLeft?: number;
6 | paddingRight?: number;
7 | paddingHorizontal?: number;
8 | paddingVertical?: number;
9 | paddingStart?: number;
10 | paddingEnd?: number;
11 | };
12 |
13 | export type Margin = {
14 | margin?: number;
15 | marginTop?: number;
16 | marginBottom?: number;
17 | marginLeft?: number;
18 | marginRight?: number;
19 | marginHorizontal?: number;
20 | marginVertical?: number;
21 | marginStart?: number;
22 | marginEnd?: number;
23 | };
24 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativeflowcss-example",
3 | "version": "1.0.0",
4 | "main": "expo/AppEntry.js",
5 | "scripts": {
6 | "start": "expo start",
7 | "android": "expo start --android",
8 | "ios": "expo start --ios",
9 | "web": "expo start --web"
10 | },
11 | "dependencies": {
12 | "@expo/metro-runtime": "~3.2.3",
13 | "expo": "~51.0.28",
14 | "expo-status-bar": "~1.12.1",
15 | "react": "18.2.0",
16 | "react-dom": "18.2.0",
17 | "react-native": "0.74.5",
18 | "react-native-web": "~0.19.10"
19 | },
20 | "devDependencies": {
21 | "@babel/core": "^7.20.0",
22 | "react-native-builder-bob": "^0.30.0"
23 | },
24 | "private": true
25 | }
26 |
--------------------------------------------------------------------------------
/src/flexbox/place.ts:
--------------------------------------------------------------------------------
1 | const place = {
2 | items_center: {
3 | alignItems: 'center',
4 | justifyContent: 'center',
5 | },
6 | items_stretch: {
7 | alignItems: 'stretch',
8 | justifyContent: 'stretch',
9 | },
10 | items_start: {
11 | alignItems: 'flex-start',
12 | justifyContent: 'flex-start',
13 | },
14 | items_end: {
15 | alignItems: 'flex-end',
16 | justifyContent: 'flex-end',
17 | },
18 | items_between: {
19 | alignItems: 'center',
20 | justifyContent: 'space-between',
21 | },
22 | items_around: {
23 | alignItems: 'center',
24 | justifyContent: 'space-around',
25 | },
26 | items_evenly: {
27 | alignItems: 'center',
28 | justifyContent: 'space-evenly',
29 | },
30 | };
31 |
32 | export default place;
33 |
--------------------------------------------------------------------------------
/.github/actions/setup/action.yml:
--------------------------------------------------------------------------------
1 | name: Setup
2 | description: Setup Node.js and install dependencies
3 |
4 | runs:
5 | using: composite
6 | steps:
7 | - name: Setup Node.js
8 | uses: actions/setup-node@v3
9 | with:
10 | node-version-file: .nvmrc
11 |
12 | - name: Cache dependencies
13 | id: npm-cache
14 | uses: actions/cache@v3
15 | with:
16 | path: |
17 | **/node_modules
18 | key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
19 | restore-keys: |
20 | ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
21 | ${{ runner.os }}-npm-
22 |
23 | - name: Install dependencies
24 | run: npm install
25 | shell: bash
26 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "example",
4 | "slug": "example",
5 | "version": "1.0.0",
6 | "orientation": "portrait",
7 | "icon": "./assets/icon.png",
8 | "userInterfaceStyle": "light",
9 | "splash": {
10 | "image": "./assets/splash.png",
11 | "resizeMode": "contain",
12 | "backgroundColor": "#ffffff"
13 | },
14 | "ios": {
15 | "supportsTablet": true,
16 | "bundleIdentifier": "nativeflowcss.example"
17 | },
18 | "android": {
19 | "adaptiveIcon": {
20 | "foregroundImage": "./assets/adaptive-icon.png",
21 | "backgroundColor": "#ffffff"
22 | },
23 | "package": "nativeflowcss.example"
24 | },
25 | "web": {
26 | "favicon": "./assets/favicon.png"
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/layout/z-index.ts:
--------------------------------------------------------------------------------
1 | const z = {
2 | index_0: { zIndex: 0 },
3 | index_10: { zIndex: 10 },
4 | index_20: { zIndex: 20 },
5 | index_30: { zIndex: 30 },
6 | index_40: { zIndex: 40 },
7 | index_50: { zIndex: 50 },
8 | index_auto: { zIndex: 'auto' },
9 |
10 | index_(value: number | string): { zIndex: number | 'auto' } {
11 | if (value === 'auto') {
12 | return { zIndex: 'auto' };
13 | } else if (!isNaN(Number(value))) {
14 | return { zIndex: Number(value) };
15 | } else {
16 | throw new Error('Invalid zIndex value');
17 | }
18 | },
19 | };
20 |
21 | // Example usage
22 | // console.log(z.index_(10)); // { zIndex: 10 }
23 | // console.log(z.index_('auto')); // { zIndex: 'auto' }
24 | // console.log(z.index_('20')); // { zIndex: 20 }
25 | // console.log(z.index_('invalid')); // Error: Invalid zIndex value
26 |
27 | export default z;
28 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "rootDir": ".",
4 | "paths": {
5 | "nativeflowcss": ["./src/index"]
6 | },
7 | "allowUnreachableCode": false,
8 | "allowUnusedLabels": false,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "jsx": "react-jsx",
12 | "lib": ["ESNext"],
13 | "module": "ESNext",
14 | "moduleResolution": "Bundler",
15 | "noEmit": true,
16 | "noFallthroughCasesInSwitch": true,
17 | "noImplicitReturns": true,
18 | "noImplicitUseStrict": false,
19 | "noStrictGenericChecks": false,
20 | "noUncheckedIndexedAccess": true,
21 | "noUnusedLocals": true,
22 | "noUnusedParameters": true,
23 | "resolveJsonModule": true,
24 | "skipLibCheck": true,
25 | "strict": true,
26 | "target": "ESNext",
27 | "verbatimModuleSyntax": true
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/layout/direction.ts:
--------------------------------------------------------------------------------
1 | import type { Direction } from '../types/layout';
2 |
3 | const directionValues: { [key: string]: Direction['direction'] } = {
4 | inherit: 'inherit',
5 | ltr: 'ltr',
6 | rtl: 'rtl',
7 | };
8 |
9 | const getDirectionValue = (key: string): Direction => {
10 | const value = directionValues[key];
11 | if (value === undefined) throw new Error(`Invalid direction key: ${key}`);
12 | return { direction: value };
13 | };
14 |
15 | const direction: { [key: string]: Direction } = {};
16 |
17 | Object.keys(directionValues).forEach((key) => {
18 | direction[key] = getDirectionValue(key);
19 | });
20 |
21 | // Example usage
22 | // const inheritDirection = direction.inherit; // { direction: 'inherit' }
23 | // const ltrDirection = direction.ltr; // { direction: 'ltr' }
24 | // const rtlDirection = direction.rtl; // { direction: 'rtl' }
25 |
26 | export default direction;
27 |
--------------------------------------------------------------------------------
/.github/workflows/issues.yml:
--------------------------------------------------------------------------------
1 | name: Comment on new issues
2 | on:
3 | issues:
4 | types: [opened]
5 |
6 | permissions:
7 | contents: read
8 | pull-requests: write
9 | issues: write
10 |
11 | jobs:
12 | triage:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Comment on new issues
17 | if: github.event_name == 'issues' && github.event.action == 'opened'
18 | uses: peter-evans/create-or-update-comment@v1
19 | with:
20 | token: "${{ secrets.GITHUB_TOKEN }}"
21 | issue-number: ${{ github.event.issue.number }}
22 | body: |
23 | Thank you for opening this issue 🎉
24 |
25 | Please do not start working on this issue or submit a pull request until a maintainer has assigned it to you. This helps us manage the workflow and avoid duplicate efforts.
26 |
27 | >We appreciate your understanding and cooperation.
28 |
--------------------------------------------------------------------------------
/src/layout/object-fit.ts:
--------------------------------------------------------------------------------
1 | import type { SizeMode } from '../types/layout';
2 |
3 | const object_fit: {
4 | [key: string]: { resizeMode: SizeMode } | { objectFit: SizeMode };
5 | } = {
6 | cover: { resizeMode: 'cover' },
7 | contain: { resizeMode: 'contain' },
8 | stretch: { resizeMode: 'stretch' },
9 | repeat: { resizeMode: 'repeat' },
10 | center: { resizeMode: 'center' },
11 | fill: { objectFit: 'fill' },
12 | scale_down: { objectFit: 'scale_down' },
13 | };
14 |
15 | // Example usage
16 | // const coverResizeMode = object_fit.cover; // { resizeMode: 'cover' }
17 | // const containResizeMode = object_fit.contain; // { resizeMode: 'contain' }
18 | // const stretchResizeMode = object_fit.stretch; // { resizeMode: 'stretch' }
19 | // const repeatResizeMode = object_fit.repeat; // { resizeMode: 'repeat' }
20 | // const centerResizeMode = object_fit.center; // { resizeMode: 'center' }
21 | // const fillResizeMode = object_fit.fill; // { objectFit: 'fill' }
22 | // const scaleDownResizeMode = object_fit.scale_down; // { objectFit: 'scale_down' }
23 |
24 | export default object_fit;
25 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2 | #
3 | # You can adjust the behavior by modifying this file.
4 | # For more information, see:
5 | # https://github.com/actions/stale
6 |
7 | name: Label inactive issues
8 | on:
9 | schedule:
10 | - cron: "30 1 * * *"
11 |
12 | jobs:
13 | stale:
14 | runs-on: ubuntu-latest
15 | permissions:
16 | issues: write
17 | pull-requests: write
18 | steps:
19 | - uses: actions/stale@v9
20 | with:
21 | stale-issue-label: "Status: Stale"
22 | days-before-issue-stale: 30
23 | days-before-issue-close: -1
24 | stale-issue-message: "This issue is stale because it has had no activity for the last 30 days."
25 | close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
26 | days-before-pr-stale: -1
27 | days-before-pr-close: -1
28 | operations-per-run: 100
29 | repo-token: ${{ secrets.GITHUB_TOKEN }}
30 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # MIT License
2 |
3 | Copyright 2024 [Jay Singh aka mathdebate09](https://github.com/mathdebate09)
4 |
5 | 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, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches:
5 | - main
6 | pull_request:
7 | branches:
8 | - main
9 | merge_group:
10 | types:
11 | - checks_requested
12 |
13 | jobs:
14 | lint:
15 | runs-on: windows-latest
16 | steps:
17 | - name: Checkout
18 | uses: actions/checkout@v3
19 |
20 | - name: Setup
21 | uses: ./.github/actions/setup
22 |
23 | - name: Lint files
24 | run: npm run lint
25 |
26 | - name: Typecheck files
27 | run: npm run typecheck
28 |
29 | test:
30 | runs-on: windows-latest
31 | steps:
32 | - name: Checkout
33 | uses: actions/checkout@v3
34 |
35 | - name: Setup
36 | uses: ./.github/actions/setup
37 |
38 | - name: Run unit tests
39 | run: npm test -- --maxWorkers=2 --coverage
40 |
41 | build-library:
42 | runs-on: windows-latest
43 | steps:
44 | - name: Checkout
45 | uses: actions/checkout@v3
46 |
47 | - name: Setup
48 | uses: ./.github/actions/setup
49 |
50 | - name: Build package
51 | run: npm run prepare
52 |
--------------------------------------------------------------------------------
/src/flexbox/align.ts:
--------------------------------------------------------------------------------
1 | const align = {
2 | items_center: {
3 | alignItems: 'center',
4 | },
5 | items_start: {
6 | alignItems: 'flex-start',
7 | },
8 | items_end: {
9 | alignItems: 'flex-end',
10 | },
11 | items_baseline: {
12 | alignItems: 'baseline',
13 | },
14 | items_stretch: {
15 | alignItems: 'stretch',
16 | },
17 | content_center: {
18 | alignContent: 'center',
19 | },
20 | content_start: {
21 | alignContent: 'flex-start',
22 | },
23 | content_end: {
24 | alignContent: 'flex-end',
25 | },
26 | content_stretch: {
27 | alignContent: 'stretch',
28 | },
29 | content_between: {
30 | alignContent: 'space-between',
31 | },
32 | content_around: {
33 | alignContent: 'space-around',
34 | },
35 | self_auto: {
36 | alignSelf: 'auto',
37 | },
38 | self_center: {
39 | alignSelf: 'center',
40 | },
41 | self_start: {
42 | alignSelf: 'flex-start',
43 | },
44 | self_end: {
45 | alignSelf: 'flex-end',
46 | },
47 | self_stretch: {
48 | alignSelf: 'stretch',
49 | },
50 | self_baseline: {
51 | alignSelf: 'baseline',
52 | },
53 | };
54 |
55 | export default align;
56 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # XDE
6 | .expo/
7 |
8 | # VSCode
9 | .vscode/
10 | jsconfig.json
11 |
12 | # Xcode
13 | #
14 | build/
15 | *.pbxuser
16 | !default.pbxuser
17 | *.mode1v3
18 | !default.mode1v3
19 | *.mode2v3
20 | !default.mode2v3
21 | *.perspectivev3
22 | !default.perspectivev3
23 | xcuserdata
24 | *.xccheckout
25 | *.moved-aside
26 | DerivedData
27 | *.hmap
28 | *.ipa
29 | *.xcuserstate
30 | project.xcworkspace
31 |
32 | # Android/IJ
33 | #
34 | .classpath
35 | .cxx
36 | .gradle
37 | .idea
38 | .project
39 | .settings
40 | local.properties
41 | android.iml
42 |
43 | # Cocoapods
44 | #
45 | example/ios/Pods
46 |
47 | # Ruby
48 | example/vendor/
49 |
50 | # node.js
51 | #
52 | node_modules/
53 | npm-debug.log
54 | yarn-debug.log
55 | yarn-error.log
56 |
57 | # BUCK
58 | buck-out/
59 | \.buckd/
60 | android/app/libs
61 | android/keystores/debug.keystore
62 |
63 | # Yarn
64 | .yarn/*
65 | !.yarn/patches
66 | !.yarn/plugins
67 | !.yarn/releases
68 | !.yarn/sdks
69 | !.yarn/versions
70 |
71 | # Expo
72 | .expo/
73 |
74 | # Turborepo
75 | .turbo/
76 |
77 | # generated by bob
78 | lib/
79 |
80 | # React Native Codegen
81 | ios/generated
82 | android/generated
83 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🐛 Bug
3 | about: Found an issue in our library? Report it here to help us improve!
4 | title: "Bug: "
5 | labels: "Bug, Needs Triage"
6 | assignees: ""
7 | ---
8 |
9 | ### Checks
10 |
11 | - [ ] This is not a duplicate of an existing issue (please have a look through our [open issues list](https://github.com/nativeflowteam/nativeflowcss/issues) to make sure)
12 | - [ ] I have thoroughly read and understand [Contributing Guide](https://github.com/nativeflowteam/nativeflowcss/blob/main/CONTRIBUTING.md)
13 | - [ ] Would you like to work on this issue?
14 |
15 | ### Describe the bug
16 |
17 |
18 | ### To Reproduce
19 |
24 |
25 | ### (optional) How *if it does* break UI
26 |
27 | >Images
28 |
29 | ### (Optional) Additional Comments
30 |
31 | *No response*
32 |
33 | ### (Optional) Discord username
34 |
35 |
36 | *No response*
37 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | // Spacing
2 | import p from './spacing/padding';
3 | import m from './spacing/margin';
4 |
5 | // Layout
6 | import aspect from './layout/aspect';
7 | import object_fit from './layout/object-fit';
8 | import display from './layout/display';
9 | import direction from './layout/direction';
10 | import pos from './layout/position';
11 | import z from './layout/z-index';
12 | import overflow from './layout/overflow';
13 |
14 | // Flexbox
15 | import flex from './flexbox/flex';
16 | import align from './flexbox/align';
17 | import justify from './flexbox/justify';
18 | import place from './flexbox/place';
19 |
20 | // Border
21 | import bdr from './border/bdr';
22 |
23 | // Effects
24 | import fx from './effects/fx';
25 |
26 | // Shadow
27 | import shadow from './shadow/shadow';
28 |
29 | // Sizing
30 | import h from './sizing/h';
31 | import w from './sizing/w';
32 | import size from './sizing/size';
33 |
34 | // Typography
35 | import text from './typography/text';
36 | import decoration from './typography/decoration';
37 |
38 | export {
39 | p,
40 | m,
41 | aspect,
42 | object_fit,
43 | display,
44 | direction,
45 | pos,
46 | z,
47 | overflow,
48 | flex,
49 | align,
50 | justify,
51 | place,
52 | bdr,
53 | fx,
54 | shadow,
55 | h,
56 | w,
57 | size,
58 | text,
59 | decoration,
60 | };
61 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/enhancement.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🚀 Enhancement/Feature Request
3 | about: Suggest an enhancement or feature for our library to help us improve!
4 | title: "Enhancement: "
5 | labels: "Enhancement, Needs Triage"
6 | assignees: ""
7 | ---
8 |
9 | ### Checks
10 |
11 | - [ ] This is not a duplicate of an existing issue (please have a look through our [open issues list](https://github.com/nativeflowteam/nativeflowcss/issues) to make sure)
12 | - [ ] I have thoroughly read and understand [Contributing Guide](https://github.com/nativeflowteam/nativeflowcss/blob/main/CONTRIBUTING.md)
13 | - [ ] Would you like to work on this enhancement?
14 |
15 | ### Describe the enhancement
16 |
17 |
18 | ### Describe the solution you'd like
19 |
20 |
21 | ### Describe alternatives you've considered
22 |
23 |
24 | ### (Optional) Additional Comments
25 |
26 | *No response*
27 |
28 | ### (Optional) Discord username
29 |
30 |
31 | *No response*
32 |
--------------------------------------------------------------------------------
/example/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react'
2 | import { Text, View, Button, TextInput } from 'react-native'
3 | import { p, m, flex, border } from 'nativeflowcss'
4 |
5 | export default function App() {
6 | const [currentGoalInput, setCurrentGoalInput] = useState('')
7 | const [goalsList, setGoalsList] = useState([])
8 |
9 | function handleGoalInput(input) {
10 | setCurrentGoalInput(input)
11 | }
12 |
13 | function handleGoalAdd() {
14 | setGoalsList((currentGoalsList) => [...currentGoalsList, currentGoalInput])
15 | }
16 |
17 | return (
18 |
19 |
28 |
34 |
35 |
36 |
37 | Your Goals:
38 | {goalsList.map((goal, index) => (
39 | {goal}
40 | ))}
41 |
42 |
43 | );
44 | }
45 |
--------------------------------------------------------------------------------
/src/sizing/size.ts:
--------------------------------------------------------------------------------
1 | const size = {
2 | // Predefined size properties
3 | s_0: { width: 0, height: 0 },
4 | s_1: { width: 4, height: 4 },
5 | s_2: { width: 8, height: 8 },
6 | s_3: { width: 12, height: 12 },
7 | s_4: { width: 16, height: 16 },
8 | s_5: { width: 20, height: 20 },
9 | s_6: { width: 24, height: 24 },
10 | s_7: { width: 28, height: 28 },
11 | s_8: { width: 32, height: 32 },
12 | s_9: { width: 36, height: 36 },
13 | s_10: { width: 40, height: 40 },
14 | s_11: { width: 44, height: 44 },
15 | s_12: { width: 48, height: 48 },
16 | s_14: { width: 56, height: 56 },
17 | s_16: { width: 64, height: 64 },
18 | s_20: { width: 80, height: 80 },
19 | s_24: { width: 96, height: 96 },
20 | s_28: { width: 112, height: 112 },
21 | s_32: { width: 128, height: 128 },
22 | s_36: { width: 144, height: 144 },
23 | s_40: { width: 160, height: 160 },
24 | s_44: { width: 176, height: 176 },
25 | s_48: { width: 192, height: 192 },
26 | s_52: { width: 208, height: 208 },
27 | s_56: { width: 224, height: 224 },
28 | s_60: { width: 240, height: 240 },
29 | s_64: { width: 256, height: 256 },
30 | s_72: { width: 288, height: 288 },
31 | s_80: { width: 320, height: 320 },
32 | s_96: { width: 384, height: 384 },
33 |
34 | // Dynamic size function
35 | s_: (value: number | string) => ({
36 | width: Number(value),
37 | height: Number(value),
38 | }),
39 | };
40 |
41 | export default size;
42 |
--------------------------------------------------------------------------------
/src/typography/decoration.ts:
--------------------------------------------------------------------------------
1 | import type { TextStyle } from 'react-native';
2 | import colorList from '../utils/colorList';
3 |
4 | const decoration: {
5 | [key: string]: TextStyle | ((color: string) => TextStyle);
6 | } = {
7 | // Text decoration line
8 | underline: {
9 | textDecorationLine: 'underline' as TextStyle['textDecorationLine'],
10 | },
11 | line_through: {
12 | textDecorationLine: 'line-through' as TextStyle['textDecorationLine'],
13 | },
14 | underline_line_through: {
15 | textDecorationLine:
16 | 'underline line-through' as TextStyle['textDecorationLine'],
17 | },
18 | none: { textDecorationLine: 'none' as TextStyle['textDecorationLine'] },
19 |
20 | // Text decoration style
21 | solid: {
22 | /*ios*/ textDecorationStyle: 'solid' as TextStyle['textDecorationStyle'],
23 | },
24 | double: {
25 | /*ios*/ textDecorationStyle: 'double' as TextStyle['textDecorationStyle'],
26 | },
27 | dotted: {
28 | /*ios*/ textDecorationStyle: 'dotted' as TextStyle['textDecorationStyle'],
29 | },
30 | dashed: {
31 | /*ios*/ textDecorationStyle: 'dashed' as TextStyle['textDecorationStyle'],
32 | },
33 |
34 | // Text decoration color (iOS)
35 | color_: (color: string): TextStyle => ({
36 | textDecorationColor: color,
37 | }),
38 | };
39 |
40 | // Dynamically add color properties
41 | Object.keys(colorList).forEach((colorKey) => {
42 | decoration[`color_${colorKey}`] = {
43 | /*ios*/ textDecorationColor: colorList[colorKey],
44 | };
45 | });
46 |
47 | export default decoration;
48 |
--------------------------------------------------------------------------------
/src/layout/aspect.ts:
--------------------------------------------------------------------------------
1 | import type { AspectRatio } from '../types/layout';
2 |
3 | const aspectRatioValues: { [key: string]: number | string } = {
4 | auto: 'auto',
5 | square: 1,
6 | video: 16 / 9,
7 | };
8 |
9 | const getAspectRatioValue = (key: string | number): number | string => {
10 | if (typeof key === 'number') return key;
11 | if (key === 'auto') return 'auto';
12 | if (!isNaN(Number(key))) return Number(key);
13 |
14 | // Handle fractional strings like '1/3'
15 | const fractionMatch = key.match(/^(\d+)\/(\d+)$/);
16 | if (fractionMatch) {
17 | const numerator = Number(fractionMatch[1]);
18 | const denominator = Number(fractionMatch[2]);
19 | return numerator / denominator;
20 | }
21 |
22 | const value = aspectRatioValues[key];
23 | if (value === undefined) throw new Error(`Invalid aspect ratio key: ${key}`);
24 | return value;
25 | };
26 |
27 | const aspect = {
28 | custom_: (key: string | number): AspectRatio => {
29 | return { aspectRatio: getAspectRatioValue(key) };
30 | },
31 | } as { [key: string]: AspectRatio } & {
32 | custom_: (key: string | number) => AspectRatio;
33 | };
34 |
35 | Object.keys(aspectRatioValues).forEach((key) => {
36 | aspect[key] = { aspectRatio: getAspectRatioValue(key) };
37 | });
38 |
39 | // Example usage
40 | // const autoAspectRatio = aspect.auto; // { aspectRatio: 'auto' }
41 | // const squareAspectRatio = aspect.square; // { aspectRatio: 1 }
42 | // const videoAspectRatio = aspect.video; // { aspectRatio: 16 / 9 }
43 | // const customAspectRatio = aspect.custom_('4/3'); // { aspectRatio: 4 / 3 }
44 | // const customAspectRatioNumber = aspect.custom_(3); // { aspectRatio: 3 }
45 | // const customAspectRatioString = aspect.custom_('3'); // { aspectRatio: 3 }
46 |
47 | export default aspect;
48 |
--------------------------------------------------------------------------------
/src/shadow/shadow.ts:
--------------------------------------------------------------------------------
1 | import type { ViewStyle } from 'react-native';
2 | import colorList from '../utils/colorList';
3 | import type { ShadowStyles } from '../types/effects';
4 |
5 | const shadow: ShadowStyles = {
6 | // Shadow color
7 | color_: (value: string): ViewStyle => ({
8 | shadowColor: value,
9 | }),
10 |
11 | // Shadow offset
12 | offset_: (width: number | string, height: number | string): ViewStyle => ({
13 | shadowOffset: { width: Number(width), height: Number(height) },
14 | }),
15 |
16 | // Shadow opacity
17 | opacity_: (value: number | string): ViewStyle => ({
18 | shadowOpacity: Number(value),
19 | }),
20 |
21 | // Shadow radius
22 | rounded_: (value: number | string): ViewStyle => ({
23 | shadowRadius: Number(value),
24 | }),
25 |
26 | // Default values for shadow radius
27 | rounded_none: { shadowRadius: 0 },
28 | rounded_xs: { shadowRadius: 1 },
29 | rounded_sm: { shadowRadius: 2 },
30 | rounded_md: { shadowRadius: 3 },
31 | rounded_base: { shadowRadius: 4 },
32 | rounded_lg: { shadowRadius: 8 },
33 | rounded_xl: { shadowRadius: 12 },
34 | rounded_2xl: { shadowRadius: 16 },
35 | rounded_3xl: { shadowRadius: 24 },
36 | rounded_full: { shadowRadius: 9999 },
37 | };
38 |
39 | // Dynamically add offset properties for 1-5 levels
40 | for (let i = 1; i <= 5; i++) {
41 | shadow[`offset_${i}`] = {
42 | shadowOffset: { width: i, height: i },
43 | } as ViewStyle;
44 | }
45 |
46 | // Dynamically add opacity properties for 1-24 levels
47 | for (let i = 1; i <= 24; i++) {
48 | shadow[`opacity_${i}`] = { shadowOpacity: i } as ViewStyle;
49 | }
50 |
51 | // Dynamically add color properties
52 | Object.keys(colorList).forEach((colorKey) => {
53 | shadow[`color_${colorKey}`] = {
54 | shadowColor: colorList[colorKey],
55 | } as ViewStyle;
56 | });
57 |
58 | export default shadow;
59 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Because
4 |
5 |
6 | ## This PR
7 |
8 |
9 | ## Issue
10 |
19 | Closes #XXXXX
20 |
21 | ## Additional Information
22 |
23 | *No response*
24 |
25 | ### (Optional) Discord username
26 |
27 | *No response*
28 |
29 | ## Pull Request Requirements
30 |
31 | - [ ] I have thoroughly read and understand [Contributing Guide](https://github.com/nativeflowteam/nativeflowcss/blob/main/CONTRIBUTING.md)
32 | - [ ] The title of this PR follows the `location of change: brief description of change` format, e.g. `Sizing: Add padding support`
33 | - [ ] The `Because` section summarizes the reason for this PR
34 | - [ ] The `This PR` section has a bullet point list describing the changes in this PR
35 | - [ ] If this PR addresses an open issue, it is linked in the `Issue` section
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 | Tailwind-inspired utility-first style objects for React Native, zero-deps && zero-setup, plug-n-play
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | ## Installation
21 |
22 | ```bash
23 | npm install nativeflowcss
24 | ```
25 |
26 | ## Description
27 |
28 | A utility-first styling object library tailored for React Native, offering a rich set of utilities such as `justify.center`, `m.b_(4)`, and `bdr.color_slate_200`. These utilities can be composed to create any design, similar to the approach used by Tailwind.
29 |
30 | ## Documentation
31 |
32 | For complete docs on NativeFlow, Read at [nativeflow.js.org](https://nativeflow.js.org)
33 |
34 | ## Socials
35 |
36 | Feel free to drop by at the [Discord Server](https://discord.gg/KcKTtuqV3Y) or at [Github Discussions](https://github.com/nativeflowteam/nativeflowcss/discussions)
37 |
38 | ## Contributing
39 |
40 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
41 |
42 | ## License
43 |
44 | [MIT](LICENSE.md)
45 |
46 | ## Donations
47 |
48 | [](https://ko-fi.com/Z8Z113CQW5)
49 | [](https://www.paypal.me/jayowiee/)
50 | [](https://patreon.com/nativeflow)
51 |
52 | > Made with ♥ using [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
53 |
--------------------------------------------------------------------------------
/src/layout/position.ts:
--------------------------------------------------------------------------------
1 | import type { PositionValue } from '../types/layout';
2 |
3 | const positions: { [key: string]: number } = {
4 | '0': 0,
5 | 'px': 1,
6 | '1': 4,
7 | '2': 8,
8 | '3': 12,
9 | '4': 16,
10 | '5': 20,
11 | '6': 24,
12 | '7': 28,
13 | '8': 32,
14 | '9': 36,
15 | '10': 40,
16 | '11': 44,
17 | '12': 48,
18 | '14': 56,
19 | '16': 64,
20 | '20': 80,
21 | '24': 96,
22 | '28': 112,
23 | '32': 128,
24 | '36': 144,
25 | '40': 160,
26 | '44': 176,
27 | '48': 192,
28 | '52': 208,
29 | '56': 224,
30 | '60': 240,
31 | '64': 256,
32 | '72': 288,
33 | '80': 320,
34 | '96': 384,
35 | };
36 |
37 | // Now explicitly include the custom methods and the index signature for dynamically generated properties
38 | const pos: {
39 | relative: { position: string };
40 | absolute: { position: string };
41 | fixed: { position: string };
42 | sticky: { position: string };
43 | [key: string]:
44 | | PositionValue
45 | | { position: string }
46 | | ((value: number) => PositionValue);
47 | } = {
48 | // Position properties
49 | relative: { position: 'relative' },
50 | absolute: { position: 'absolute' },
51 | fixed: { position: 'fixed' },
52 | sticky: { position: 'sticky' },
53 |
54 | r_(value: number | string): PositionValue {
55 | return { right: Number(value) };
56 | },
57 | t_(value: number): PositionValue {
58 | return { top: Number(value) };
59 | },
60 | l_(value: number): PositionValue {
61 | return { left: Number(value) };
62 | },
63 | b_(value: number): PositionValue {
64 | return { bottom: Number(value) };
65 | },
66 | };
67 |
68 | Object.keys(positions).forEach((posKey) => {
69 | pos[`t_${posKey}`] = {
70 | top: positions[posKey],
71 | } as PositionValue;
72 |
73 | pos[`r_${posKey}`] = {
74 | right: positions[posKey],
75 | } as PositionValue;
76 |
77 | pos[`b_${posKey}`] = {
78 | bottom: positions[posKey],
79 | } as PositionValue;
80 |
81 | pos[`l_${posKey}`] = {
82 | left: positions[posKey],
83 | } as PositionValue;
84 | });
85 |
86 | // Example usage
87 | // console.log(pos.relative); // { position: 'relative' }
88 | // console.log(pos.right_1); // { right: 4 }
89 | // console.log(pos.top_2); // { top: 8 }
90 | // console.log(pos.left_1); // { left: '50%' }
91 | // console.log(pos.b_(20)); // { bottom: 20 }
92 |
93 | export default pos;
94 |
--------------------------------------------------------------------------------
/src/effects/fx.ts:
--------------------------------------------------------------------------------
1 | import colorList from '../utils/colorList';
2 | import type { ViewStyle, ImageStyle } from 'react-native';
3 | import type { BgStyles } from '../types/effects';
4 |
5 | const fx: BgStyles = {
6 | // Custom background color
7 | bg_color_: (value: string): ViewStyle => ({
8 | backgroundColor: value,
9 | }),
10 |
11 | // Custom tint color
12 | tint_: (value: string): ImageStyle => ({
13 | tintColor: value,
14 | }),
15 |
16 | // Custom opacity
17 | opacity_: (value: number | string): ViewStyle => {
18 | if (Number(value) < 0 || Number(value) > 1) {
19 | throw new Error('Opacity value must be between 0.0 and 1.0');
20 | }
21 | return {
22 | opacity: Number(value),
23 | };
24 | },
25 |
26 | // Custom overlay color
27 | overlay_: (value: string): ImageStyle => ({
28 | overlayColor: value,
29 | }),
30 |
31 | // Custom elevation
32 | elevation_: (value: number | string): ViewStyle => {
33 | if (Number(value) < 1 || Number(value) > 10) {
34 | throw new Error('Elevation value must be between 1 and 10');
35 | }
36 | return {
37 | elevation: Number(value),
38 | };
39 | },
40 |
41 | box_auto: { pointerEvents: 'auto' },
42 | box_none: { pointerEvents: 'none' },
43 |
44 | // Predefined backface visibility properties
45 | backface: { backfaceVisibility: 'visible' },
46 | backface_none: { backfaceVisibility: 'hidden' },
47 | };
48 |
49 | // Predefined opacity properties (0-10)
50 | Array.from({ length: 11 }, (_, i) => i / 10).forEach((value) => {
51 | fx[`opacity_${value * 10}`] = { opacity: value };
52 | });
53 |
54 | // Predefined elevation properties (1-10)
55 | Array.from({ length: 10 }, (_, i) => i + 1).forEach((value) => {
56 | fx[`elevation_${value}`] = { elevation: value };
57 | });
58 |
59 | // Dynamically add background color properties from colorList
60 | Object.keys(colorList).forEach((colorKey) => {
61 | fx[`bg_color_${colorKey}`] = {
62 | backgroundColor: colorList[colorKey],
63 | } as ViewStyle;
64 | });
65 |
66 | // Dynamically add tint color properties from colorList
67 | Object.keys(colorList).forEach((colorKey) => {
68 | fx[`tint_${colorKey}`] = {
69 | tintColor: colorList[colorKey],
70 | } as ImageStyle;
71 | });
72 |
73 | // Dynamically add overlay color properties from colorList
74 | Object.keys(colorList).forEach((colorKey) => {
75 | fx[`overlay_${colorKey}`] = {
76 | overlayColor: colorList[colorKey],
77 | } as ViewStyle;
78 | });
79 |
80 | export default fx;
81 |
--------------------------------------------------------------------------------
/src/spacing/margin.ts:
--------------------------------------------------------------------------------
1 | import type { Margin } from '../types/spacing';
2 |
3 | const marginValues: { [key: string]: number } = {
4 | '0': 0,
5 | 'px': 1,
6 | '1': 4,
7 | '2': 8,
8 | '3': 12,
9 | '4': 16,
10 | '5': 20,
11 | '6': 24,
12 | '7': 28,
13 | '8': 32,
14 | '9': 36,
15 | '10': 40,
16 | '11': 44,
17 | '12': 48,
18 | '14': 56,
19 | '16': 64,
20 | '20': 80,
21 | '24': 96,
22 | '28': 112,
23 | '32': 128,
24 | '36': 144,
25 | '40': 160,
26 | '44': 176,
27 | '48': 192,
28 | '52': 208,
29 | '56': 224,
30 | '60': 240,
31 | '64': 256,
32 | '72': 288,
33 | '80': 320,
34 | '96': 384,
35 | };
36 |
37 | const getMarginValue = (key: string | number): number => {
38 | if (typeof key === 'number') return key;
39 | const value = marginValues[key] ?? parseInt(key, 10);
40 | if (isNaN(value)) throw new Error(`Invalid margin key: ${key}`);
41 | return value;
42 | };
43 |
44 | const generateMargin = (type: string, key: string | number): Margin => {
45 | const value = getMarginValue(key);
46 | switch (type) {
47 | case 'm':
48 | return { margin: value };
49 | case 'mx':
50 | return { marginLeft: value, marginRight: value };
51 | case 'my':
52 | return { marginTop: value, marginBottom: value };
53 | case 'mt':
54 | return { marginTop: value };
55 | case 'mb':
56 | return { marginBottom: value };
57 | case 'mr':
58 | return { marginRight: value };
59 | case 'ml':
60 | return { marginLeft: value };
61 | case 'ms':
62 | return { marginStart: value };
63 | case 'me':
64 | return { marginEnd: value };
65 | default:
66 | return {};
67 | }
68 | };
69 |
70 | const m: any = {};
71 |
72 | Object.keys(marginValues).forEach((key) => {
73 | ['m', 'mx', 'my', 'mt', 'mr', 'mb', 'ml', 'ms', 'me'].forEach((type) => {
74 | m[`${type}_${key}`] = generateMargin(type, key);
75 | });
76 | });
77 |
78 | ['m', 'mx', 'my', 'mt', 'mr', 'mb', 'ml', 'ms', 'me'].forEach((type) => {
79 | m[`${type}_`] = (key: string | number): Margin => generateMargin(type, key);
80 | });
81 |
82 | // Example usage
83 | // const marginStyle = m.m_1; // { margin: 4 }
84 | // const marginHorizontalStyle = m.mx_1; // { marginLeft: 4, marginRight: 4 }
85 | // const marginVerticalStyle = m.my_1; // { marginTop: 4, marginBottom: 4 }
86 | // const marginTopStyle = m.mt_1; // { marginTop: 4 }
87 | // const marginBottomStyle = m.mb_1; // { marginBottom: 4 }
88 | // const marginRightStyle = m.mr_1; // { marginRight: 4 }
89 | // const marginLeftStyle = m.ml_1; // { marginLeft: 4 }
90 | // const customMarginStyle = m.m_(1000); // { margin: 1000 }
91 |
92 | export default m;
93 |
--------------------------------------------------------------------------------
/src/spacing/padding.ts:
--------------------------------------------------------------------------------
1 | import type { Padding } from '../types/spacing';
2 |
3 | const paddingValues: { [key: string]: number } = {
4 | '0': 0,
5 | 'px': 1,
6 | '1': 4,
7 | '2': 8,
8 | '3': 12,
9 | '4': 16,
10 | '5': 20,
11 | '6': 24,
12 | '7': 28,
13 | '8': 32,
14 | '9': 36,
15 | '10': 40,
16 | '11': 44,
17 | '12': 48,
18 | '14': 56,
19 | '16': 64,
20 | '20': 80,
21 | '24': 96,
22 | '28': 112,
23 | '32': 128,
24 | '36': 144,
25 | '40': 160,
26 | '44': 176,
27 | '48': 192,
28 | '52': 208,
29 | '56': 224,
30 | '60': 240,
31 | '64': 256,
32 | '72': 288,
33 | '80': 320,
34 | '96': 384,
35 | };
36 |
37 | const getPaddingValue = (key: string | number): number => {
38 | if (typeof key === 'number') return key;
39 | const value = paddingValues[key] ?? parseInt(key, 10);
40 | if (isNaN(value)) throw new Error(`Invalid padding key: ${key}`);
41 | return value;
42 | };
43 |
44 | const generatePadding = (type: string, key: string | number): Padding => {
45 | const value = getPaddingValue(key);
46 | switch (type) {
47 | case 'p':
48 | return { padding: value };
49 | case 'px':
50 | return { paddingLeft: value, paddingRight: value };
51 | case 'py':
52 | return { paddingTop: value, paddingBottom: value };
53 | case 'pt':
54 | return { paddingTop: value };
55 | case 'pb':
56 | return { paddingBottom: value };
57 | case 'pr':
58 | return { paddingRight: value };
59 | case 'pl':
60 | return { paddingLeft: value };
61 | case 'ps':
62 | return { paddingStart: value };
63 | case 'pe':
64 | return { paddingEnd: value };
65 | default:
66 | return {};
67 | }
68 | };
69 |
70 | const p: any = {};
71 |
72 | Object.keys(paddingValues).forEach((key) => {
73 | ['p', 'px', 'py', 'pt', 'pr', 'pb', 'pl', 'ps', 'pe'].forEach((type) => {
74 | p[`${type}_${key}`] = generatePadding(type, key);
75 | });
76 | });
77 |
78 | ['p', 'px', 'py', 'pt', 'pr', 'pb', 'pl', 'ps', 'pe'].forEach((type) => {
79 | p[`${type}_`] = (key: string | number): Padding => generatePadding(type, key);
80 | });
81 |
82 | // Example usage
83 | // const paddingStyle = p.p_1; // { padding: 4 }
84 | // const paddingHorizontalStyle = p.px_1; // { paddingLeft: 4, paddingRight: 4 }
85 | // const paddingVerticalStyle = p.py_1; // { paddingTop: 4, paddingBottom: 4 }
86 | // const paddingTopStyle = p.pt_1; // { paddingTop: 4 }
87 | // const paddingBottomStyle = p.pb_1; // { paddingBottom: 4 }
88 | // const paddingRightStyle = p.pr_1; // { paddingRight: 4 }
89 | // const paddingLeftStyle = p.pl_1; // { paddingLeft: 4 }
90 | // const customPaddingStyle = p.p_(1000); // { padding: 1000 }
91 |
92 | export default p;
93 |
--------------------------------------------------------------------------------
/src/sizing/w.ts:
--------------------------------------------------------------------------------
1 | const w = {
2 | // Width properties
3 | w_0: { width: 0 },
4 | w_px: { width: 1 },
5 | w_1: { width: 4 },
6 | w_2: { width: 8 },
7 | w_3: { width: 12 },
8 | w_4: { width: 16 },
9 | w_5: { width: 20 },
10 | w_6: { width: 24 },
11 | w_7: { width: 28 },
12 | w_8: { width: 32 },
13 | w_9: { width: 36 },
14 | w_10: { width: 40 },
15 | w_11: { width: 44 },
16 | w_12: { width: 48 },
17 | w_14: { width: 56 },
18 | w_16: { width: 64 },
19 | w_20: { width: 80 },
20 | w_24: { width: 96 },
21 | w_28: { width: 112 },
22 | w_32: { width: 128 },
23 | w_36: { width: 144 },
24 | w_40: { width: 160 },
25 | w_44: { width: 176 },
26 | w_48: { width: 192 },
27 | w_52: { width: 208 },
28 | w_56: { width: 224 },
29 | w_60: { width: 240 },
30 | w_64: { width: 256 },
31 | w_72: { width: 288 },
32 | w_80: { width: 320 },
33 | w_96: { width: 384 },
34 |
35 | // Max-width properties
36 | max_0: { maxWidth: 0 },
37 | max_px: { maxWidth: 1 },
38 | max_1: { maxWidth: 4 },
39 | max_2: { maxWidth: 8 },
40 | max_3: { maxWidth: 12 },
41 | max_4: { maxWidth: 16 },
42 | max_5: { maxWidth: 20 },
43 | max_6: { maxWidth: 24 },
44 | max_7: { maxWidth: 28 },
45 | max_8: { maxWidth: 32 },
46 | max_9: { maxWidth: 36 },
47 | max_10: { maxWidth: 40 },
48 | max_11: { maxWidth: 44 },
49 | max_12: { maxWidth: 48 },
50 | max_14: { maxWidth: 56 },
51 | max_16: { maxWidth: 64 },
52 | max_20: { maxWidth: 80 },
53 | max_24: { maxWidth: 96 },
54 | max_28: { maxWidth: 112 },
55 | max_32: { maxWidth: 128 },
56 | max_36: { maxWidth: 144 },
57 | max_40: { maxWidth: 160 },
58 | max_44: { maxWidth: 176 },
59 | max_48: { maxWidth: 192 },
60 | max_52: { maxWidth: 208 },
61 | max_56: { maxWidth: 224 },
62 | max_60: { maxWidth: 240 },
63 | max_64: { maxWidth: 256 },
64 | max_72: { maxWidth: 288 },
65 | max_80: { maxWidth: 320 },
66 | max_96: { maxWidth: 384 },
67 |
68 | // Min-width properties
69 | min_0: { minWidth: 0 },
70 | min_px: { minWidth: 1 },
71 | min_1: { minWidth: 4 },
72 | min_2: { minWidth: 8 },
73 | min_3: { minWidth: 12 },
74 | min_4: { minWidth: 16 },
75 | min_5: { minWidth: 20 },
76 | min_6: { minWidth: 24 },
77 | min_7: { minWidth: 28 },
78 | min_8: { minWidth: 32 },
79 | min_9: { minWidth: 36 },
80 | min_10: { minWidth: 40 },
81 | min_11: { minWidth: 44 },
82 | min_12: { minWidth: 48 },
83 | min_14: { minWidth: 56 },
84 | min_16: { minWidth: 64 },
85 | min_20: { minWidth: 80 },
86 | min_24: { minWidth: 96 },
87 | min_28: { minWidth: 112 },
88 | min_32: { minWidth: 128 },
89 | min_36: { minWidth: 144 },
90 | min_40: { minWidth: 160 },
91 | min_44: { minWidth: 176 },
92 | min_48: { minWidth: 192 },
93 | min_52: { minWidth: 208 },
94 | min_56: { minWidth: 224 },
95 | min_60: { minWidth: 240 },
96 | min_64: { minWidth: 256 },
97 | min_72: { minWidth: 288 },
98 | min_80: { minWidth: 320 },
99 | min_96: { minWidth: 384 },
100 |
101 | // Dynamic width function
102 | w_: (value: number | string) => ({
103 | width: typeof value === 'string' ? value : value,
104 | }),
105 |
106 | // Dynamic max-width function
107 | max_: (value: number | string) => ({
108 | maxWidth: typeof value === 'string' ? value : value,
109 | }),
110 |
111 | // Dynamic min-width function
112 | min_: (value: number | string) => ({
113 | minWidth: typeof value === 'string' ? value : value,
114 | }),
115 | };
116 |
117 | export default w;
118 |
--------------------------------------------------------------------------------
/src/sizing/h.ts:
--------------------------------------------------------------------------------
1 | const h = {
2 | // Height properties
3 | h_0: { height: 0 },
4 | h_px: { height: 1 },
5 | h_1: { height: 4 },
6 | h_2: { height: 8 },
7 | h_3: { height: 12 },
8 | h_4: { height: 16 },
9 | h_5: { height: 20 },
10 | h_6: { height: 24 },
11 | h_7: { height: 28 },
12 | h_8: { height: 32 },
13 | h_9: { height: 36 },
14 | h_10: { height: 40 },
15 | h_11: { height: 44 },
16 | h_12: { height: 48 },
17 | h_14: { height: 56 },
18 | h_16: { height: 64 },
19 | h_20: { height: 80 },
20 | h_24: { height: 96 },
21 | h_28: { height: 112 },
22 | h_32: { height: 128 },
23 | h_36: { height: 144 },
24 | h_40: { height: 160 },
25 | h_44: { height: 176 },
26 | h_48: { height: 192 },
27 | h_52: { height: 208 },
28 | h_56: { height: 224 },
29 | h_60: { height: 240 },
30 | h_64: { height: 256 },
31 | h_72: { height: 288 },
32 | h_80: { height: 320 },
33 | h_96: { height: 384 },
34 |
35 | // Max-height properties
36 | max_0: { maxHeight: 0 },
37 | max_px: { maxHeight: 1 },
38 | max_1: { maxHeight: 4 },
39 | max_2: { maxHeight: 8 },
40 | max_3: { maxHeight: 12 },
41 | max_4: { maxHeight: 16 },
42 | max_5: { maxHeight: 20 },
43 | max_6: { maxHeight: 24 },
44 | max_7: { maxHeight: 28 },
45 | max_8: { maxHeight: 32 },
46 | max_9: { maxHeight: 36 },
47 | max_10: { maxHeight: 40 },
48 | max_11: { maxHeight: 44 },
49 | max_12: { maxHeight: 48 },
50 | max_14: { maxHeight: 56 },
51 | max_16: { maxHeight: 64 },
52 | max_20: { maxHeight: 80 },
53 | max_24: { maxHeight: 96 },
54 | max_28: { maxHeight: 112 },
55 | max_32: { maxHeight: 128 },
56 | max_36: { maxHeight: 144 },
57 | max_40: { maxHeight: 160 },
58 | max_44: { maxHeight: 176 },
59 | max_48: { maxHeight: 192 },
60 | max_52: { maxHeight: 208 },
61 | max_56: { maxHeight: 224 },
62 | max_60: { maxHeight: 240 },
63 | max_64: { maxHeight: 256 },
64 | max_72: { maxHeight: 288 },
65 | max_80: { maxHeight: 320 },
66 | max_96: { maxHeight: 384 },
67 |
68 | // Min-height properties
69 | min_0: { minHeight: 0 },
70 | min_px: { minHeight: 1 },
71 | min_1: { minHeight: 4 },
72 | min_2: { minHeight: 8 },
73 | min_3: { minHeight: 12 },
74 | min_4: { minHeight: 16 },
75 | min_5: { minHeight: 20 },
76 | min_6: { minHeight: 24 },
77 | min_7: { minHeight: 28 },
78 | min_8: { minHeight: 32 },
79 | min_9: { minHeight: 36 },
80 | min_10: { minHeight: 40 },
81 | min_11: { minHeight: 44 },
82 | min_12: { minHeight: 48 },
83 | min_14: { minHeight: 56 },
84 | min_16: { minHeight: 64 },
85 | min_20: { minHeight: 80 },
86 | min_24: { minHeight: 96 },
87 | min_28: { minHeight: 112 },
88 | min_32: { minHeight: 128 },
89 | min_36: { minHeight: 144 },
90 | min_40: { minHeight: 160 },
91 | min_44: { minHeight: 176 },
92 | min_48: { minHeight: 192 },
93 | min_52: { minHeight: 208 },
94 | min_56: { minHeight: 224 },
95 | min_60: { minHeight: 240 },
96 | min_64: { minHeight: 256 },
97 | min_72: { minHeight: 288 },
98 | min_80: { minHeight: 320 },
99 | min_96: { minHeight: 384 },
100 |
101 | // Dynamic height function
102 | h_: (value: number | string) => ({
103 | height: typeof value === 'string' ? value : value,
104 | }),
105 |
106 | // Dynamic max-height function
107 | max_: (value: number | string) => ({
108 | maxHeight: typeof value === 'string' ? value : value,
109 | }),
110 |
111 | // Dynamic min-height function
112 | min_: (value: number | string) => ({
113 | minHeight: typeof value === 'string' ? value : value,
114 | }),
115 | };
116 |
117 | export default h;
118 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Contributions are always welcome, no matter how large or small!
4 |
5 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
6 |
7 | ## Table of Contents
8 |
9 | - [How to Contribute](#how-to-contribute)
10 | - [Setting up your local clone](#setting-up-your-local-clone)
11 | - [Working on Issue](#working-on-an-issue)
12 | - [Opening Pull Request](#opening-a-pull-request)
13 |
14 | ### How to Contribute
15 |
16 | #### Setting Up Your Local Clone
17 |
18 | Before you begin working on anything, make sure you follow these steps in order to set up a clone on your local machine:
19 |
20 | 1. Clone the repo in your local environment. If you don't know how to do so, follow the GitHub documentation on how to [fork a repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
21 |
22 | 2. Clone the forked repo to your local machine with one of the commands below. You can also read the GitHub documentation on [cloning a repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
23 |
24 | ```bash
25 | # If you have SSH set up with Git:
26 | git clone git@github.com:nativeflowteam/nativeflowcss.git
27 | # Otherwise for HTTPS:
28 | git clone https://github.com/nativeflowteam/nativeflowcss.git
29 | ```
30 |
31 | 3. `cd` into the directory of your local clone, remember to always pull the `main` branch before you branch out from it to continue working on other sections' respective branches.
32 |
33 | #### Working on an Issue
34 |
35 | Once you have the repo cloned, and the local environment has been set, you can begin working on your issue:
36 |
37 | 1. Create a new branch, replacing the `` with an actual branch name that briefly explains the purpose of the branch in some way:
38 |
39 | ```bash
40 | git checkout -b
41 |
42 | # Some examples:
43 | git checkout -b docs_update
44 | git checkout -b shadow_nits
45 | git checkout -b size_value_update
46 | ```
47 |
48 | 2. Add commits as you work on your issue, replacing the `` text with your actual commit message:
49 |
50 | ```bash
51 | git commit -m "" -m ""
52 |
53 | # An example:
54 | git commit -m "Update README file" -m "Add how-to build from source"
55 | ```
56 |
57 | 3. Sync your local environment every often so that you don't lose on any newer progress.
58 | - Firstly sync your fork with the latest added commits using GitHub GUI.
59 |
60 | 
61 |
62 | - Then pull those changes into your cloned repository.
63 |
64 | ```bash
65 | git pull
66 | ```
67 |
68 | 4. Push your branch to our repo, replacing the `` with the branch you've been working on locally:
69 |
70 | ```bash
71 | git push origin
72 |
73 | # An example:
74 | git push origin size_fix
75 | ```
76 |
77 | #### Opening a Pull Request
78 |
79 | 1. After pushing your changes, go to our repo on GitHub and click the "Compare & pull request" button. If you have multiple of these buttons, be sure you click the one for the correct branch.
80 | - If you don't see this button, you can click the branch dropdown menu and then select the branch you just pushed from your local clone:
81 |
82 | 
83 | - Once you have switched to the correct branch on GitHub, click the "Contribute" dropdown and click the "Open pull request" button.
84 |
85 | 2. Fill the PR template summarising all new additions to your repositories, don't directly merge without a review by maintainers.
86 |
87 | 3. After your PR has been merged, delete it on the repo, just below the merged notification in the PR, there's an option to delete it, also delete that branch in your local environment and checkout to main to pull the updates.
88 |
89 | ```bash
90 | git branch -D branch_name
91 | git checkout main && git pull # pull only works if you synced your fork with main repo
92 | ```
93 |
94 | **Thanks for contributing to our repo, Happy Coding <3 !**
95 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativeflowcss",
3 | "version": "1.2.22",
4 | "description": "A utility-first styling objects for React Native, syntax similar to Tailwind.",
5 | "source": "./src/index.ts",
6 | "main": "./lib/commonjs/index.js",
7 | "module": "./lib/module/index.js",
8 | "exports": {
9 | ".": {
10 | "import": {
11 | "types": "./lib/typescript/module/src/index.d.ts",
12 | "default": "./lib/module/index.js"
13 | },
14 | "require": {
15 | "types": "./lib/typescript/commonjs/src/index.d.ts",
16 | "default": "./lib/commonjs/index.js"
17 | }
18 | }
19 | },
20 | "files": [
21 | "src",
22 | "lib",
23 | "android",
24 | "ios",
25 | "cpp",
26 | "*.podspec",
27 | "!ios/build",
28 | "!android/build",
29 | "!android/gradle",
30 | "!android/gradlew",
31 | "!android/gradlew.bat",
32 | "!android/local.properties",
33 | "!**/__tests__",
34 | "!**/__fixtures__",
35 | "!**/__mocks__",
36 | "!**/.*"
37 | ],
38 | "scripts": {
39 | "example": "npm run example --workspace=example",
40 | "test": "jest",
41 | "typecheck": "tsc",
42 | "lint": "eslint \"**/*.{js,ts}\"",
43 | "clean": "del-cli lib",
44 | "prepare": "bob build",
45 | "release": "release-it"
46 | },
47 | "keywords": [
48 | "react-native",
49 | "tailwind-css",
50 | "utility-first",
51 | "css-in-js",
52 | "no-babel",
53 | "easy-setup",
54 | "one-package",
55 | "ui-library",
56 | "mobile-ui",
57 | "cross-platform",
58 | "ios",
59 | "android",
60 | "flexbox",
61 | "minimalist",
62 | "tailwind",
63 | "responsive",
64 | "design-system",
65 | "native",
66 | "styling",
67 | "lightweight",
68 | "performance",
69 | "customizable",
70 | "theme",
71 | "mobile-first",
72 | "react-native-styling",
73 | "react-native-tailwind",
74 | "react-native-utility"
75 | ],
76 | "repository": {
77 | "type": "git",
78 | "url": "git+https://github.com/nativeflowteam/nativeflowcss"
79 | },
80 | "author": "Jay Singh (https://github.com/nativeflowteam)",
81 | "license": "MIT",
82 | "bugs": {
83 | "url": "https://github.com/nativeflowcrafts/nativeflowcss/issues"
84 | },
85 | "homepage": "https://nativeflow.js.org",
86 | "publishConfig": {
87 | "registry": "https://registry.npmjs.org/"
88 | },
89 | "devDependencies": {
90 | "@commitlint/config-conventional": "^17.0.2",
91 | "@evilmartians/lefthook": "^1.5.0",
92 | "@react-native/eslint-config": "^0.73.1",
93 | "@release-it/conventional-changelog": "^8.0.1",
94 | "@types/jest": "^29.5.5",
95 | "@types/react": "^18.2.44",
96 | "commitlint": "^17.0.2",
97 | "del-cli": "^5.1.0",
98 | "eslint": "^8.51.0",
99 | "eslint-config-prettier": "^9.0.0",
100 | "eslint-plugin-prettier": "^5.0.1",
101 | "jest": "^29.7.0",
102 | "prettier": "^3.0.3",
103 | "react": "18.2.0",
104 | "react-native": "0.74.5",
105 | "react-native-builder-bob": "^0.30.0",
106 | "release-it": "^17.6.0",
107 | "typescript": "^5.2.2"
108 | },
109 | "resolutions": {
110 | "@types/react": "^18.2.44"
111 | },
112 | "peerDependencies": {
113 | "react": "*",
114 | "react-native": "*"
115 | },
116 | "workspaces": [
117 | "example"
118 | ],
119 | "jest": {
120 | "preset": "react-native",
121 | "modulePathIgnorePatterns": [
122 | "/example/node_modules",
123 | "/lib/"
124 | ]
125 | },
126 | "commitlint": {
127 | "extends": [
128 | "@commitlint/config-conventional"
129 | ]
130 | },
131 | "release-it": {
132 | "git": {
133 | "commitMessage": "chore: release ${version}",
134 | "tagName": "v${version}"
135 | },
136 | "npm": {
137 | "publish": true
138 | },
139 | "github": {
140 | "release": true
141 | },
142 | "plugins": {
143 | "@release-it/conventional-changelog": {
144 | "preset": "angular"
145 | }
146 | }
147 | },
148 | "create-react-native-library": {
149 | "type": "library",
150 | "version": "0.41.0"
151 | },
152 | "directories": {
153 | "example": "example",
154 | "lib": "lib"
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/src/typography/text.ts:
--------------------------------------------------------------------------------
1 | import type { TextStyle } from 'react-native';
2 | import type { ColuredTextStyle } from '../types/typography';
3 | import colorList from '../utils/colorList';
4 |
5 | const text: ColuredTextStyle = {
6 | // color
7 | color_: (value: string): TextStyle => ({
8 | color: value,
9 | }),
10 |
11 | // Font family
12 | font_family: (path: string): TextStyle => ({
13 | fontFamily: path,
14 | }),
15 |
16 | // Font sizes and line heights
17 | fs_xs: { fontSize: 12, lineHeight: 16 },
18 | fs_sm: { fontSize: 14, lineHeight: 20 },
19 | fs_base: { fontSize: 16, lineHeight: 24 },
20 | fs_lg: { fontSize: 18, lineHeight: 28 },
21 | fs_xl: { fontSize: 20, lineHeight: 28 },
22 | fs_2xl: { fontSize: 24, lineHeight: 32 },
23 | fs_3xl: { fontSize: 30, lineHeight: 36 },
24 | fs_4xl: { fontSize: 36, lineHeight: 40 },
25 | fs_5xl: { fontSize: 48, lineHeight: 48 },
26 | fs_6xl: { fontSize: 60, lineHeight: 60 },
27 | fs_7xl: { fontSize: 72, lineHeight: 72 },
28 | fs_8xl: { fontSize: 96, lineHeight: 96 },
29 | fs_9xl: { fontSize: 128, lineHeight: 128 },
30 |
31 | // Font styles
32 | italic: { fontStyle: 'italic' as TextStyle['fontStyle'] },
33 | non_italic: { fontStyle: 'normal' as TextStyle['fontStyle'] },
34 |
35 | // Font weights
36 | fw_thin: { fontWeight: '100' as TextStyle['fontWeight'] },
37 | fw_extralight: { fontWeight: '200' as TextStyle['fontWeight'] },
38 | fw_light: { fontWeight: '300' as TextStyle['fontWeight'] },
39 | fw_normal: { fontWeight: '400' as TextStyle['fontWeight'] },
40 | fw_medium: { fontWeight: '500' as TextStyle['fontWeight'] },
41 | fw_semibold: { fontWeight: '600' as TextStyle['fontWeight'] },
42 | fw_bold: { fontWeight: '700' as TextStyle['fontWeight'] },
43 | fw_extrabold: { fontWeight: '800' as TextStyle['fontWeight'] },
44 | fw_black: { fontWeight: '900' as TextStyle['fontWeight'] },
45 |
46 | // Font variants
47 | smallcaps: {
48 | /*ios*/ fontVariant: ['small-caps'] as TextStyle['fontVariant'],
49 | },
50 | oldstyle: {
51 | /*ios*/ fontVariant: ['oldstyle-nums'] as TextStyle['fontVariant'],
52 | },
53 | lining: { /*ios*/ fontVariant: ['lining-nums'] as TextStyle['fontVariant'] },
54 | tabular: {
55 | /*ios*/ fontVariant: ['tabular-nums'] as TextStyle['fontVariant'],
56 | },
57 | proportional: {
58 | /*ios*/ fontVariant: ['proportional-nums'] as TextStyle['fontVariant'],
59 | },
60 |
61 | // Text transforms
62 | none: { textTransform: 'none' as TextStyle['textTransform'] },
63 | uppercase: { textTransform: 'uppercase' as TextStyle['textTransform'] },
64 | lowercase: { textTransform: 'lowercase' as TextStyle['textTransform'] },
65 | capitalize: { textTransform: 'capitalize' as TextStyle['textTransform'] },
66 |
67 | // Letter spacing
68 | tracking_tighter: { /*ios*/ letterSpacing: -2 },
69 | tracking_tight: { /*ios*/ letterSpacing: -1 },
70 | tracking_normal: { /*ios*/ letterSpacing: 0 },
71 | tracking_wide: { /*ios*/ letterSpacing: 1 },
72 | tracking_wider: { /*ios*/ letterSpacing: 2 },
73 | tracking_widest: { /*ios*/ letterSpacing: 3 },
74 |
75 | // Text alignment
76 | auto: { textAlign: 'auto' as TextStyle['textAlign'] },
77 | left: { textAlign: 'left' as TextStyle['textAlign'] },
78 | right: { textAlign: 'right' as TextStyle['textAlign'] },
79 | center: { textAlign: 'center' as TextStyle['textAlign'] },
80 | justify: { textAlign: 'justify' as TextStyle['textAlign'] },
81 |
82 | // Text shadow
83 | shadow_color_: (color: string): TextStyle => ({
84 | textShadowColor: color,
85 | }),
86 |
87 | shadow_offset_: (
88 | widthVal: number | string,
89 | heightVal: number | string
90 | ): TextStyle => ({
91 | textShadowOffset: { width: Number(widthVal), height: Number(heightVal) },
92 | }),
93 |
94 | shadow_radius_: (radius: number | string): TextStyle => ({
95 | textShadowRadius: Number(radius),
96 | }),
97 |
98 | // User select
99 | select_auto: { userSelect: 'auto' as TextStyle['userSelect'] },
100 | select_text: { userSelect: 'text' as TextStyle['userSelect'] },
101 | select_none: { userSelect: 'none' as TextStyle['userSelect'] },
102 | select_contain: { userSelect: 'contain' as TextStyle['userSelect'] },
103 | select_all: { userSelect: 'all' as TextStyle['userSelect'] },
104 | };
105 |
106 | // Dynamically add color properties
107 | Object.keys(colorList).forEach((colorKey) => {
108 | text[`color_${colorKey}`] = {
109 | color: colorList[colorKey],
110 | };
111 | });
112 |
113 | // Dynamically add shadow color properties
114 | Object.keys(colorList).forEach((colorKey) => {
115 | text[`shadow_color_${colorKey}`] = {
116 | textShadowColor: colorList[colorKey],
117 | };
118 | });
119 |
120 | // Dynamically add shadow radius properties
121 | for (let i = 1; i <= 24; i++) {
122 | text[`shadow_radius_${i}`] = { textShadowRadius: i };
123 | }
124 |
125 | // Dynamically add shadow offset properties
126 | for (let i = 1; i <= 24; i++) {
127 | text[`shadow_offset_${i}`] = { textShadowOffset: { width: i, height: i } };
128 | }
129 |
130 | export default text;
131 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, caste, color, religion, or sexual
10 | identity and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | - Demonstrating empathy and kindness toward other people
21 | - Being respectful of differing opinions, viewpoints, and experiences
22 | - Giving and gracefully accepting constructive feedback
23 | - Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | - Focusing on what is best not just for us as individuals, but for the overall
26 | community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | - The use of sexualized language or imagery, and sexual attention or advances of
31 | any kind
32 | - Trolling, insulting or derogatory comments, and personal or political attacks
33 | - Public or private harassment
34 | - Publishing others' private information, such as a physical or email address,
35 | without their explicit permission
36 | - Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | [nativeflowteam@gmail.com](mailto:nativeflowteam@gmail.com).
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series of
86 | actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or permanent
93 | ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within the
113 | community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.1, available at
119 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120 |
121 | Community Impact Guidelines were inspired by
122 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123 |
124 | For answers to common questions about this code of conduct, see the FAQ at
125 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126 | [https://www.contributor-covenant.org/translations][translations].
127 |
128 | [homepage]: https://www.contributor-covenant.org
129 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130 | [Mozilla CoC]: https://github.com/mozilla/diversity
131 | [FAQ]: https://www.contributor-covenant.org/faq
132 | [translations]: https://www.contributor-covenant.org/translations
133 |
--------------------------------------------------------------------------------
/src/utils/colorList.ts:
--------------------------------------------------------------------------------
1 | const colorList: { [key: string]: string } = {
2 | slate_50: '#f8fafc',
3 | slate_100: '#f1f5f9',
4 | slate_200: '#e2e8f0',
5 | slate_300: '#cbd5e1',
6 | slate_400: '#94a3b8',
7 | slate_500: '#64748b',
8 | slate_600: '#475569',
9 | slate_700: '#334155',
10 | slate_800: '#1e293b',
11 | slate_900: '#0f172a',
12 | slate_950: '#020617',
13 |
14 | gray_50: '#f9fafb',
15 | gray_100: '#f3f4f6',
16 | gray_200: '#e5e7eb',
17 | gray_300: '#d1d5db',
18 | gray_400: '#9ca3af',
19 | gray_500: '#6b7280',
20 | gray_600: '#4b5563',
21 | gray_700: '#374151',
22 | gray_800: '#1f2937',
23 | gray_900: '#111827',
24 | gray_950: '#030712',
25 |
26 | zinc_50: '#fafafa',
27 | zinc_100: '#f4f4f5',
28 | zinc_200: '#e4e4e7',
29 | zinc_300: '#d4d4d8',
30 | zinc_400: '#a1a1aa',
31 | zinc_500: '#71717a',
32 | zinc_600: '#52525b',
33 | zinc_700: '#3f3f46',
34 | zinc_800: '#27272a',
35 | zinc_900: '#18181b',
36 | zinc_950: '#09090b',
37 |
38 | neutral_50: '#fafafa',
39 | neutral_100: '#f5f5f5',
40 | neutral_200: '#e5e5e5',
41 | neutral_300: '#d4d4d4',
42 | neutral_400: '#a3a3a3',
43 | neutral_500: '#737373',
44 | neutral_600: '#525252',
45 | neutral_700: '#404040',
46 | neutral_800: '#262626',
47 | neutral_900: '#171717',
48 | neutral_950: '#0a0a0a',
49 |
50 | stone_50: '#fafaf9',
51 | stone_100: '#f5f5f4',
52 | stone_200: '#e7e5e4',
53 | stone_300: '#d6d3d1',
54 | stone_400: '#a8a29e',
55 | stone_500: '#78716c',
56 | stone_600: '#57534e',
57 | stone_700: '#44403c',
58 | stone_800: '#292524',
59 | stone_900: '#1c1917',
60 | stone_950: '#0c0a09',
61 |
62 | red_50: '#fef2f2',
63 | red_100: '#fee2e2',
64 | red_200: '#fecaca',
65 | red_300: '#fca5a5',
66 | red_400: '#f87171',
67 | red_500: '#ef4444',
68 | red_600: '#dc2626',
69 | red_700: '#b91c1c',
70 | red_800: '#991b1b',
71 | red_900: '#7f1d1d',
72 | red_950: '#450a0a',
73 |
74 | orange_50: '#fff7ed',
75 | orange_100: '#ffedd5',
76 | orange_200: '#fed7aa',
77 | orange_300: '#fdba74',
78 | orange_400: '#fb923c',
79 | orange_500: '#f97316',
80 | orange_600: '#ea580c',
81 | orange_700: '#c2410c',
82 | orange_800: '#9a3412',
83 | orange_900: '#7c2d12',
84 | orange_950: '#431407',
85 |
86 | amber_50: '#fffbeb',
87 | amber_100: '#fef3c7',
88 | amber_200: '#fde68a',
89 | amber_300: '#fcd34d',
90 | amber_400: '#fbbf24',
91 | amber_500: '#f59e0b',
92 | amber_600: '#d97706',
93 | amber_700: '#b45309',
94 | amber_800: '#92400e',
95 | amber_900: '#78350f',
96 | amber_950: '#451a03',
97 |
98 | yellow_50: '#fefce8',
99 | yellow_100: '#fef9c3',
100 | yellow_200: '#fef08a',
101 | yellow_300: '#fde047',
102 | yellow_400: '#facc15',
103 | yellow_500: '#eab308',
104 | yellow_600: '#ca8a04',
105 | yellow_700: '#a16207',
106 | yellow_800: '#854d0e',
107 | yellow_900: '#713f12',
108 | yellow_950: '#422006',
109 |
110 | lime_50: '#f7fee7',
111 | lime_100: '#ecfccb',
112 | lime_200: '#d9f99d',
113 | lime_300: '#bef264',
114 | lime_400: '#a3e635',
115 | lime_500: '#84cc16',
116 | lime_600: '#65a30d',
117 | lime_700: '#4d7c0f',
118 | lime_800: '#3f6212',
119 | lime_900: '#365314',
120 | lime_950: '#1a2e05',
121 |
122 | green_50: '#f0fdf4',
123 | green_100: '#dcfce7',
124 | green_200: '#bbf7d0',
125 | green_300: '#86efac',
126 | green_400: '#4ade80',
127 | green_500: '#22c55e',
128 | green_600: '#16a34a',
129 | green_700: '#15803d',
130 | green_800: '#166534',
131 | green_900: '#14532d',
132 | green_950: '#052e16',
133 |
134 | emerald_50: '#ecfdf5',
135 | emerald_100: '#d1fae5',
136 | emerald_200: '#a7f3d0',
137 | emerald_300: '#6ee7b7',
138 | emerald_400: '#34d399',
139 | emerald_500: '#10b981',
140 | emerald_600: '#059669',
141 | emerald_700: '#047857',
142 | emerald_800: '#065f46',
143 | emerald_900: '#064e3b',
144 | emerald_950: '#022c22',
145 |
146 | teal_50: '#f0fdfa',
147 | teal_100: '#ccfbf1',
148 | teal_200: '#99f6e4',
149 | teal_300: '#5eead4',
150 | teal_400: '#2dd4bf',
151 | teal_500: '#14b8a6',
152 | teal_600: '#0d9488',
153 | teal_700: '#0f766e',
154 | teal_800: '#115e59',
155 | teal_900: '#134e4a',
156 | teal_950: '#042f2e',
157 |
158 | cyan_50: '#ecfeff',
159 | cyan_100: '#cffafe',
160 | cyan_200: '#a5f3fc',
161 | cyan_300: '#67e8f9',
162 | cyan_400: '#22d3ee',
163 | cyan_500: '#06b6d4',
164 | cyan_600: '#0891b2',
165 | cyan_700: '#0e7490',
166 | cyan_800: '#155e75',
167 | cyan_900: '#164e63',
168 | cyan_950: '#083344',
169 |
170 | sky_50: '#f0f9ff',
171 | sky_100: '#e0f2fe',
172 | sky_200: '#bae6fd',
173 | sky_300: '#7dd3fc',
174 | sky_400: '#38bdf8',
175 | sky_500: '#0ea5e9',
176 | sky_600: '#0284c7',
177 | sky_700: '#0369a1',
178 | sky_800: '#075985',
179 | sky_900: '#0c4a6e',
180 | sky_950: '#082f49',
181 |
182 | blue_50: '#eff6ff',
183 | blue_100: '#dbeafe',
184 | blue_200: '#bfdbfe',
185 | blue_300: '#93c5fd',
186 | blue_400: '#60a5fa',
187 | blue_500: '#3b82f6',
188 | blue_600: '#2563eb',
189 | blue_700: '#1d4ed8',
190 | blue_800: '#1e40af',
191 | blue_900: '#1e3a8a',
192 | blue_950: '#172554',
193 |
194 | indigo_50: '#eef2ff',
195 | indigo_100: '#e0e7ff',
196 | indigo_200: '#c7d2fe',
197 | indigo_300: '#a5b4fc',
198 | indigo_400: '#818cf8',
199 | indigo_500: '#6366f1',
200 | indigo_600: '#4f46e5',
201 | indigo_700: '#4338ca',
202 | indigo_800: '#3730a3',
203 | indigo_900: '#312e81',
204 | indigo_950: '#1e1b4b',
205 |
206 | violet_50: '#f5f3ff',
207 | violet_100: '#ede9fe',
208 | violet_200: '#ddd6fe',
209 | violet_300: '#c4b5fd',
210 | violet_400: '#a78bfa',
211 | violet_500: '#8b5cf6',
212 | violet_600: '#7c3aed',
213 | violet_700: '#6d28d9',
214 | violet_800: '#5b21b6',
215 | violet_900: '#4c1d95',
216 | violet_950: '#2e1065',
217 |
218 | purple_50: '#faf5ff',
219 | purple_100: '#f3e8ff',
220 | purple_200: '#e9d5ff',
221 | purple_300: '#d8b4fe',
222 | purple_400: '#c084fc',
223 | purple_500: '#a855f7',
224 | purple_600: '#9333ea',
225 | purple_700: '#7e22ce',
226 | purple_800: '#6b21a8',
227 | purple_900: '#581c87',
228 | purple_950: '#3b0764',
229 |
230 | fuchsia_50: '#fdf4ff',
231 | fuchsia_100: '#fae8ff',
232 | fuchsia_200: '#f5d0fe',
233 | fuchsia_300: '#f0abfc',
234 | fuchsia_400: '#e879f9',
235 | fuchsia_500: '#d946ef',
236 | fuchsia_600: '#c026d3',
237 | fuchsia_700: '#a21caf',
238 | fuchsia_800: '#86198f',
239 | fuchsia_900: '#701a75',
240 | fuchsia_950: '#4a044e',
241 |
242 | pink_50: '#fdf2f8',
243 | pink_100: '#fce7f3',
244 | pink_200: '#fbcfe8',
245 | pink_300: '#f9a8d4',
246 | pink_400: '#f472b6',
247 | pink_500: '#ec4899',
248 | pink_600: '#db2777',
249 | pink_700: '#be185d',
250 | pink_800: '#9d174d',
251 | pink_900: '#831843',
252 | pink_950: '#500724',
253 |
254 | rose_50: '#fff1f2',
255 | rose_100: '#ffe4e6',
256 | rose_200: '#fecdd3',
257 | rose_300: '#fda4af',
258 | rose_400: '#fb7185',
259 | rose_500: '#f43f5e',
260 | rose_600: '#e11d48',
261 | rose_700: '#be123c',
262 | rose_800: '#9f1239',
263 | rose_900: '#881337',
264 | rose_950: '#4c0519',
265 | };
266 |
267 | export default colorList;
268 |
--------------------------------------------------------------------------------
/src/flexbox/flex.ts:
--------------------------------------------------------------------------------
1 | import type { Flex } from '../types/flexbox';
2 |
3 | const flex = {
4 | // Function to handle dynamic flex values
5 | f_: (num: number | string = 1): Flex => ({
6 | flex: Number(num),
7 | }),
8 |
9 | f_1: { flex: 1 } as Flex,
10 | f_2: { flex: 2 } as Flex,
11 | f_3: { flex: 3 } as Flex,
12 | f_4: { flex: 4 } as Flex,
13 | f_5: { flex: 5 } as Flex,
14 | f_6: { flex: 6 } as Flex,
15 | f_7: { flex: 7 } as Flex,
16 | f_8: { flex: 8 } as Flex,
17 | f_9: { flex: 9 } as Flex,
18 |
19 | // Function to handle dynamic gap values
20 | gap_: (num: number | string = 0): Flex => ({
21 | gap: Number(num),
22 | }),
23 |
24 | // Gap properties
25 | gap_0: {
26 | gap: 0,
27 | } as Flex,
28 | gap_1: {
29 | gap: 4,
30 | } as Flex,
31 | gap_2: {
32 | gap: 8,
33 | } as Flex,
34 | gap_3: {
35 | gap: 12,
36 | } as Flex,
37 | gap_4: {
38 | gap: 16,
39 | } as Flex,
40 | gap_5: {
41 | gap: 20,
42 | } as Flex,
43 | gap_6: {
44 | gap: 24,
45 | } as Flex,
46 | gap_7: {
47 | gap: 28,
48 | } as Flex,
49 | gap_8: {
50 | gap: 32,
51 | } as Flex,
52 | gap_9: {
53 | gap: 36,
54 | } as Flex,
55 | gap_10: {
56 | gap: 40,
57 | } as Flex,
58 | gap_11: {
59 | gap: 44,
60 | } as Flex,
61 | gap_12: {
62 | gap: 48,
63 | } as Flex,
64 | gap_14: {
65 | gap: 56,
66 | } as Flex,
67 | gap_16: {
68 | gap: 64,
69 | } as Flex,
70 | gap_20: {
71 | gap: 80,
72 | } as Flex,
73 | gap_24: {
74 | gap: 96,
75 | } as Flex,
76 | gap_28: {
77 | gap: 112,
78 | } as Flex,
79 | gap_32: {
80 | gap: 128,
81 | } as Flex,
82 | gap_36: {
83 | gap: 144,
84 | } as Flex,
85 | gap_40: {
86 | gap: 160,
87 | } as Flex,
88 | gap_44: {
89 | gap: 176,
90 | } as Flex,
91 | gap_48: {
92 | gap: 192,
93 | } as Flex,
94 | gap_52: {
95 | gap: 208,
96 | } as Flex,
97 | gap_56: {
98 | gap: 224,
99 | } as Flex,
100 | gap_60: {
101 | gap: 240,
102 | } as Flex,
103 | gap_64: {
104 | gap: 256,
105 | } as Flex,
106 | gap_72: {
107 | gap: 288,
108 | } as Flex,
109 | gap_80: {
110 | gap: 320,
111 | } as Flex,
112 | gap_96: {
113 | gap: 384,
114 | } as Flex,
115 |
116 | // Function to handle dynamic row gap values
117 | gap_x_: (num: number | string = 0): Flex => ({
118 | rowGap: Number(num),
119 | }),
120 |
121 | // Row gap properties
122 | gap_x_0: {
123 | rowGap: 0,
124 | } as Flex,
125 | gap_x_1: {
126 | rowGap: 4,
127 | } as Flex,
128 | gap_x_2: {
129 | rowGap: 8,
130 | } as Flex,
131 | gap_x_3: {
132 | rowGap: 12,
133 | } as Flex,
134 | gap_x_4: {
135 | rowGap: 16,
136 | } as Flex,
137 | gap_x_5: {
138 | rowGap: 20,
139 | } as Flex,
140 | gap_x_6: {
141 | rowGap: 24,
142 | } as Flex,
143 | gap_x_7: {
144 | rowGap: 28,
145 | } as Flex,
146 | gap_x_8: {
147 | rowGap: 32,
148 | } as Flex,
149 | gap_x_9: {
150 | rowGap: 36,
151 | } as Flex,
152 | gap_x_10: {
153 | rowGap: 40,
154 | } as Flex,
155 | gap_x_11: {
156 | rowGap: 44,
157 | } as Flex,
158 | gap_x_12: {
159 | rowGap: 48,
160 | } as Flex,
161 | gap_x_14: {
162 | rowGap: 56,
163 | } as Flex,
164 | gap_x_16: {
165 | rowGap: 64,
166 | } as Flex,
167 | gap_x_20: {
168 | rowGap: 80,
169 | } as Flex,
170 | gap_x_24: {
171 | rowGap: 96,
172 | } as Flex,
173 | gap_x_28: {
174 | rowGap: 112,
175 | } as Flex,
176 | gap_x_32: {
177 | rowGap: 128,
178 | } as Flex,
179 | gap_x_36: {
180 | rowGap: 144,
181 | } as Flex,
182 | gap_x_40: {
183 | rowGap: 160,
184 | } as Flex,
185 | gap_x_44: {
186 | rowGap: 176,
187 | } as Flex,
188 | gap_x_48: {
189 | rowGap: 192,
190 | } as Flex,
191 | gap_x_52: {
192 | rowGap: 208,
193 | } as Flex,
194 | gap_x_56: {
195 | rowGap: 224,
196 | } as Flex,
197 | gap_x_60: {
198 | rowGap: 240,
199 | } as Flex,
200 | gap_x_64: {
201 | rowGap: 256,
202 | } as Flex,
203 | gap_x_72: {
204 | rowGap: 288,
205 | } as Flex,
206 | gap_x_80: {
207 | rowGap: 320,
208 | } as Flex,
209 | gap_x_96: {
210 | rowGap: 384,
211 | } as Flex,
212 |
213 | // Function to handle dynamic column gap values
214 | gap_y_: (num: number | string = 0): Flex => ({
215 | columnGap: Number(num),
216 | }),
217 |
218 | // Column gap properties
219 | gap_y_0: {
220 | columnGap: 0,
221 | } as Flex,
222 | gap_y_1: {
223 | columnGap: 4,
224 | } as Flex,
225 | gap_y_2: {
226 | columnGap: 8,
227 | } as Flex,
228 | gap_y_3: {
229 | columnGap: 12,
230 | } as Flex,
231 | gap_y_4: {
232 | columnGap: 16,
233 | } as Flex,
234 | gap_y_5: {
235 | columnGap: 20,
236 | } as Flex,
237 | gap_y_6: {
238 | columnGap: 24,
239 | } as Flex,
240 | gap_y_7: {
241 | columnGap: 28,
242 | } as Flex,
243 | gap_y_8: {
244 | columnGap: 32,
245 | } as Flex,
246 | gap_y_9: {
247 | columnGap: 36,
248 | } as Flex,
249 | gap_y_10: {
250 | columnGap: 40,
251 | } as Flex,
252 | gap_y_11: {
253 | columnGap: 44,
254 | } as Flex,
255 | gap_y_12: {
256 | columnGap: 48,
257 | } as Flex,
258 | gap_y_14: {
259 | columnGap: 56,
260 | } as Flex,
261 | gap_y_16: {
262 | columnGap: 64,
263 | } as Flex,
264 | gap_y_20: {
265 | columnGap: 80,
266 | } as Flex,
267 | gap_y_24: {
268 | columnGap: 96,
269 | } as Flex,
270 | gap_y_28: {
271 | columnGap: 112,
272 | } as Flex,
273 | gap_y_32: {
274 | columnGap: 128,
275 | } as Flex,
276 | gap_y_36: {
277 | columnGap: 144,
278 | } as Flex,
279 | gap_y_40: {
280 | columnGap: 160,
281 | } as Flex,
282 | gap_y_44: {
283 | columnGap: 176,
284 | } as Flex,
285 | gap_y_48: {
286 | columnGap: 192,
287 | } as Flex,
288 | gap_y_52: {
289 | columnGap: 208,
290 | } as Flex,
291 | gap_y_56: {
292 | columnGap: 224,
293 | } as Flex,
294 | gap_y_60: {
295 | columnGap: 240,
296 | } as Flex,
297 | gap_y_64: {
298 | columnGap: 256,
299 | } as Flex,
300 | gap_y_72: {
301 | columnGap: 288,
302 | } as Flex,
303 | gap_y_80: {
304 | columnGap: 320,
305 | } as Flex,
306 | gap_y_96: {
307 | columnGap: 384,
308 | } as Flex,
309 |
310 | // Flex direction properties
311 | row: {
312 | flexDirection: 'row',
313 | } as Flex,
314 | row_reverse: {
315 | flexDirection: 'row-reverse',
316 | } as Flex,
317 | col: {
318 | flexDirection: 'column',
319 | } as Flex,
320 | column_reverse: {
321 | flexDirection: 'column-reverse',
322 | } as Flex,
323 |
324 | // Flex grow properties
325 | grow: {
326 | flexGrow: 1,
327 | } as Flex,
328 | grow_0: {
329 | flexGrow: 0,
330 | } as Flex,
331 |
332 | // Flex shrink properties
333 | shrink: {
334 | flexShrink: 1,
335 | } as Flex,
336 | shrink_0: {
337 | flexShrink: 0,
338 | } as Flex,
339 |
340 | // Flex wrap properties
341 | wrap: {
342 | flexWrap: 'wrap',
343 | } as Flex,
344 | wrap_reverse: {
345 | flexWrap: 'wrap-reverse',
346 | } as Flex,
347 | nowrap: {
348 | flexWrap: 'nowrap',
349 | } as Flex,
350 |
351 | // Function to handle dynamic flex basis values
352 | basis_: (value: string | number = 'auto'): Flex => ({
353 | flexBasis: value === 'auto' ? value : Number(value),
354 | }),
355 |
356 | // Flex basis properties
357 | basis_0: {
358 | flexBasis: 0,
359 | } as Flex,
360 | basis_1: {
361 | flexBasis: 4,
362 | } as Flex,
363 | basis_2: {
364 | flexBasis: 8,
365 | } as Flex,
366 | basis_3: {
367 | flexBasis: 12,
368 | } as Flex,
369 | basis_4: {
370 | flexBasis: 16,
371 | } as Flex,
372 | basis_5: {
373 | flexBasis: 20,
374 | } as Flex,
375 | basis_6: {
376 | flexBasis: 24,
377 | } as Flex,
378 | basis_7: {
379 | flexBasis: 28,
380 | } as Flex,
381 | basis_8: {
382 | flexBasis: 32,
383 | } as Flex,
384 | basis_9: {
385 | flexBasis: 36,
386 | } as Flex,
387 | basis_10: {
388 | flexBasis: 40,
389 | } as Flex,
390 | basis_11: {
391 | flexBasis: 44,
392 | } as Flex,
393 | basis_12: {
394 | flexBasis: 48,
395 | } as Flex,
396 | basis_14: {
397 | flexBasis: 56,
398 | } as Flex,
399 | basis_16: {
400 | flexBasis: 64,
401 | } as Flex,
402 | basis_20: {
403 | flexBasis: 80,
404 | } as Flex,
405 | basis_24: {
406 | flexBasis: 96,
407 | } as Flex,
408 | basis_28: {
409 | flexBasis: 112,
410 | } as Flex,
411 | basis_32: {
412 | flexBasis: 128,
413 | } as Flex,
414 | basis_36: {
415 | flexBasis: 144,
416 | } as Flex,
417 | basis_40: {
418 | flexBasis: 160,
419 | } as Flex,
420 | basis_44: {
421 | flexBasis: 176,
422 | } as Flex,
423 | basis_48: {
424 | flexBasis: 192,
425 | } as Flex,
426 | basis_52: {
427 | flexBasis: 208,
428 | } as Flex,
429 | basis_56: {
430 | flexBasis: 224,
431 | } as Flex,
432 | basis_60: {
433 | flexBasis: 240,
434 | } as Flex,
435 | basis_64: {
436 | flexBasis: 256,
437 | } as Flex,
438 | basis_72: {
439 | flexBasis: 288,
440 | } as Flex,
441 | basis_80: {
442 | flexBasis: 320,
443 | } as Flex,
444 | basis_96: {
445 | flexBasis: 384,
446 | } as Flex,
447 | basis_auto: {
448 | flexBasis: 'auto',
449 | } as Flex,
450 | basis_px: {
451 | flexBasis: 1,
452 | } as Flex,
453 | };
454 |
455 | export default flex;
456 |
--------------------------------------------------------------------------------
/src/border/bdr.ts:
--------------------------------------------------------------------------------
1 | import type { TextStyle } from 'react-native';
2 | import type { BorderStyles } from '../types/border';
3 | import colorList from '../utils/colorList';
4 |
5 | const bdr: BorderStyles = {
6 | // Border color
7 | color_: (value: string): TextStyle => ({
8 | borderColor: value,
9 | }),
10 |
11 | // Border width
12 | w_: (value: number | string): TextStyle => ({
13 | borderWidth: Number(value),
14 | }),
15 |
16 | // Border style
17 | solid: { borderStyle: 'solid' as TextStyle['borderStyle'] },
18 | dotted: { borderStyle: 'dotted' as TextStyle['borderStyle'] },
19 | dashed: { borderStyle: 'dashed' as TextStyle['borderStyle'] },
20 |
21 | // Border radius
22 | rounded_: (value: number | string): TextStyle => ({
23 | borderRadius: Number(value),
24 | }),
25 | rounded_none: { borderRadius: 0 },
26 | rounded_sm: { borderRadius: 2 },
27 | rounded: { borderRadius: 4 },
28 | rounded_md: { borderRadius: 6 },
29 | rounded_lg: { borderRadius: 8 },
30 | rounded_xl: { borderRadius: 12 },
31 | rounded_2xl: { borderRadius: 16 },
32 | rounded_3xl: { borderRadius: 24 },
33 | rounded_full: { borderRadius: 9999 },
34 |
35 | // Start radius
36 | rounded_s_: (value: number | string): TextStyle => ({
37 | borderStartStartRadius: Number(value),
38 | borderEndStartRadius: Number(value),
39 | }),
40 | rounded_s_none: { borderStartStartRadius: 0, borderEndStartRadius: 0 },
41 | rounded_s_sm: { borderStartStartRadius: 2, borderEndStartRadius: 2 },
42 | rounded_s: { borderStartStartRadius: 4, borderEndStartRadius: 4 },
43 | rounded_s_md: { borderStartStartRadius: 6, borderEndStartRadius: 6 },
44 | rounded_s_lg: { borderStartStartRadius: 8, borderEndStartRadius: 8 },
45 | rounded_s_xl: { borderStartStartRadius: 12, borderEndStartRadius: 12 },
46 | rounded_s_2xl: { borderStartStartRadius: 16, borderEndStartRadius: 16 },
47 | rounded_s_3xl: { borderStartStartRadius: 24, borderEndStartRadius: 24 },
48 | rounded_s_full: { borderStartStartRadius: 9999, borderEndStartRadius: 9999 },
49 |
50 | // End radius
51 | rounded_e_: (value: number | string): TextStyle => ({
52 | borderStartEndRadius: Number(value),
53 | borderEndEndRadius: Number(value),
54 | }),
55 | rounded_e_none: { borderStartEndRadius: 0, borderEndEndRadius: 0 },
56 | rounded_e_sm: { borderStartEndRadius: 2, borderEndEndRadius: 2 },
57 | rounded_e: { borderStartEndRadius: 4, borderEndEndRadius: 4 },
58 | rounded_e_md: { borderStartEndRadius: 6, borderEndEndRadius: 6 },
59 | rounded_e_lg: { borderStartEndRadius: 8, borderEndEndRadius: 8 },
60 | rounded_e_xl: { borderStartEndRadius: 12, borderEndEndRadius: 12 },
61 | rounded_e_2xl: { borderStartEndRadius: 16, borderEndEndRadius: 16 },
62 | rounded_e_3xl: { borderStartEndRadius: 24, borderEndEndRadius: 24 },
63 | rounded_e_full: { borderStartEndRadius: 9999, borderEndEndRadius: 9999 },
64 |
65 | // Top radius
66 | rounded_t_: (value: number | string): TextStyle => ({
67 | borderTopLeftRadius: Number(value),
68 | borderTopRightRadius: Number(value),
69 | }),
70 | rounded_t_none: { borderTopLeftRadius: 0, borderTopRightRadius: 0 },
71 | rounded_t_sm: { borderTopLeftRadius: 2, borderTopRightRadius: 2 },
72 | rounded_t: { borderTopLeftRadius: 4, borderTopRightRadius: 4 },
73 | rounded_t_md: { borderTopLeftRadius: 6, borderTopRightRadius: 6 },
74 | rounded_t_lg: { borderTopLeftRadius: 8, borderTopRightRadius: 8 },
75 | rounded_t_xl: { borderTopLeftRadius: 12, borderTopRightRadius: 12 },
76 | rounded_t_2xl: { borderTopLeftRadius: 16, borderTopRightRadius: 16 },
77 | rounded_t_3xl: { borderTopLeftRadius: 24, borderTopRightRadius: 24 },
78 | rounded_t_full: { borderTopLeftRadius: 9999, borderTopRightRadius: 9999 },
79 |
80 | // Right radius
81 | rounded_r_: (value: number | string): TextStyle => ({
82 | borderTopRightRadius: Number(value),
83 | borderBottomRightRadius: Number(value),
84 | }),
85 | rounded_r_none: { borderTopRightRadius: 0, borderBottomRightRadius: 0 },
86 | rounded_r_sm: { borderTopRightRadius: 2, borderBottomRightRadius: 2 },
87 | rounded_r: { borderTopRightRadius: 4, borderBottomRightRadius: 4 },
88 | rounded_r_md: { borderTopRightRadius: 6, borderBottomRightRadius: 6 },
89 | rounded_r_lg: { borderTopRightRadius: 8, borderBottomRightRadius: 8 },
90 | rounded_r_xl: { borderTopRightRadius: 12, borderBottomRightRadius: 12 },
91 | rounded_r_2xl: { borderTopRightRadius: 16, borderBottomRightRadius: 16 },
92 | rounded_r_3xl: { borderTopRightRadius: 24, borderBottomRightRadius: 24 },
93 | rounded_r_full: { borderTopRightRadius: 9999, borderBottomRightRadius: 9999 },
94 |
95 | // Bottom radius
96 | rounded_b_: (value: number | string): TextStyle => ({
97 | borderBottomRightRadius: Number(value),
98 | borderBottomLeftRadius: Number(value),
99 | }),
100 | rounded_b_none: { borderBottomRightRadius: 0, borderBottomLeftRadius: 0 },
101 | rounded_b_sm: { borderBottomRightRadius: 2, borderBottomLeftRadius: 2 },
102 | rounded_b: { borderBottomRightRadius: 4, borderBottomLeftRadius: 4 },
103 | rounded_b_md: { borderBottomRightRadius: 6, borderBottomLeftRadius: 6 },
104 | rounded_b_lg: { borderBottomRightRadius: 8, borderBottomLeftRadius: 8 },
105 | rounded_b_xl: { borderBottomRightRadius: 12, borderBottomLeftRadius: 12 },
106 | rounded_b_2xl: { borderBottomRightRadius: 16, borderBottomLeftRadius: 16 },
107 | rounded_b_3xl: { borderBottomRightRadius: 24, borderBottomLeftRadius: 24 },
108 | rounded_b_full: {
109 | borderBottomRightRadius: 9999,
110 | borderBottomLeftRadius: 9999,
111 | },
112 |
113 | // Left radius
114 | rounded_l_: (value: number | string): TextStyle => ({
115 | borderTopLeftRadius: Number(value),
116 | borderBottomLeftRadius: Number(value),
117 | }),
118 | rounded_l_none: { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 },
119 | rounded_l_sm: { borderTopLeftRadius: 2, borderBottomLeftRadius: 2 },
120 | rounded_l: { borderTopLeftRadius: 4, borderBottomLeftRadius: 4 },
121 | rounded_l_md: { borderTopLeftRadius: 6, borderBottomLeftRadius: 6 },
122 | rounded_l_lg: { borderTopLeftRadius: 8, borderBottomLeftRadius: 8 },
123 | rounded_l_xl: { borderTopLeftRadius: 12, borderBottomLeftRadius: 12 },
124 | rounded_l_2xl: { borderTopLeftRadius: 16, borderBottomLeftRadius: 16 },
125 | rounded_l_3xl: { borderTopLeftRadius: 24, borderBottomLeftRadius: 24 },
126 | rounded_l_full: { borderTopLeftRadius: 9999, borderBottomLeftRadius: 9999 },
127 |
128 | // Start-Start radius
129 | rounded_ss_: (value: number | string): TextStyle => ({
130 | borderStartStartRadius: Number(value),
131 | }),
132 | rounded_ss_none: { borderStartStartRadius: 0 },
133 | rounded_ss_sm: { borderStartStartRadius: 2 },
134 | rounded_ss: { borderStartStartRadius: 4 },
135 | rounded_ss_md: { borderStartStartRadius: 6 },
136 | rounded_ss_lg: { borderStartStartRadius: 8 },
137 | rounded_ss_xl: { borderStartStartRadius: 12 },
138 | rounded_ss_2xl: { borderStartStartRadius: 16 },
139 | rounded_ss_3xl: { borderStartStartRadius: 24 },
140 | rounded_ss_full: { borderStartStartRadius: 9999 },
141 |
142 | // Start-End radius
143 | rounded_se_: (value: number | string): TextStyle => ({
144 | borderStartEndRadius: Number(value),
145 | }),
146 | rounded_se_none: { borderStartEndRadius: 0 },
147 | rounded_se_sm: { borderStartEndRadius: 2 },
148 | rounded_se: { borderStartEndRadius: 4 },
149 | rounded_se_md: { borderStartEndRadius: 6 },
150 | rounded_se_lg: { borderStartEndRadius: 8 },
151 | rounded_se_xl: { borderStartEndRadius: 12 },
152 | rounded_se_2xl: { borderStartEndRadius: 16 },
153 | rounded_se_3xl: { borderStartEndRadius: 24 },
154 | rounded_se_full: { borderStartEndRadius: 9999 },
155 |
156 | // End-End radius
157 | rounded_ee_: (value: number | string): TextStyle => ({
158 | borderEndEndRadius: Number(value),
159 | }),
160 | rounded_ee_none: { borderEndEndRadius: 0 },
161 | rounded_ee_sm: { borderEndEndRadius: 2 },
162 | rounded_ee: { borderEndEndRadius: 4 },
163 | rounded_ee_md: { borderEndEndRadius: 6 },
164 | rounded_ee_lg: { borderEndEndRadius: 8 },
165 | rounded_ee_xl: { borderEndEndRadius: 12 },
166 | rounded_ee_2xl: { borderEndEndRadius: 16 },
167 | rounded_ee_3xl: { borderEndEndRadius: 24 },
168 | rounded_ee_full: { borderEndEndRadius: 9999 },
169 |
170 | // End-Start radius
171 | rounded_es_: (value: number | string): TextStyle => ({
172 | borderEndStartRadius: Number(value),
173 | }),
174 | rounded_es_none: { borderEndStartRadius: 0 },
175 | rounded_es_sm: { borderEndStartRadius: 2 },
176 | rounded_es: { borderEndStartRadius: 4 },
177 | rounded_es_md: { borderEndStartRadius: 6 },
178 | rounded_es_lg: { borderEndStartRadius: 8 },
179 | rounded_es_xl: { borderEndStartRadius: 12 },
180 | rounded_es_2xl: { borderEndStartRadius: 16 },
181 | rounded_es_3xl: { borderEndStartRadius: 24 },
182 | rounded_es_full: { borderEndStartRadius: 9999 },
183 |
184 | // Top-Left radius
185 | rounded_tl_: (value: number | string): TextStyle => ({
186 | borderTopLeftRadius: Number(value),
187 | }),
188 | rounded_tl_none: { borderTopLeftRadius: 0 },
189 | rounded_tl_sm: { borderTopLeftRadius: 2 },
190 | rounded_tl: { borderTopLeftRadius: 4 },
191 | rounded_tl_md: { borderTopLeftRadius: 6 },
192 | rounded_tl_lg: { borderTopLeftRadius: 8 },
193 | rounded_tl_xl: { borderTopLeftRadius: 12 },
194 | rounded_tl_2xl: { borderTopLeftRadius: 16 },
195 | rounded_tl_3xl: { borderTopLeftRadius: 24 },
196 | rounded_tl_full: { borderTopLeftRadius: 9999 },
197 |
198 | // Top-Right radius
199 | rounded_tr_: (value: number | string): TextStyle => ({
200 | borderTopRightRadius: Number(value),
201 | }),
202 | rounded_tr_none: { borderTopRightRadius: 0 },
203 | rounded_tr_sm: { borderTopRightRadius: 2 },
204 | rounded_tr: { borderTopRightRadius: 4 },
205 | rounded_tr_md: { borderTopRightRadius: 6 },
206 | rounded_tr_lg: { borderTopRightRadius: 8 },
207 | rounded_tr_xl: { borderTopRightRadius: 12 },
208 | rounded_tr_2xl: { borderTopRightRadius: 16 },
209 | rounded_tr_3xl: { borderTopRightRadius: 24 },
210 | rounded_tr_full: { borderTopRightRadius: 9999 },
211 |
212 | // Bottom-Right radius
213 | rounded_br_: (value: number | string): TextStyle => ({
214 | borderBottomRightRadius: Number(value),
215 | }),
216 | rounded_br_none: { borderBottomRightRadius: 0 },
217 | rounded_br_sm: { borderBottomRightRadius: 2 },
218 | rounded_br: { borderBottomRightRadius: 4 },
219 | rounded_br_md: { borderBottomRightRadius: 6 },
220 | rounded_br_lg: { borderBottomRightRadius: 8 },
221 | rounded_br_xl: { borderBottomRightRadius: 12 },
222 | rounded_br_2xl: { borderBottomRightRadius: 16 },
223 | rounded_br_3xl: { borderBottomRightRadius: 24 },
224 | rounded_br_full: { borderBottomRightRadius: 9999 },
225 |
226 | // Bottom-left radius
227 | rounded_bl_: (value: number | string): TextStyle => ({
228 | borderBottomLeftRadius: Number(value),
229 | }),
230 | rounded_bl_none: { borderBottomLeftRadius: 0 },
231 | rounded_bl_sm: { borderBottomLeftRadius: 2 },
232 | rounded_bl: { borderBottomLeftRadius: 4 },
233 | rounded_bl_md: { borderBottomLeftRadius: 6 },
234 | rounded_bl_lg: { borderBottomLeftRadius: 8 },
235 | rounded_bl_xl: { borderBottomLeftRadius: 12 },
236 | rounded_bl_2xl: { borderBottomLeftRadius: 16 },
237 | rounded_bl_3xl: { borderBottomLeftRadius: 24 },
238 | rounded_bl_full: { borderBottomLeftRadius: 9999 },
239 |
240 | // Border bottom properties
241 | b_color_: (value: string): TextStyle => ({
242 | borderBottomColor: value,
243 | }),
244 | b_w_: (value: number | string): TextStyle => ({
245 | borderBottomWidth: Number(value),
246 | }),
247 | b_w: { borderBottomWidth: 1 },
248 |
249 | // Border left properties
250 | l_color_: (value: string): TextStyle => ({
251 | borderLeftColor: value,
252 | }),
253 | l_w_: (value: number | string): TextStyle => ({
254 | borderLeftWidth: Number(value),
255 | }),
256 | l_w: { borderLeftWidth: 1 },
257 |
258 | // Border right properties
259 | r_color_: (value: string): TextStyle => ({
260 | borderRightColor: value,
261 | }),
262 | r_w_: (value: number | string): TextStyle => ({
263 | borderRightWidth: Number(value),
264 | }),
265 | r_w: { borderRightWidth: 1 },
266 |
267 | // Border top properties
268 | t_color_: (value: string): TextStyle => ({
269 | borderTopColor: value,
270 | }),
271 | t_w_: (value: number | string): TextStyle => ({
272 | borderTopWidth: Number(value),
273 | }),
274 | t_w: { borderTopWidth: 1 },
275 |
276 | // Border start properties
277 | s_color_: (value: string): TextStyle => ({
278 | borderStartColor: value,
279 | }),
280 | s_w_: (value: number | string): TextStyle => ({
281 | borderStartWidth: Number(value),
282 | }),
283 | s_w: { borderStartWidth: 1 },
284 |
285 | // Border end properties
286 | e_color_: (value: string): TextStyle => ({
287 | borderEndColor: value,
288 | }),
289 | e_w_: (value: number | string): TextStyle => ({
290 | borderEndWidth: Number(value),
291 | }),
292 | e_w: { borderEndWidth: 1 },
293 | };
294 |
295 | // Dynamically add width properties for 1-5 properties
296 | for (let i = 1; i <= 5; i++) {
297 | bdr[`w_${i}`] = { borderWidth: i } as TextStyle;
298 | bdr[`b_w_${i}`] = { borderBottomWidth: i } as TextStyle;
299 | bdr[`l_w_${i}`] = { borderLeftWidth: i } as TextStyle;
300 | bdr[`r_w_${i}`] = { borderRightWidth: i } as TextStyle;
301 | bdr[`t_w_${i}`] = { borderTopWidth: i } as TextStyle;
302 | bdr[`s_w_${i}`] = { borderStartWidth: i } as TextStyle;
303 | bdr[`e_w_${i}`] = { borderEndWidth: i } as TextStyle;
304 | }
305 |
306 | // Dynamically add color properties
307 | Object.keys(colorList).forEach((colorKey) => {
308 | bdr[`color_${colorKey}`] = {
309 | borderColor: colorList[colorKey],
310 | } as TextStyle;
311 |
312 | bdr[`b_color_${colorKey}`] = {
313 | borderBottomColor: colorList[colorKey],
314 | } as TextStyle;
315 |
316 | bdr[`l_color_${colorKey}`] = {
317 | borderLeftColor: colorList[colorKey],
318 | } as TextStyle;
319 |
320 | bdr[`r_color_${colorKey}`] = {
321 | borderRightColor: colorList[colorKey],
322 | } as TextStyle;
323 |
324 | bdr[`t_color_${colorKey}`] = {
325 | borderTopColor: colorList[colorKey],
326 | } as TextStyle;
327 |
328 | bdr[`s_color_${colorKey}`] = {
329 | borderStartColor: colorList[colorKey],
330 | } as TextStyle;
331 |
332 | bdr[`e_color_${colorKey}`] = {
333 | borderEndColor: colorList[colorKey],
334 | } as TextStyle;
335 | });
336 |
337 | export default bdr;
338 |
--------------------------------------------------------------------------------
/assets/badges/kofi.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/assets/badges/patreon.svg:
--------------------------------------------------------------------------------
1 |
23 |
--------------------------------------------------------------------------------
/assets/badges/paypal.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/assets/display-name.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------