diff --git a/gallery/.gitignore b/gallery/.gitignore deleted file mode 100644 index d94aa3cc..00000000 --- a/gallery/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/src/examples -/node_modules -/dist diff --git a/gallery/package.json b/gallery/package.json deleted file mode 100644 index 77688dc1..00000000 --- a/gallery/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@moai/gallery", - "version": "1.3.0", - "description": "Widget Gallery of Moai 🗿", - "main": "dist/cjs.js", - "module": "dist/esm.js", - "types": "dist/types/index.d.ts", - "sideEffects": false, - "files": [ - "dist" - ], - "scripts": { - "_build": "rollup --config", - "_start": "rollup --config --watch", - "example": "ts-node ./scripts/example/generate.ts", - "prepublishOnly": "yarn _build" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/moaijs/moai.git" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/moaijs/moai/issues" - }, - "homepage": "https://moai.thien.do", - "email": "moai@thien.do", - "dependencies": { - "@moai/core": "*" - }, - "peerDependencies": { - "react": ">=16", - "react-icons": ">=4" - }, - "devDependencies": { - "@types/node": "^16.4.8", - "@types/react": "^17.0.15", - "node-fetch": "^2.6.1", - "postcss": "^8.3.6", - "react": "^17.0.2", - "react-dom": "^17.0.2", - "react-icons": "^4.2.0", - "rollup": "^2.55.1", - "rollup-plugin-copy": "^3.4.0", - "rollup-plugin-delete": "^2.0.0", - "rollup-plugin-postcss": "^4.0.0", - "rollup-plugin-typescript2": "^0.30.0", - "ts-node": "^10.1.0", - "tslib": "^2.3.0", - "typescript": "^4.3.4" - } -} diff --git a/gallery/rollup.config.js b/gallery/rollup.config.js deleted file mode 100644 index dc9f2876..00000000 --- a/gallery/rollup.config.js +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-env node */ - -import del from "rollup-plugin-delete"; -import postcss from "rollup-plugin-postcss"; -import typescript2 from "rollup-plugin-typescript2"; - -/** - * Main bundling process - * @type {import("rollup").RollupOptions} - */ -const config = { - input: "src/index.tsx", - output: [ - { file: "dist/esm.js", format: "esm" }, - { file: "dist/cjs.js", format: "cjs" }, - ], - external: [ - "@moai/core", - "react", - "react/jsx-runtime", - // Because we have a demo where we show all icon from all sets :)). We - // could simplify this as a function, but it's just simpler to leave - // it all here (and better in term of performance) - "react-icons/ai", - "react-icons/bi", - "react-icons/cg", - "react-icons/fa", - "react-icons/fc", - "react-icons/fi", - "react-icons/go", - "react-icons/hi", - "react-icons/im", - "react-icons/io5", - "react-icons/md", - "react-icons/ri", - "react-icons/ti", - "react-icons/vsc", - ], - plugins: [ - del({ - targets: ["dist"], - }), - postcss({ - minimize: false, - extract: "bundle.css", - }), - typescript2({ - useTsconfigDeclarationDir: true, - }), - ], -}; - -export default config; diff --git a/gallery/scripts/example/generate.ts b/gallery/scripts/example/generate.ts deleted file mode 100644 index 9f8585db..00000000 --- a/gallery/scripts/example/generate.ts +++ /dev/null @@ -1,68 +0,0 @@ -import fetch from "node-fetch"; -import * as fs from "fs/promises"; -import * as path from "path"; -import { RawPokemon, RawPokemonList } from "./raw"; -import { normalizePokemon } from "./normalize"; -import { Pokemon } from "./interface"; - -type PokemonType = Pokemon["types"][0]; - -const getTypes = (pokemons: Pokemon[]): PokemonType[] => { - const set = pokemons.reduce((set, pokemon) => { - pokemon.types.forEach((type) => { - if (set.has(type)) return; - set.add(type); - }); - return set; - }, new Set()); - return [...set]; -}; - -const printProgress = (progress: string) => { - process.stdout.clearLine(0); - process.stdout.cursorTo(0); - process.stdout.write(progress + "%"); -}; - -const main = async () => { - // Skip if already populated (remove this to manually force a re-fetch) - const distPath = path.resolve(__dirname, "../../src/examples"); - try { - await fs.access(distPath); - console.log("Examples found"); - return; - } catch (e) { - console.log("Examples not found, generating..."); - } - - // Fetch list of pokemons - const resp = await fetch("https://pokeapi.co/api/v2/pokemon?limit=100"); - const raw = (await resp.json()) as RawPokemonList; - - // Fetch each pokemon - const count = { value: 0 }; - const promises = raw.results.map(async (result) => { - const resp = await fetch(result.url); - const raw = (await resp.json()) as RawPokemon; - count.value++; - printProgress(count.value.toString()); - const pokemon = normalizePokemon(raw); - return pokemon; - }); - const pokemons = await Promise.all(promises); - const types = getTypes(pokemons); - - // Write the result - fs.mkdir(distPath); - fs.writeFile( - path.resolve(distPath, "pokemons.json"), - JSON.stringify(pokemons, null, 2) - ); - fs.writeFile( - path.resolve(distPath, "types.json"), - JSON.stringify(types, null, 2) - ); - return pokemons; -}; - -main(); diff --git a/gallery/scripts/example/interface.ts b/gallery/scripts/example/interface.ts deleted file mode 100644 index fe04abc7..00000000 --- a/gallery/scripts/example/interface.ts +++ /dev/null @@ -1,16 +0,0 @@ -export interface Pokemon { - id: number; - name: string; - image: { - static: string; - animated: string; - }; - weight: number; - height: number; - moves: string; - stats: { - name: string; - base: number; - }[]; - types: string[]; -} diff --git a/gallery/scripts/example/normalize.ts b/gallery/scripts/example/normalize.ts deleted file mode 100644 index e95d9e02..00000000 --- a/gallery/scripts/example/normalize.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Pokemon } from "./interface"; -import { RawPokemon } from "./raw"; - -const getBw = (raw: RawPokemon) => - raw.sprites.versions["generation-v"]["black-white"]; - -export const normalizePokemon = (raw: RawPokemon): Pokemon => ({ - height: raw.height, - id: raw.id, - image: { - static: getBw(raw).front_default, - animated: getBw(raw).animated.front_default, - }, - moves: raw.moves.map((move) => move.move.name).join(", "), - name: raw.name, - stats: raw.stats.map((stat) => ({ - base: stat.base_stat, - name: stat.stat.name, - })), - types: raw.types.map((type) => type.type.name), - weight: raw.weight, -}); diff --git a/gallery/scripts/example/raw.ts b/gallery/scripts/example/raw.ts deleted file mode 100644 index 25ef0bc3..00000000 --- a/gallery/scripts/example/raw.ts +++ /dev/null @@ -1,87 +0,0 @@ -interface Ability2 { - name: string; - url: string; -} - -interface Ability { - ability: Ability2; - is_hidden: boolean; - slot: number; -} - -interface Move2 { - name: string; - url: string; -} - -interface Move { - move: Move2; -} - -interface Animated { - front_default: string; -} - -interface BlackWhite { - animated: Animated; - front_default: string; -} - -interface GenerationV { - "black-white": BlackWhite; -} - -interface Versions { - "generation-v": GenerationV; -} - -interface Sprites { - front_default: string; - versions: Versions; -} - -interface Stat2 { - name: string; - url: string; -} - -interface Stat { - base_stat: number; - effort: number; - stat: Stat2; -} - -interface Type2 { - name: string; - url: string; -} - -interface Type { - slot: number; - type: Type2; -} - -export interface RawPokemon { - abilities: Ability[]; - base_experience: number; - height: number; - id: number; - moves: Move[]; - name: string; - sprites: Sprites; - stats: Stat[]; - types: Type[]; - weight: number; -} - -interface Result { - name: string; - url: string; -} - -export interface RawPokemonList { - count: number; - next: string; - previous: unknown; - results: Result[]; -} diff --git a/gallery/tsconfig.json b/gallery/tsconfig.json deleted file mode 100644 index 781e46fe..00000000 --- a/gallery/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "composite": true, - "declaration": true, - "declarationDir": "dist/types", - "rootDir": "src" - }, - "references": [{ "path": "../core" }], - "include": ["src/**/*"] -} diff --git a/gallery/src/button-1.tsx b/src/gallery/button-1.tsx similarity index 93% rename from gallery/src/button-1.tsx rename to src/gallery/button-1.tsx index 145b810d..5b06cfd9 100644 --- a/gallery/src/button-1.tsx +++ b/src/gallery/button-1.tsx @@ -1,4 +1,4 @@ -import { Button, ButtonProps } from "@moai/core"; +import { Button, ButtonProps } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/button-2.tsx b/src/gallery/button-2.tsx similarity index 97% rename from gallery/src/button-2.tsx rename to src/gallery/button-2.tsx index f3a88373..fc812139 100644 --- a/gallery/src/button-2.tsx +++ b/src/gallery/button-2.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import * as Go from "react-icons/go"; -import { Button, ButtonProps } from "@moai/core"; +import { Button, ButtonProps } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/checkbox.tsx b/src/gallery/checkbox.tsx similarity index 94% rename from gallery/src/checkbox.tsx rename to src/gallery/checkbox.tsx index 385c212f..dd6997a9 100644 --- a/gallery/src/checkbox.tsx +++ b/src/gallery/checkbox.tsx @@ -1,4 +1,4 @@ -import { Checkbox, CheckboxProps, Radio, RadioProps } from "@moai/core"; +import { Checkbox, CheckboxProps, Radio, RadioProps } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/dialog.tsx b/src/gallery/dialog.tsx similarity index 97% rename from gallery/src/dialog.tsx rename to src/gallery/dialog.tsx index ae9d98c0..c807ca45 100644 --- a/gallery/src/dialog.tsx +++ b/src/gallery/dialog.tsx @@ -1,4 +1,4 @@ -import * as M from "@moai/core"; +import * as M from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/gallery.tsx b/src/gallery/gallery.tsx similarity index 98% rename from gallery/src/gallery.tsx rename to src/gallery/gallery.tsx index c6d54a81..8b5fa337 100644 --- a/gallery/src/gallery.tsx +++ b/src/gallery/gallery.tsx @@ -1,4 +1,4 @@ -import { scrollbar } from "@moai/core"; +import { scrollbar } from "../core"; import { GalleryButton1 } from "./button-1"; import { GalleryButton2 } from "./button-2"; import { GalleryCheckbox } from "./checkbox"; diff --git a/gallery/src/global.d.ts b/src/gallery/global.d.ts similarity index 100% rename from gallery/src/global.d.ts rename to src/gallery/global.d.ts diff --git a/gallery/src/icon/icon.module.css b/src/gallery/icon/icon.module.css similarity index 100% rename from gallery/src/icon/icon.module.css rename to src/gallery/icon/icon.module.css diff --git a/gallery/src/icon/icon.tsx b/src/gallery/icon/icon.tsx similarity index 96% rename from gallery/src/icon/icon.tsx rename to src/gallery/icon/icon.tsx index 7114d1cb..48f23288 100644 --- a/gallery/src/icon/icon.tsx +++ b/src/gallery/icon/icon.tsx @@ -1,4 +1,4 @@ -import { Icon, IconComponent } from "@moai/core"; +import { Icon, IconComponent } from "../../core"; import { AiOutlineHome } from "react-icons/ai"; import { BiHome } from "react-icons/bi"; import { FiHome } from "react-icons/fi"; diff --git a/gallery/src/index.tsx b/src/gallery/index.tsx similarity index 100% rename from gallery/src/index.tsx rename to src/gallery/index.tsx diff --git a/gallery/src/input-1.tsx b/src/gallery/input-1.tsx similarity index 92% rename from gallery/src/input-1.tsx rename to src/gallery/input-1.tsx index 2d64bc6a..eb71a85a 100644 --- a/gallery/src/input-1.tsx +++ b/src/gallery/input-1.tsx @@ -1,4 +1,4 @@ -import { Input, InputStyle } from "@moai/core"; +import { Input, InputStyle } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/input-2.tsx b/src/gallery/input-2.tsx similarity index 91% rename from gallery/src/input-2.tsx rename to src/gallery/input-2.tsx index 9b3d1717..b15d61b3 100644 --- a/gallery/src/input-2.tsx +++ b/src/gallery/input-2.tsx @@ -1,6 +1,6 @@ -import { ButtonGroupItemProps } from "@moai/core"; +import { ButtonGroupItemProps } from "../core"; import { GoSearch } from "react-icons/go"; -import { Button, ButtonGroup, Input } from "@moai/core"; +import { Button, ButtonGroup, Input } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; import { MATERIALS } from "./table/robots"; diff --git a/gallery/src/pagination.tsx b/src/gallery/pagination.tsx similarity index 90% rename from gallery/src/pagination.tsx rename to src/gallery/pagination.tsx index ec365f77..44b017b0 100644 --- a/gallery/src/pagination.tsx +++ b/src/gallery/pagination.tsx @@ -1,5 +1,5 @@ -import { Pagination } from "@moai/core"; import { useCallback, useState } from "react"; +import { Pagination } from "../core"; export const GallerPagination = (): JSX.Element => { const [page, setPage_] = useState(5); diff --git a/gallery/src/pane.tsx b/src/gallery/pane.tsx similarity index 97% rename from gallery/src/pane.tsx rename to src/gallery/pane.tsx index d9e56a4e..6ae16d59 100644 --- a/gallery/src/pane.tsx +++ b/src/gallery/pane.tsx @@ -1,4 +1,4 @@ -import * as M from "@moai/core"; +import * as M from "../core"; import s from "./styles.module.css"; const items: M.MenuItemProps[] = [ diff --git a/gallery/src/popover.tsx.backup b/src/gallery/popover.tsx.backup similarity index 100% rename from gallery/src/popover.tsx.backup rename to src/gallery/popover.tsx.backup diff --git a/gallery/src/progress.tsx b/src/gallery/progress.tsx similarity index 96% rename from gallery/src/progress.tsx rename to src/gallery/progress.tsx index 5b286de0..3af2ae7a 100644 --- a/gallery/src/progress.tsx +++ b/src/gallery/progress.tsx @@ -1,4 +1,4 @@ -import { ProgressCircle } from "@moai/core"; +import { ProgressCircle } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/section/section.module.css b/src/gallery/section/section.module.css similarity index 100% rename from gallery/src/section/section.module.css rename to src/gallery/section/section.module.css diff --git a/gallery/src/section/section.tsx b/src/gallery/section/section.tsx similarity index 91% rename from gallery/src/section/section.tsx rename to src/gallery/section/section.tsx index 0f2a67d6..c4d8bfdc 100644 --- a/gallery/src/section/section.tsx +++ b/src/gallery/section/section.tsx @@ -1,4 +1,4 @@ -import { DivPx } from "@moai/core"; +import { DivPx } from "../../core"; import s from "./section.module.css"; interface Props { diff --git a/gallery/src/select.tsx b/src/gallery/select.tsx similarity index 98% rename from gallery/src/select.tsx rename to src/gallery/select.tsx index 5230070b..4a38bcf3 100644 --- a/gallery/src/select.tsx +++ b/src/gallery/select.tsx @@ -1,4 +1,4 @@ -import * as M from "@moai/core"; +import * as M from "../core"; import s from "./styles.module.css"; import { MATERIALS } from "./table/robots"; import { GoSearch } from "react-icons/go"; diff --git a/gallery/src/shot/shot.module.css b/src/gallery/shot/shot.module.css similarity index 100% rename from gallery/src/shot/shot.module.css rename to src/gallery/shot/shot.module.css diff --git a/gallery/src/shot/shot.tsx b/src/gallery/shot/shot.tsx similarity index 100% rename from gallery/src/shot/shot.tsx rename to src/gallery/shot/shot.tsx diff --git a/gallery/src/styles.module.css b/src/gallery/styles.module.css similarity index 100% rename from gallery/src/styles.module.css rename to src/gallery/styles.module.css diff --git a/gallery/src/tab.tsx b/src/gallery/tab.tsx similarity index 93% rename from gallery/src/tab.tsx rename to src/gallery/tab.tsx index 3d16b8af..d3fc6373 100644 --- a/gallery/src/tab.tsx +++ b/src/gallery/tab.tsx @@ -1,4 +1,4 @@ -import { Paragraph, Tab, Tabs } from "@moai/core"; +import { Paragraph, Tab, Tabs } from "../core"; import { Shot } from "./shot/shot"; const Second = () => ( diff --git a/gallery/src/table/robo-schema.json b/src/gallery/table/robo-schema.json similarity index 100% rename from gallery/src/table/robo-schema.json rename to src/gallery/table/robo-schema.json diff --git a/gallery/src/table/robots.ts b/src/gallery/table/robots.ts similarity index 100% rename from gallery/src/table/robots.ts rename to src/gallery/table/robots.ts diff --git a/gallery/src/table/table.module.css b/src/gallery/table/table.module.css similarity index 100% rename from gallery/src/table/table.module.css rename to src/gallery/table/table.module.css diff --git a/gallery/src/table/table.tsx b/src/gallery/table/table.tsx similarity index 99% rename from gallery/src/table/table.tsx rename to src/gallery/table/table.tsx index 5c27f161..3f667f66 100644 --- a/gallery/src/table/table.tsx +++ b/src/gallery/table/table.tsx @@ -1,5 +1,5 @@ import { Fragment, useState } from "react"; -import * as M from "@moai/core"; +import * as M from "../../core"; import { Robot, ROBOTS } from "./robots"; import s from "./table.module.css"; import { GoSearch, GoMail } from "react-icons/go"; diff --git a/gallery/src/tag.tsx b/src/gallery/tag.tsx similarity index 92% rename from gallery/src/tag.tsx rename to src/gallery/tag.tsx index 5db464f3..b9c28b5e 100644 --- a/gallery/src/tag.tsx +++ b/src/gallery/tag.tsx @@ -1,4 +1,4 @@ -import { Tag } from "@moai/core"; +import { Tag } from "../core"; import s from "./styles.module.css"; const getColor = (color: string): string => { diff --git a/gallery/src/toast.tsx b/src/gallery/toast.tsx similarity index 94% rename from gallery/src/toast.tsx rename to src/gallery/toast.tsx index adaaebb0..fdfa41bc 100644 --- a/gallery/src/toast.tsx +++ b/src/gallery/toast.tsx @@ -1,4 +1,4 @@ -import { Button, Dialog, toast, ToastPane } from "@moai/core"; +import { Button, Dialog, toast, ToastPane } from "../core"; import { Shot } from "./shot/shot"; import s from "./styles.module.css"; diff --git a/gallery/src/tooltip.tsx b/src/gallery/tooltip.tsx similarity index 85% rename from gallery/src/tooltip.tsx rename to src/gallery/tooltip.tsx index a2f4ce15..fa0f349b 100644 --- a/gallery/src/tooltip.tsx +++ b/src/gallery/tooltip.tsx @@ -1,4 +1,4 @@ -import { DivPx, Button, Tooltip, TooltipPane } from "@moai/core"; +import { DivPx, Button, Tooltip, TooltipPane } from "../core"; import { Shot } from "./shot/shot"; export const GalleryTooltip = (): JSX.Element => (