diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3c032078 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 81328ae4..279582d9 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1 +1,18 @@ -- useMediaInsert now requires collection to be passed \ No newline at end of file +BREAKING_CHANGES + +- Card preview only is used for card view (viewStyle prop removed). +- Deprecated stuff removed (getAsset, createReactClass, isFieldDuplicate, isFieldHidden) +- widget prop `isDisabled` renamed to `disabled` +- widget prop `isDuplicate` renamed to `duplicate` +- widget prop `isHidden` renamed to `hidden` +- useMediaInsert now requires collection to be passed +- media path changed from `string | string[]` to `{ path: string | string[], alt?: string }` + +ADDED +- `forSingleList` - Allows for changing styles for single list items + +TODO + +- Docs on table columns +- Docs on field previews +- Re-add collection description OR document as breaking change diff --git a/packages/app/.eslintrc.js b/packages/app/.eslintrc.js index 1af6ee58..91bfc721 100644 --- a/packages/app/.eslintrc.js +++ b/packages/app/.eslintrc.js @@ -55,23 +55,6 @@ module.exports = { caughtErrorsIgnorePattern: '^_', }, ], - '@typescript-eslint/no-restricted-imports': [ - 'error', - { - patterns: [ - { - group: ['@mui/*/*/*', '!@mui/material/test-utils/*'], - message: 'Do not import material imports as 3rd level imports', - allowTypeImports: true, - }, - { - group: ['@mui/material', '!@mui/material/'], - message: 'Please import material imports as defaults or 2nd level imports', - allowTypeImports: true, - }, - ], - }, - ], 'import/prefer-default-export': 'error', }, plugins: ['babel', '@emotion', 'cypress', 'unicorn', 'react-hooks'], diff --git a/packages/app/package.json b/packages/app/package.json index 258a8c21..0e1231af 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -57,11 +57,12 @@ "@babel/preset-typescript": "7.21.0", "@emotion/eslint-plugin": "11.10.0", "@emotion/jest": "11.10.5", - "@types/node": "16.18.16", + "@types/node": "18.11.18", "@types/react": "18.0.28", "@types/react-dom": "18.0.11", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", + "autoprefixer": "10.4.13", "babel-core": "7.0.0-bridge.0", "babel-loader": "9.1.2", "babel-plugin-emotion": "11.0.0", @@ -73,6 +74,7 @@ "babel-plugin-transform-export-extensions": "6.22.0", "babel-plugin-transform-inline-environment-variables": "0.4.4", "cross-env": "7.0.3", + "css-loader": "6.7.3", "dotenv": "16.0.3", "eslint": "8.36.0", "eslint-import-resolver-typescript": "3.5.3", @@ -82,6 +84,7 @@ "eslint-plugin-react": "7.32.2", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-unicorn": "46.0.0", + "mini-css-extract-plugin": "2.7.2", "npm-run-all": "4.1.5", "postcss": "8.4.21", "postcss-scss": "4.0.6", diff --git a/packages/app/postcss.config.js b/packages/app/postcss.config.js new file mode 100644 index 00000000..cdbe50f3 --- /dev/null +++ b/packages/app/postcss.config.js @@ -0,0 +1,7 @@ +module.exports = { + plugins: { + 'tailwindcss/nesting': {}, + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/packages/app/tailwind.config.js b/packages/app/tailwind.config.js new file mode 100644 index 00000000..d3bdb103 --- /dev/null +++ b/packages/app/tailwind.config.js @@ -0,0 +1,7 @@ +const baseConfig = require('../../tailwind.base.config'); + +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ['../core/src/**/*.tsx'], + ...baseConfig, +}; diff --git a/packages/app/tsconfig.json b/packages/app/tsconfig.json index c7e292bb..a0274886 100644 --- a/packages/app/tsconfig.json +++ b/packages/app/tsconfig.json @@ -49,7 +49,7 @@ "@staticcms/string/*": ["../core/src/widgets/string/*"], "@staticcms/text": ["../core/src/widgets/text"], "@staticcms/text/*": ["../core/src/widgets/text/*"], - "@staticcms/core": ["../core/core/src/*"], + "@staticcms/core": ["../core/src"], "@staticcms/core/*": ["../core/src/*"] }, "types": ["@emotion/react/types/css-prop", "@types/jest", "@testing-library/jest-dom"] diff --git a/packages/app/webpack.config.js b/packages/app/webpack.config.js index 0eadba40..fc525d6f 100644 --- a/packages/app/webpack.config.js +++ b/packages/app/webpack.config.js @@ -2,6 +2,7 @@ const path = require('path'); const webpack = require('webpack'); const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const isProduction = process.env.NODE_ENV === 'production'; const devServerPort = parseInt(process.env.STATIC_CMS_DEV_SERVER_PORT || `${8080}`); @@ -44,14 +45,11 @@ module.exports = { }, { test: /\.css$/, - include: ['ol', 'codemirror', '@toast-ui'].map(moduleNameToPath), + include: [...['ol', 'codemirror', '@toast-ui'].map(moduleNameToPath), path.resolve(__dirname, '..', 'core', 'src')], use: [ - { - loader: 'style-loader', - }, - { - loader: 'css-loader', - }, + !isProduction ? 'style-loader' : MiniCssExtractPlugin.loader, + 'css-loader', + 'postcss-loader', ], }, { @@ -85,6 +83,7 @@ module.exports = { }, plugins: [ !isProduction && new ReactRefreshWebpackPlugin(), + isProduction && new MiniCssExtractPlugin(), new webpack.IgnorePlugin({ resourceRegExp: /^esprima$/ }), new webpack.IgnorePlugin({ resourceRegExp: /moment\/locale\// }), new webpack.ProvidePlugin({ diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 968245b9..623f6a2c 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -55,23 +55,6 @@ module.exports = { caughtErrorsIgnorePattern: '^_', }, ], - '@typescript-eslint/no-restricted-imports': [ - 'error', - { - patterns: [ - { - group: ['@mui/*/*/*', '!@mui/material/test-utils/*'], - message: 'Do not import material imports as 3rd level imports', - allowTypeImports: true, - }, - { - group: ['@mui/material', '!@mui/material/'], - message: 'Please import material imports as defaults or 2nd level imports', - allowTypeImports: true, - }, - ], - }, - ], 'import/prefer-default-export': 'error', }, plugins: ['babel', '@emotion', 'cypress', 'unicorn', 'react-hooks'], @@ -81,7 +64,7 @@ module.exports = { }, 'import/resolver': { typescript: { - project: 'packages/core/tsconfig.json', + project: 'packages/core/tsconfig-dev.json', }, // this loads /tsconfig.json to eslint }, 'import/core-modules': ['src'], diff --git a/packages/core/dev-test/assets/uploads/Photo 1-lobby_FS.jpg b/packages/core/dev-test/_posts/assets/uploads/lobby.jpg similarity index 100% rename from packages/core/dev-test/assets/uploads/Photo 1-lobby_FS.jpg rename to packages/core/dev-test/_posts/assets/uploads/lobby.jpg diff --git a/packages/core/dev-test/_posts/assets/uploads/moby-dick.jpg b/packages/core/dev-test/_posts/assets/uploads/moby-dick.jpg new file mode 100644 index 00000000..3234c5c9 Binary files /dev/null and b/packages/core/dev-test/_posts/assets/uploads/moby-dick.jpg differ diff --git a/packages/demo/public/assets/uploads/Photo 1-lobby_FS.jpg b/packages/core/dev-test/assets/uploads/lobby.jpg similarity index 100% rename from packages/demo/public/assets/uploads/Photo 1-lobby_FS.jpg rename to packages/core/dev-test/assets/uploads/lobby.jpg diff --git a/packages/core/dev-test/assets/uploads/nf-logo.png b/packages/core/dev-test/assets/uploads/nf-logo.png deleted file mode 100644 index 547a26c0..00000000 Binary files a/packages/core/dev-test/assets/uploads/nf-logo.png and /dev/null differ diff --git a/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/index.md b/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/index.md index d29b700b..9ceb3687 100644 --- a/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/index.md +++ b/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/index.md @@ -1,8 +1,8 @@ --- -title: Something something something... +title: Something something something2... draft: false date: 2022-11-01 06:30 -image: ori_3587884_d966kldqzc6mvdeq67hyk16rnbe3gb1k8eeoy31s_shark-icon.jpg +image: static-cms-icon.svg --- # Welcome diff --git a/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/static-cms-icon.svg b/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/static-cms-icon.svg new file mode 100644 index 00000000..c02f56ff --- /dev/null +++ b/packages/core/dev-test/backends/proxy/_posts/2022-11-01-something/static-cms-icon.svg @@ -0,0 +1,1066 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/core/dev-test/backends/proxy/assets/upload/document.txt b/packages/core/dev-test/backends/proxy/assets/upload/document.txt new file mode 100644 index 00000000..b8f8e9bb --- /dev/null +++ b/packages/core/dev-test/backends/proxy/assets/upload/document.txt @@ -0,0 +1 @@ +Some text here! diff --git a/packages/core/dev-test/backends/proxy/assets/upload/shortfin-mako-shark-seas.webp b/packages/core/dev-test/backends/proxy/assets/upload/shortfin-mako-shark-seas.webp new file mode 100644 index 00000000..7987d394 Binary files /dev/null and b/packages/core/dev-test/backends/proxy/assets/upload/shortfin-mako-shark-seas.webp differ diff --git a/packages/core/dev-test/config.yml b/packages/core/dev-test/config.yml index daa3fd57..6d699f28 100644 --- a/packages/core/dev-test/config.yml +++ b/packages/core/dev-test/config.yml @@ -25,7 +25,10 @@ collections: and editing guidelines that are specific to a collection. folder: _posts slug: '{{year}}-{{month}}-{{day}}-{{slug}}' - summary: '{{title}} -- {{year}}/{{month}}/{{day}}' + summary_fields: + - title + - date + - draft sortable_fields: fields: - title @@ -219,7 +222,7 @@ collections: time_format: 'h:mm aaa' required: false - name: date_and_time_with_default - label: Date and Time With Deafult + label: Date and Time With Default widget: datetime format: 'MMM d, yyyy h:mm aaa' date_format: 'MMM d, yyyy' @@ -233,22 +236,25 @@ collections: time_format: false required: false - name: date_with_default - label: Date With Deafult + label: Date With Default widget: datetime format: 'MMM d, yyyy' date_format: 'MMM d, yyyy' + time_format: false required: false default: 'Jan 12, 2023' - name: time label: Time widget: datetime format: 'h:mm aaa' + date_format: false time_format: 'h:mm aaa' required: false - name: time_with_default - label: Time With Deafult + label: Time With Default widget: datetime format: 'h:mm aaa' + date_format: false time_format: 'h:mm aaa' required: false default: '12:00 am' @@ -641,7 +647,7 @@ collections: - date search_fields: - title - - body + - date value_field: title - label: Required With Default name: with_default @@ -652,7 +658,7 @@ collections: - date search_fields: - title - - body + - date value_field: title default: This is a YAML front matter post - label: Optional Validation @@ -665,7 +671,7 @@ collections: - date search_fields: - title - - body + - date value_field: title - label: Multiple name: multiple @@ -678,7 +684,7 @@ collections: - date search_fields: - title - - body + - date value_field: title - label: Multiple With Default name: multiple_with_default @@ -694,7 +700,7 @@ collections: - date search_fields: - title - - body + - date value_field: title - name: select label: Select diff --git a/packages/core/dev-test/index.html b/packages/core/dev-test/index.html index 99323002..6e327072 100644 --- a/packages/core/dev-test/index.html +++ b/packages/core/dev-test/index.html @@ -6,7 +6,27 @@ Static CMS Development Test