From a722e31f058e76b43a78bc854885befd96a49c37 Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Sun, 11 Aug 2024 23:57:43 +0200 Subject: [PATCH] Revamp themes loading: now themes are separate --- .eslintignore | 13 - .eslintrc.cjs | 16 ++ CHANGELOG.md | 3 + README.md | 4 +- package.json | 10 +- pnpm-lock.yaml | 238 +++++++++--------- src/lib/Config.ts | 5 - src/lib/Dashboard.test.ts | 4 + src/lib/Dashboard.ts | 7 +- src/lib/Fields/Email.ts | 3 +- .../ViewFieldsComponents/EmailField.svelte | 11 - .../carbon/Columns/Columns.svelte | 1 - .../carbon/Columns/Columns.test.ts | 8 +- .../carbon/Crud/CrudDelete.svelte | 0 .../{ => svelte}/carbon/Crud/CrudEdit.svelte | 4 +- .../{ => svelte}/carbon/Crud/CrudForm.svelte | 2 +- .../carbon/Crud/CrudFormField.svelte | 2 +- .../{ => svelte}/carbon/Crud/CrudList.svelte | 4 +- .../{ => svelte}/carbon/Crud/CrudNew.svelte | 2 +- .../{ => svelte}/carbon/Crud/CrudView.svelte | 4 +- .../carbon/Crud/CrudViewField.svelte | 2 +- .../carbon/Dashboard/Dashboard.svelte | 6 +- .../carbon/DataTable/DataTable.svelte | 4 +- .../DataTable/Toolbar/DataTableToolbar.svelte | 4 +- .../DataTable/Toolbar/ToolbarAction.svelte | 0 .../DataTable/Toolbar/ToolbarFilter.svelte | 0 .../DataTable/actions/ItemActions.svelte | 2 +- .../DataTable/actions/SingleAction.svelte | 0 .../FilterComponents/BooleanFilter.svelte | 2 +- .../carbon/FilterComponents/DateFilter.svelte | 2 +- .../Internal/FilterContainer.svelte | 0 .../FilterComponents/NumericFilter.svelte | 2 +- .../carbon/FilterComponents/TextFilter.svelte | 2 +- .../FormFieldsComponents/ArrayField.svelte | 2 +- .../FormFieldsComponents/CheckboxField.svelte | 0 .../FormFieldsComponents/ColumnsField.svelte | 0 .../CrudEntityField.svelte | 0 .../FormFieldsComponents/DateField.svelte | 0 .../FormFieldsComponents/DefaultField.svelte | 0 .../FormFieldsComponents/DefaultField.test.ts | 2 +- .../FormFieldsComponents/EmailField.svelte | 0 .../FormFieldsComponents/EmailField.test.ts | 2 +- .../KeyValueObjectField.svelte | 0 .../FormFieldsComponents/NumberField.svelte | 0 .../FormFieldsComponents/TabsField.svelte | 0 .../FormFieldsComponents/TextField.svelte | 0 .../FormFieldsComponents/TextareaField.svelte | 0 .../FormFieldsComponents/ToggleField.svelte | 0 .../FormFieldsComponents/UrlField.svelte | 0 .../carbon/Layout/AdminLayout.svelte | 0 .../{ => svelte}/carbon/Menu/SideMenu.svelte | 0 .../carbon/Menu/TopLeftMenu.svelte | 0 .../{ => svelte}/carbon/Menu/TopMenu.svelte | 4 +- .../carbon/Menu/TopRightMenu.svelte | 1 - .../{ => svelte}/carbon/Tabs/Tabs.svelte | 0 .../ViewFieldsComponents/ArrayField.svelte | 2 +- .../ViewFieldsComponents/ArrayField.test.ts | 4 +- .../ViewFieldsComponents/CheckboxField.svelte | 0 .../CheckboxField.test.ts | 0 .../ViewFieldsComponents/ColumnsField.svelte | 0 .../CrudEntityField.svelte | 0 .../ViewFieldsComponents/DateField.svelte | 0 .../ViewFieldsComponents/DateField.test.ts | 0 .../ViewFieldsComponents/DefaultField.svelte | 0 .../ViewFieldsComponents/DefaultField.test.ts | 0 .../ViewFieldsComponents/EmailField.svelte | 11 + .../ViewFieldsComponents/EmailField.test.ts | 2 +- .../KeyValueObjectField.svelte | 0 .../KeyValueObjectField.test.ts | 0 .../ViewFieldsComponents/NumberField.svelte | 0 .../ViewFieldsComponents/NumberField.test.ts | 0 .../ViewFieldsComponents/TabsField.svelte | 0 .../ViewFieldsComponents/ToggleField.svelte | 0 .../ViewFieldsComponents/UrlField.svelte | 1 + .../ViewFieldsComponents/ViewLabel.svelte | 0 src/lib/themes/{ => svelte}/carbon/index.ts | 0 src/lib/themes/{ => svelte}/index.ts | 0 src/routes/+page.svelte | 2 +- .../admin/[crud]/[operation]/+page.svelte | 2 +- src/testApp/BookCrud.ts | 6 +- src/testApp/Dashboard.ts | 8 +- src/testApp/TestCrud.ts | 3 +- src/testApp/internal/memoryStorage.ts | 3 +- 83 files changed, 216 insertions(+), 206 deletions(-) delete mode 100644 src/lib/themes/carbon/ViewFieldsComponents/EmailField.svelte rename src/lib/themes/{ => svelte}/carbon/Columns/Columns.svelte (98%) rename src/lib/themes/{ => svelte}/carbon/Columns/Columns.test.ts (91%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudDelete.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudEdit.svelte (96%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudForm.svelte (97%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudFormField.svelte (91%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudList.svelte (98%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudNew.svelte (96%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudView.svelte (94%) rename src/lib/themes/{ => svelte}/carbon/Crud/CrudViewField.svelte (93%) rename src/lib/themes/{ => svelte}/carbon/Dashboard/Dashboard.svelte (92%) rename src/lib/themes/{ => svelte}/carbon/DataTable/DataTable.svelte (95%) rename src/lib/themes/{ => svelte}/carbon/DataTable/Toolbar/DataTableToolbar.svelte (93%) rename src/lib/themes/{ => svelte}/carbon/DataTable/Toolbar/ToolbarAction.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/DataTable/Toolbar/ToolbarFilter.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/DataTable/actions/ItemActions.svelte (84%) rename src/lib/themes/{ => svelte}/carbon/DataTable/actions/SingleAction.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FilterComponents/BooleanFilter.svelte (95%) rename src/lib/themes/{ => svelte}/carbon/FilterComponents/DateFilter.svelte (88%) rename src/lib/themes/{ => svelte}/carbon/FilterComponents/Internal/FilterContainer.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FilterComponents/NumericFilter.svelte (81%) rename src/lib/themes/{ => svelte}/carbon/FilterComponents/TextFilter.svelte (80%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/ArrayField.svelte (94%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/CheckboxField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/ColumnsField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/CrudEntityField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/DateField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/DefaultField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/DefaultField.test.ts (97%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/EmailField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/EmailField.test.ts (97%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/KeyValueObjectField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/NumberField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/TabsField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/TextField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/TextareaField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/ToggleField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/FormFieldsComponents/UrlField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/Layout/AdminLayout.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/Menu/SideMenu.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/Menu/TopLeftMenu.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/Menu/TopMenu.svelte (85%) rename src/lib/themes/{ => svelte}/carbon/Menu/TopRightMenu.svelte (98%) rename src/lib/themes/{ => svelte}/carbon/Tabs/Tabs.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/ArrayField.svelte (89%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/ArrayField.test.ts (95%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/CheckboxField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/CheckboxField.test.ts (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/ColumnsField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/CrudEntityField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/DateField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/DateField.test.ts (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/DefaultField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/DefaultField.test.ts (100%) create mode 100644 src/lib/themes/svelte/carbon/ViewFieldsComponents/EmailField.svelte rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/EmailField.test.ts (97%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/KeyValueObjectField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/KeyValueObjectField.test.ts (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/NumberField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/NumberField.test.ts (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/TabsField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/ToggleField.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/UrlField.svelte (95%) rename src/lib/themes/{ => svelte}/carbon/ViewFieldsComponents/ViewLabel.svelte (100%) rename src/lib/themes/{ => svelte}/carbon/index.ts (100%) rename src/lib/themes/{ => svelte}/index.ts (100%) diff --git a/.eslintignore b/.eslintignore index 38972655..e69de29b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,13 +0,0 @@ -.DS_Store -node_modules -/build -/.svelte-kit -/package -.env -.env.* -!.env.example - -# Ignore files for PNPM, NPM and YARN -pnpm-lock.yaml -package-lock.json -yarn.lock diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ebc19589..e1824528 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -26,5 +26,21 @@ module.exports = { parser: '@typescript-eslint/parser' } } + ], + rules: { + '@typescript-eslint/ban-ts-comment': 'off' + }, + ignorePatterns: [ + '.DS_Store', + 'node_modules', + '/build', + '/.svelte-kit', + '/package', + '.env', + '.env.*', + '!.env.example', + 'pnpm-lock.yaml', + 'package-lock.json', + 'yarn.lock' ] }; diff --git a/CHANGELOG.md b/CHANGELOG.md index d01686ac..7a1fa7c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ # Upcoming... +- **BC Break**: Themes are now separate from the lib, and the default Carbon theme was moved to a `themes/svelte/carbon` subdirectory for now. The goal is to be able to use other kind of themes in the future. +- Add `Email` field. - Add a setup to unit-test single components, especially fields, and test a lot of them. - Fix a date parsing bug in `DateField.svelte` by using the luxon lib. - Fix wrongly configured depth display in `KeyValueObjectField.svelte`. - Fix `NumberField.svelte`'s inconsistent handling of numbers & enhance visual. +- Replace local packager to `pnpm`. # v0.16.3 diff --git a/README.md b/README.md index 3fe57555..4901581d 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ which is exactly what we expect when the current web page actually changes! --> {#key $page} =16.0.0} - '@eslint/config-array@0.17.1': - resolution: {integrity: sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/eslintrc@3.1.0': - resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/js@9.9.0': - resolution: {integrity: sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/eslintrc@2.1.4': + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@eslint/object-schema@2.1.4': - resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/js@8.57.0': + resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} '@faker-js/faker@8.4.1': resolution: {integrity: sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==} @@ -480,13 +472,18 @@ packages: '@formatjs/intl-localematcher@0.5.4': resolution: {integrity: sha512-zTwEpWOzZ2CiKcB93BLngUX59hQkuZjT2+SAQEscSm52peDW/getsawMcWF1rGRpMCX6D7nSJA3CzJ8gn13N/g==} + '@humanwhocodes/config-array@0.11.14': + resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} + engines: {node: '>=10.10.0'} + deprecated: Use @eslint/config-array instead + '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - '@humanwhocodes/retry@0.3.0': - resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} - engines: {node: '>=18.18'} + '@humanwhocodes/object-schema@2.0.3': + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} + deprecated: Use @eslint/object-schema instead '@ibm/telemetry-js@1.6.0': resolution: {integrity: sha512-XXdsXhoZwKaJ1/24w/uCqx/YeDQeTu8SAl+7bHQxn62yiFUQ6/D20HhpQVdlG9/Jpv3nYJHFiDH0vGkQbXNFWg==} @@ -763,6 +760,9 @@ packages: resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ungap/structured-clone@1.2.0': + resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@vitest/coverage-v8@2.0.5': resolution: {integrity: sha512-qeFcySCg5FLO2bHHSa0tAZAOnAUbp4L6/A5JDuj9+bt53JREl8hpLjLHEWF0e/gWc8INVpJaqA7+Ene2rclpZg==} peerDependencies: @@ -1023,6 +1023,10 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} + doctrine@3.0.0: + resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} + engines: {node: '>=6.0.0'} + dom-accessibility-api@0.5.16: resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} @@ -1083,8 +1087,8 @@ packages: peerDependencies: eslint: '>=6.0.0' - eslint-config-prettier@9.1.0: - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + eslint-config-prettier@8.10.0: + resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==} hasBin: true peerDependencies: eslint: '>=7.0.0' @@ -1103,27 +1107,14 @@ packages: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint-scope@8.0.2: - resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint-visitor-keys@4.0.0: - resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - eslint@9.9.0: - resolution: {integrity: sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint@8.57.0: + resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true - peerDependencies: - jiti: '*' - peerDependenciesMeta: - jiti: - optional: true esm-env@1.0.0: resolution: {integrity: sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==} @@ -1132,10 +1123,6 @@ packages: resolution: {integrity: sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==} engines: {node: '>=0.10'} - espree@10.1.0: - resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1188,9 +1175,9 @@ packages: fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} - file-entry-cache@8.0.0: - resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} - engines: {node: '>=16.0.0'} + file-entry-cache@6.0.1: + resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} + engines: {node: ^10.12.0 || >=12.0.0} fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} @@ -1200,9 +1187,9 @@ packages: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} - flat-cache@4.0.1: - resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} - engines: {node: '>=16'} + flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} + engines: {node: ^10.12.0 || >=12.0.0} flatpickr@4.6.9: resolution: {integrity: sha512-F0azNNi8foVWKSF+8X+ZJzz8r9sE1G4hl06RyceIaLvyltKvDl6vqk9Lm/6AUUCi5HWaIjiUbk7UpeE/fOXOpw==} @@ -1263,9 +1250,9 @@ packages: engines: {node: '>=12'} deprecated: Glob versions prior to v9 are no longer supported - globals@14.0.0: - resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} - engines: {node: '>=18'} + globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} + engines: {node: '>=8'} globalyzer@0.1.0: resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} @@ -1792,6 +1779,11 @@ packages: deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true + rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + rollup@4.20.0: resolution: {integrity: sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -2049,6 +2041,10 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} + type-fest@0.20.2: + resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} + engines: {node: '>=10'} + type@2.7.3: resolution: {integrity: sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==} @@ -2413,27 +2409,19 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.9.0)': + '@eslint-community/eslint-utils@4.4.0(eslint@8.57.0)': dependencies: - eslint: 9.9.0 + eslint: 8.57.0 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.0': {} - '@eslint/config-array@0.17.1': - dependencies: - '@eslint/object-schema': 2.1.4 - debug: 4.3.6 - minimatch: 3.1.2 - transitivePeerDependencies: - - supports-color - - '@eslint/eslintrc@3.1.0': + '@eslint/eslintrc@2.1.4': dependencies: ajv: 6.12.6 debug: 4.3.6 - espree: 10.1.0 - globals: 14.0.0 + espree: 9.6.1 + globals: 13.24.0 ignore: 5.3.1 import-fresh: 3.3.0 js-yaml: 4.1.0 @@ -2442,9 +2430,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.9.0': {} - - '@eslint/object-schema@2.1.4': {} + '@eslint/js@8.57.0': {} '@faker-js/faker@8.4.1': {} @@ -2472,9 +2458,17 @@ snapshots: dependencies: tslib: 2.6.3 + '@humanwhocodes/config-array@0.11.14': + dependencies: + '@humanwhocodes/object-schema': 2.0.3 + debug: 4.3.6 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + '@humanwhocodes/module-importer@1.0.1': {} - '@humanwhocodes/retry@0.3.0': {} + '@humanwhocodes/object-schema@2.0.3': {} '@ibm/telemetry-js@1.6.0': {} @@ -2686,15 +2680,15 @@ snapshots: '@types/uuid@10.0.0': {} - '@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.9.0)(typescript@5.5.4))(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.0.1(eslint@9.9.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.0.1(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/scope-manager': 8.0.1 - '@typescript-eslint/type-utils': 8.0.1(eslint@9.9.0)(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.1(eslint@9.9.0)(typescript@5.5.4) + '@typescript-eslint/type-utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/visitor-keys': 8.0.1 - eslint: 9.9.0 + eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 @@ -2704,14 +2698,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.0.1(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/parser@8.0.1(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@typescript-eslint/scope-manager': 8.0.1 '@typescript-eslint/types': 8.0.1 '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) '@typescript-eslint/visitor-keys': 8.0.1 debug: 4.3.6 - eslint: 9.9.0 + eslint: 8.57.0 optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: @@ -2722,10 +2716,10 @@ snapshots: '@typescript-eslint/types': 8.0.1 '@typescript-eslint/visitor-keys': 8.0.1 - '@typescript-eslint/type-utils@8.0.1(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.0.1(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) - '@typescript-eslint/utils': 8.0.1(eslint@9.9.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.1(eslint@8.57.0)(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -2751,13 +2745,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.0.1(eslint@9.9.0)(typescript@5.5.4)': + '@typescript-eslint/utils@8.0.1(eslint@8.57.0)(typescript@5.5.4)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@typescript-eslint/scope-manager': 8.0.1 '@typescript-eslint/types': 8.0.1 '@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4) - eslint: 9.9.0 + eslint: 8.57.0 transitivePeerDependencies: - supports-color - typescript @@ -2767,6 +2761,8 @@ snapshots: '@typescript-eslint/types': 8.0.1 eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} + '@vitest/coverage-v8@2.0.5(vitest@2.0.5(@types/node@22.2.0)(jsdom@24.1.1)(sass@1.77.8))': dependencies: '@ampproject/remapping': 2.3.0 @@ -3043,6 +3039,10 @@ snapshots: dependencies: path-type: 4.0.0 + doctrine@3.0.0: + dependencies: + esutils: 2.0.3 + dom-accessibility-api@0.5.16: {} dom-accessibility-api@0.6.3: {} @@ -3138,21 +3138,21 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-compat-utils@0.5.1(eslint@9.9.0): + eslint-compat-utils@0.5.1(eslint@8.57.0): dependencies: - eslint: 9.9.0 + eslint: 8.57.0 semver: 7.6.3 - eslint-config-prettier@9.1.0(eslint@9.9.0): + eslint-config-prettier@8.10.0(eslint@8.57.0): dependencies: - eslint: 9.9.0 + eslint: 8.57.0 - eslint-plugin-svelte@2.43.0(eslint@9.9.0)(svelte@4.2.18): + eslint-plugin-svelte@2.43.0(eslint@8.57.0)(svelte@4.2.18): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@jridgewell/sourcemap-codec': 1.5.0 - eslint: 9.9.0 - eslint-compat-utils: 0.5.1(eslint@9.9.0) + eslint: 8.57.0 + eslint-compat-utils: 0.5.1(eslint@8.57.0) esutils: 2.0.3 known-css-properties: 0.34.0 postcss: 8.4.41 @@ -3171,43 +3171,40 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 - eslint-scope@8.0.2: - dependencies: - esrecurse: 4.3.0 - estraverse: 5.3.0 - eslint-visitor-keys@3.4.3: {} - eslint-visitor-keys@4.0.0: {} - - eslint@9.9.0: + eslint@8.57.0: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.9.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@eslint-community/regexpp': 4.11.0 - '@eslint/config-array': 0.17.1 - '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.9.0 + '@eslint/eslintrc': 2.1.4 + '@eslint/js': 8.57.0 + '@humanwhocodes/config-array': 0.11.14 '@humanwhocodes/module-importer': 1.0.1 - '@humanwhocodes/retry': 0.3.0 '@nodelib/fs.walk': 1.2.8 + '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 debug: 4.3.6 + doctrine: 3.0.0 escape-string-regexp: 4.0.0 - eslint-scope: 8.0.2 - eslint-visitor-keys: 4.0.0 - espree: 10.1.0 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 - file-entry-cache: 8.0.0 + file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 + globals: 13.24.0 + graphemer: 1.4.0 ignore: 5.3.1 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 + js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 lodash.merge: 4.6.2 @@ -3228,12 +3225,6 @@ snapshots: event-emitter: 0.3.5 type: 2.7.3 - espree@10.1.0: - dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) - eslint-visitor-keys: 4.0.0 - espree@9.6.1: dependencies: acorn: 8.12.1 @@ -3297,9 +3288,9 @@ snapshots: dependencies: reusify: 1.0.4 - file-entry-cache@8.0.0: + file-entry-cache@6.0.1: dependencies: - flat-cache: 4.0.1 + flat-cache: 3.2.0 fill-range@7.1.1: dependencies: @@ -3310,10 +3301,11 @@ snapshots: locate-path: 6.0.0 path-exists: 4.0.0 - flat-cache@4.0.1: + flat-cache@3.2.0: dependencies: flatted: 3.3.1 keyv: 4.5.4 + rimraf: 3.0.2 flatpickr@4.6.9: {} @@ -3375,7 +3367,9 @@ snapshots: minimatch: 5.1.6 once: 1.4.0 - globals@14.0.0: {} + globals@13.24.0: + dependencies: + type-fest: 0.20.2 globalyzer@0.1.0: {} @@ -3867,6 +3861,10 @@ snapshots: dependencies: glob: 7.2.3 + rimraf@3.0.2: + dependencies: + glob: 7.2.3 + rollup@4.20.0: dependencies: '@types/estree': 1.0.5 @@ -4136,6 +4134,8 @@ snapshots: dependencies: prelude-ls: 1.2.1 + type-fest@0.20.2: {} + type@2.7.3: {} typedoc-plugin-mdn-links@3.2.8(typedoc@0.26.5(typescript@5.5.4)): diff --git a/src/lib/Config.ts b/src/lib/Config.ts index 5e63d7dc..9a5ba6d0 100644 --- a/src/lib/Config.ts +++ b/src/lib/Config.ts @@ -1,9 +1,5 @@ -import type { ThemeConfig } from '$lib'; -import { carbon } from '$lib/themes'; - /** */ export type AdminConfig = { - theme: ThemeConfig; defaultLocale: string; autoCloseSideMenu: boolean; rootUrl: string; @@ -15,7 +11,6 @@ export type AdminConfig = { export function defaultAdminConfig(): AdminConfig { return { - theme: carbon, defaultLocale: 'en', autoCloseSideMenu: false, rootUrl: '/', diff --git a/src/lib/Dashboard.test.ts b/src/lib/Dashboard.test.ts index 7bc052fd..8b2620f8 100644 --- a/src/lib/Dashboard.test.ts +++ b/src/lib/Dashboard.test.ts @@ -7,6 +7,7 @@ import { List } from '$lib'; import { testOptions } from '$lib/TestOptions'; +import carbon from '$lib/themes/svelte/carbon'; type Book = object; @@ -15,6 +16,7 @@ describe( () => { it('can be instantiated with simple config', () => { const dashboard = new DashboardDefinition({ + theme: carbon, adminConfig: {}, cruds: [ new CrudDefinition({ @@ -32,6 +34,7 @@ describe( it('has a properly defined first action', () => { const dashboard = new DashboardDefinition({ + theme: carbon, adminConfig: {}, cruds: [ new CrudDefinition({ @@ -51,6 +54,7 @@ describe( it('fails when two cruds have the same name', () => { const createDashboard = () => { new DashboardDefinition({ + theme: carbon, adminConfig: {}, cruds: [ new CrudDefinition({ diff --git a/src/lib/Dashboard.ts b/src/lib/Dashboard.ts index 94ad135c..f5b7a3d2 100644 --- a/src/lib/Dashboard.ts +++ b/src/lib/Dashboard.ts @@ -4,7 +4,8 @@ import { type MenuLink, type CrudDefinition, type Dictionaries, - defaultAdminConfig + defaultAdminConfig, + type ThemeConfig } from '$lib'; /** */ @@ -17,6 +18,7 @@ export type DashboardStores = { /** */ export type DashboardDefinitionOptions = { + theme: ThemeConfig; adminConfig: Partial; cruds: Array>; rootUrl?: string; @@ -29,6 +31,7 @@ export type DashboardDefinitionOptions = { /** * @example * export const dashboard = new DashboardDefinition({ + * theme: carbon, // Import from the lib's themes * admin: ..., // see AdminConfig * * // The main menu on the left side of the page @@ -44,6 +47,7 @@ export type DashboardDefinitionOptions = { * }); */ export class DashboardDefinition { + /** */ public readonly theme: ThemeConfig; /** */ public readonly adminConfig: AdminConfig; /** */ public readonly cruds: Array>; /** */ public readonly localeDictionaries: Dictionaries = {}; @@ -53,6 +57,7 @@ export class DashboardDefinition { /** */ constructor(options: DashboardDefinitionOptions) { + this.theme = options.theme; this.adminConfig = { ...defaultAdminConfig(), ...(options.adminConfig || {}) }; this.cruds = options.cruds; this.localeDictionaries = options.localeDictionaries || {}; diff --git a/src/lib/Fields/Email.ts b/src/lib/Fields/Email.ts index 47f27ca1..c520a679 100644 --- a/src/lib/Fields/Email.ts +++ b/src/lib/Fields/Email.ts @@ -2,8 +2,7 @@ import type { InputFieldOptions, FormFieldTheme, ViewFieldTheme } from '$lib'; import { BaseField } from '$lib/Fields'; /** */ -export type EmailFieldOptions = InputFieldOptions & { -}; +export type EmailFieldOptions = InputFieldOptions & {}; /** */ export class EmailField extends BaseField { diff --git a/src/lib/themes/carbon/ViewFieldsComponents/EmailField.svelte b/src/lib/themes/carbon/ViewFieldsComponents/EmailField.svelte deleted file mode 100644 index 624177c1..00000000 --- a/src/lib/themes/carbon/ViewFieldsComponents/EmailField.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - -{#if value !== '' && value && value.length > 0} - {value} -{:else} - - -{/if} diff --git a/src/lib/themes/carbon/Columns/Columns.svelte b/src/lib/themes/svelte/carbon/Columns/Columns.svelte similarity index 98% rename from src/lib/themes/carbon/Columns/Columns.svelte rename to src/lib/themes/svelte/carbon/Columns/Columns.svelte index f7223de6..a08408b7 100644 --- a/src/lib/themes/carbon/Columns/Columns.svelte +++ b/src/lib/themes/svelte/carbon/Columns/Columns.svelte @@ -14,7 +14,6 @@ export let field: ColumnField; export let operation: CrudOperation; export let entityObject: Record = {}; - export let value: unknown; export let theme: ThemeConfig; diff --git a/src/lib/themes/carbon/Columns/Columns.test.ts b/src/lib/themes/svelte/carbon/Columns/Columns.test.ts similarity index 91% rename from src/lib/themes/carbon/Columns/Columns.test.ts rename to src/lib/themes/svelte/carbon/Columns/Columns.test.ts index 7eb37ff9..af826083 100644 --- a/src/lib/themes/carbon/Columns/Columns.test.ts +++ b/src/lib/themes/svelte/carbon/Columns/Columns.test.ts @@ -1,6 +1,7 @@ import { describe, it, expect } from 'vitest'; import { render } from '@testing-library/svelte'; import '@testing-library/jest-dom'; +import { carbon } from '$lib/themes/svelte'; import { testOptions } from '$lib/TestOptions'; import { CallbackStateProcessor, @@ -9,9 +10,9 @@ import { CrudDefinition, DashboardDefinition, initLocale, - TextField, - View + TextField } from '$lib'; +import { View } from '$lib/Crud/Operations'; import ComponentToTest from './Columns.svelte'; import TextComponent from '../ViewFieldsComponents/DefaultField.svelte'; @@ -41,6 +42,7 @@ describe( function mockComponentProps(field: Columns) { const dashboard = new DashboardDefinition({ + theme: carbon, adminConfig: {}, cruds: [ new CrudDefinition({ @@ -61,6 +63,6 @@ function mockComponentProps(field: Columns) { operation: (dashboard.cruds[0] as CrudDefinition).options.operations[0], entityObject: { test_field: 'default_value' }, value: 'default_value', - theme: dashboard.adminConfig.theme + theme: dashboard.theme }; } diff --git a/src/lib/themes/carbon/Crud/CrudDelete.svelte b/src/lib/themes/svelte/carbon/Crud/CrudDelete.svelte similarity index 100% rename from src/lib/themes/carbon/Crud/CrudDelete.svelte rename to src/lib/themes/svelte/carbon/Crud/CrudDelete.svelte diff --git a/src/lib/themes/carbon/Crud/CrudEdit.svelte b/src/lib/themes/svelte/carbon/Crud/CrudEdit.svelte similarity index 96% rename from src/lib/themes/carbon/Crud/CrudEdit.svelte rename to src/lib/themes/svelte/carbon/Crud/CrudEdit.svelte index 78805a81..7d535294 100644 --- a/src/lib/themes/carbon/Crud/CrudEdit.svelte +++ b/src/lib/themes/svelte/carbon/Crud/CrudEdit.svelte @@ -19,7 +19,7 @@ export let crud: CrudDefinition; export let requestParameters: RequestParameters = {}; - const CrudForm = dashboard.adminConfig.theme.form; + const CrudForm = dashboard.theme.form; let defaultData: StateProviderResult = crud.options.stateProvider.provide( operation, @@ -54,7 +54,7 @@ {:else}

diff --git a/src/lib/themes/carbon/Crud/CrudNew.svelte b/src/lib/themes/svelte/carbon/Crud/CrudNew.svelte similarity index 96% rename from src/lib/themes/carbon/Crud/CrudNew.svelte rename to src/lib/themes/svelte/carbon/Crud/CrudNew.svelte index 3c7d6ed6..5e417205 100644 --- a/src/lib/themes/carbon/Crud/CrudNew.svelte +++ b/src/lib/themes/svelte/carbon/Crud/CrudNew.svelte @@ -22,7 +22,7 @@ ; export let requestParameters: RequestParameters = {}; - const CrudViewField = dashboard.adminConfig.theme.viewField; + const CrudViewField = dashboard.theme.viewField; let fields: FieldInterface[] = operation.fields; @@ -50,7 +50,7 @@ {operation} {field} {entityObject} - theme={dashboard.adminConfig.theme} + theme={dashboard.theme} value={entityObject[field.name]} /> {/each} diff --git a/src/lib/themes/carbon/Crud/CrudViewField.svelte b/src/lib/themes/svelte/carbon/Crud/CrudViewField.svelte similarity index 93% rename from src/lib/themes/carbon/Crud/CrudViewField.svelte rename to src/lib/themes/svelte/carbon/Crud/CrudViewField.svelte index bec26baa..fdcc7651 100644 --- a/src/lib/themes/carbon/Crud/CrudViewField.svelte +++ b/src/lib/themes/svelte/carbon/Crud/CrudViewField.svelte @@ -7,7 +7,7 @@ import type { CrudOperation } from '$lib/Crud/Operations'; import type { ThemeConfig } from '$lib/types'; - import DefaultField from '$lib/themes/carbon/ViewFieldsComponents/DefaultField.svelte'; + import DefaultField from '$lib/themes/svelte/carbon/ViewFieldsComponents/DefaultField.svelte'; export let operation: CrudOperation; export let field: FieldInterface; diff --git a/src/lib/themes/carbon/Dashboard/Dashboard.svelte b/src/lib/themes/svelte/carbon/Dashboard/Dashboard.svelte similarity index 92% rename from src/lib/themes/carbon/Dashboard/Dashboard.svelte rename to src/lib/themes/svelte/carbon/Dashboard/Dashboard.svelte index c0ded7a9..7181cc0c 100644 --- a/src/lib/themes/carbon/Dashboard/Dashboard.svelte +++ b/src/lib/themes/svelte/carbon/Dashboard/Dashboard.svelte @@ -3,7 +3,7 @@ import InlineNotification from 'carbon-components-svelte/src/Notification/InlineNotification.svelte'; - import AdminLayout from '$lib/themes/carbon/Layout/AdminLayout.svelte'; + import AdminLayout from '$lib/themes/svelte/carbon/Layout/AdminLayout.svelte'; import type { DashboardDefinition } from '$lib/Dashboard'; import type { CrudOperation } from '$lib/Crud/Operations'; import type { CrudDefinition } from '$lib/Crud'; @@ -26,9 +26,7 @@ .forEach((resolved: CrudOperation) => (currentCrudOperation = resolved)); const themeComponent = - currentCrudOperation?.dashboard.adminConfig.theme.crudActions[ - currentCrudOperation?.displayComponentName - ]; + currentCrudOperation?.dashboard.theme.crudActions[currentCrudOperation?.displayComponentName]; const sideMenu = dashboard.stores.sideMenu; const topLeftMenu = dashboard.stores.topLeftMenu; diff --git a/src/lib/themes/carbon/DataTable/DataTable.svelte b/src/lib/themes/svelte/carbon/DataTable/DataTable.svelte similarity index 95% rename from src/lib/themes/carbon/DataTable/DataTable.svelte rename to src/lib/themes/svelte/carbon/DataTable/DataTable.svelte index be5c050d..72626ccd 100644 --- a/src/lib/themes/carbon/DataTable/DataTable.svelte +++ b/src/lib/themes/svelte/carbon/DataTable/DataTable.svelte @@ -6,8 +6,8 @@ import InlineNotification from 'carbon-components-svelte/src/Notification/InlineNotification.svelte'; import Loading from 'carbon-components-svelte/src/Loading/Loading.svelte'; - import DataTableToolbar from '$lib/themes/carbon/DataTable/Toolbar/DataTableToolbar.svelte'; - import ItemActions from '$lib/themes/carbon/DataTable/actions/ItemActions.svelte'; + import DataTableToolbar from '$lib/themes/svelte/carbon/DataTable/Toolbar/DataTableToolbar.svelte'; + import ItemActions from '$lib/themes/svelte/carbon/DataTable/actions/ItemActions.svelte'; import type { Headers, Row, Rows } from '$lib/DataTable'; import type { Action } from '$lib/Actions'; import type { FilterInterface, FilterOptions } from '$lib/Filter'; diff --git a/src/lib/themes/carbon/DataTable/Toolbar/DataTableToolbar.svelte b/src/lib/themes/svelte/carbon/DataTable/Toolbar/DataTableToolbar.svelte similarity index 93% rename from src/lib/themes/carbon/DataTable/Toolbar/DataTableToolbar.svelte rename to src/lib/themes/svelte/carbon/DataTable/Toolbar/DataTableToolbar.svelte index 3529d50a..63ade1e6 100644 --- a/src/lib/themes/carbon/DataTable/Toolbar/DataTableToolbar.svelte +++ b/src/lib/themes/svelte/carbon/DataTable/Toolbar/DataTableToolbar.svelte @@ -11,8 +11,8 @@ import FilterReset from 'carbon-icons-svelte/lib/FilterReset.svelte'; import type { Action } from '$lib/Actions'; - import ActionComponent from '$lib/themes/carbon/DataTable/Toolbar/ToolbarAction.svelte'; - import FilterComponent from '$lib/themes/carbon/DataTable/Toolbar/ToolbarFilter.svelte'; + import ActionComponent from '$lib/themes/svelte/carbon/DataTable/Toolbar/ToolbarAction.svelte'; + import FilterComponent from '$lib/themes/svelte/carbon/DataTable/Toolbar/ToolbarFilter.svelte'; import type { Filter, FilterOptions } from '$lib/Filter'; import type { ThemeConfig } from '$lib/types'; import { getSubmittedFormData } from '$lib/Crud/Form'; diff --git a/src/lib/themes/carbon/DataTable/Toolbar/ToolbarAction.svelte b/src/lib/themes/svelte/carbon/DataTable/Toolbar/ToolbarAction.svelte similarity index 100% rename from src/lib/themes/carbon/DataTable/Toolbar/ToolbarAction.svelte rename to src/lib/themes/svelte/carbon/DataTable/Toolbar/ToolbarAction.svelte diff --git a/src/lib/themes/carbon/DataTable/Toolbar/ToolbarFilter.svelte b/src/lib/themes/svelte/carbon/DataTable/Toolbar/ToolbarFilter.svelte similarity index 100% rename from src/lib/themes/carbon/DataTable/Toolbar/ToolbarFilter.svelte rename to src/lib/themes/svelte/carbon/DataTable/Toolbar/ToolbarFilter.svelte diff --git a/src/lib/themes/carbon/DataTable/actions/ItemActions.svelte b/src/lib/themes/svelte/carbon/DataTable/actions/ItemActions.svelte similarity index 84% rename from src/lib/themes/carbon/DataTable/actions/ItemActions.svelte rename to src/lib/themes/svelte/carbon/DataTable/actions/ItemActions.svelte index 343584ea..47316ff2 100644 --- a/src/lib/themes/carbon/DataTable/actions/ItemActions.svelte +++ b/src/lib/themes/svelte/carbon/DataTable/actions/ItemActions.svelte @@ -3,7 +3,7 @@ import Row from 'carbon-components-svelte/src/Grid/Row.svelte'; import Column from 'carbon-components-svelte/src/Grid/Column.svelte'; - import SingleAction from '$lib/themes/carbon/DataTable/actions/SingleAction.svelte'; + import SingleAction from '$lib/themes/svelte/carbon/DataTable/actions/SingleAction.svelte'; import type { Action } from '$lib/Actions'; export let actions: Action[] = []; diff --git a/src/lib/themes/carbon/DataTable/actions/SingleAction.svelte b/src/lib/themes/svelte/carbon/DataTable/actions/SingleAction.svelte similarity index 100% rename from src/lib/themes/carbon/DataTable/actions/SingleAction.svelte rename to src/lib/themes/svelte/carbon/DataTable/actions/SingleAction.svelte diff --git a/src/lib/themes/carbon/FilterComponents/BooleanFilter.svelte b/src/lib/themes/svelte/carbon/FilterComponents/BooleanFilter.svelte similarity index 95% rename from src/lib/themes/carbon/FilterComponents/BooleanFilter.svelte rename to src/lib/themes/svelte/carbon/FilterComponents/BooleanFilter.svelte index 766b893c..3794f645 100644 --- a/src/lib/themes/carbon/FilterComponents/BooleanFilter.svelte +++ b/src/lib/themes/svelte/carbon/FilterComponents/BooleanFilter.svelte @@ -5,7 +5,7 @@ import Close from 'carbon-icons-svelte/lib/Close.svelte'; import CheckboxIndeterminate from 'carbon-icons-svelte/lib/CheckboxIndeterminate.svelte'; import type { TextFilter } from '$lib/Filter'; - import FilterContainer from '$lib/themes/carbon/FilterComponents/Internal/FilterContainer.svelte'; + import FilterContainer from '$lib/themes/svelte/carbon/FilterComponents/Internal/FilterContainer.svelte'; export let filter: TextFilter; let value: boolean | null = null; diff --git a/src/lib/themes/carbon/FilterComponents/DateFilter.svelte b/src/lib/themes/svelte/carbon/FilterComponents/DateFilter.svelte similarity index 88% rename from src/lib/themes/carbon/FilterComponents/DateFilter.svelte rename to src/lib/themes/svelte/carbon/FilterComponents/DateFilter.svelte index d8f47926..1fa16957 100644 --- a/src/lib/themes/carbon/FilterComponents/DateFilter.svelte +++ b/src/lib/themes/svelte/carbon/FilterComponents/DateFilter.svelte @@ -4,7 +4,7 @@ import DatePicker from 'carbon-components-svelte/src/DatePicker/DatePicker.svelte'; import type { DateFilter } from '$lib/Filter'; - import FilterContainer from '$lib/themes/carbon/FilterComponents/Internal/FilterContainer.svelte'; + import FilterContainer from '$lib/themes/svelte/carbon/FilterComponents/Internal/FilterContainer.svelte'; export let filter: DateFilter; diff --git a/src/lib/themes/carbon/FilterComponents/Internal/FilterContainer.svelte b/src/lib/themes/svelte/carbon/FilterComponents/Internal/FilterContainer.svelte similarity index 100% rename from src/lib/themes/carbon/FilterComponents/Internal/FilterContainer.svelte rename to src/lib/themes/svelte/carbon/FilterComponents/Internal/FilterContainer.svelte diff --git a/src/lib/themes/carbon/FilterComponents/NumericFilter.svelte b/src/lib/themes/svelte/carbon/FilterComponents/NumericFilter.svelte similarity index 81% rename from src/lib/themes/carbon/FilterComponents/NumericFilter.svelte rename to src/lib/themes/svelte/carbon/FilterComponents/NumericFilter.svelte index 3e32c1e6..a5f1d17f 100644 --- a/src/lib/themes/carbon/FilterComponents/NumericFilter.svelte +++ b/src/lib/themes/svelte/carbon/FilterComponents/NumericFilter.svelte @@ -1,7 +1,7 @@ + +{#if value !== '' && value && value.length > 0} + {value} +{:else} + - +{/if} diff --git a/src/lib/themes/carbon/ViewFieldsComponents/EmailField.test.ts b/src/lib/themes/svelte/carbon/ViewFieldsComponents/EmailField.test.ts similarity index 97% rename from src/lib/themes/carbon/ViewFieldsComponents/EmailField.test.ts rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/EmailField.test.ts index e7a5cc0e..07700746 100644 --- a/src/lib/themes/carbon/ViewFieldsComponents/EmailField.test.ts +++ b/src/lib/themes/svelte/carbon/ViewFieldsComponents/EmailField.test.ts @@ -29,7 +29,7 @@ describe( it('can be instantiated specific value', async () => { const rendered = render(ComponentToTest, { - value: 'test@dummy.localhost', + value: 'test@dummy.localhost' }); const element = rendered.container; diff --git a/src/lib/themes/carbon/ViewFieldsComponents/KeyValueObjectField.svelte b/src/lib/themes/svelte/carbon/ViewFieldsComponents/KeyValueObjectField.svelte similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/KeyValueObjectField.svelte rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/KeyValueObjectField.svelte diff --git a/src/lib/themes/carbon/ViewFieldsComponents/KeyValueObjectField.test.ts b/src/lib/themes/svelte/carbon/ViewFieldsComponents/KeyValueObjectField.test.ts similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/KeyValueObjectField.test.ts rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/KeyValueObjectField.test.ts diff --git a/src/lib/themes/carbon/ViewFieldsComponents/NumberField.svelte b/src/lib/themes/svelte/carbon/ViewFieldsComponents/NumberField.svelte similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/NumberField.svelte rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/NumberField.svelte diff --git a/src/lib/themes/carbon/ViewFieldsComponents/NumberField.test.ts b/src/lib/themes/svelte/carbon/ViewFieldsComponents/NumberField.test.ts similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/NumberField.test.ts rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/NumberField.test.ts diff --git a/src/lib/themes/carbon/ViewFieldsComponents/TabsField.svelte b/src/lib/themes/svelte/carbon/ViewFieldsComponents/TabsField.svelte similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/TabsField.svelte rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/TabsField.svelte diff --git a/src/lib/themes/carbon/ViewFieldsComponents/ToggleField.svelte b/src/lib/themes/svelte/carbon/ViewFieldsComponents/ToggleField.svelte similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/ToggleField.svelte rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/ToggleField.svelte diff --git a/src/lib/themes/carbon/ViewFieldsComponents/UrlField.svelte b/src/lib/themes/svelte/carbon/ViewFieldsComponents/UrlField.svelte similarity index 95% rename from src/lib/themes/carbon/ViewFieldsComponents/UrlField.svelte rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/UrlField.svelte index 47aa040d..c5ecced3 100644 --- a/src/lib/themes/carbon/ViewFieldsComponents/UrlField.svelte +++ b/src/lib/themes/svelte/carbon/ViewFieldsComponents/UrlField.svelte @@ -14,6 +14,7 @@ new URL(value, getOrigin()); // Throws exception on invalid URLs valid = true; } catch (e) { + console.warn('URL parsing error: ' + e); valid = false; } } diff --git a/src/lib/themes/carbon/ViewFieldsComponents/ViewLabel.svelte b/src/lib/themes/svelte/carbon/ViewFieldsComponents/ViewLabel.svelte similarity index 100% rename from src/lib/themes/carbon/ViewFieldsComponents/ViewLabel.svelte rename to src/lib/themes/svelte/carbon/ViewFieldsComponents/ViewLabel.svelte diff --git a/src/lib/themes/carbon/index.ts b/src/lib/themes/svelte/carbon/index.ts similarity index 100% rename from src/lib/themes/carbon/index.ts rename to src/lib/themes/svelte/carbon/index.ts diff --git a/src/lib/themes/index.ts b/src/lib/themes/svelte/index.ts similarity index 100% rename from src/lib/themes/index.ts rename to src/lib/themes/svelte/index.ts diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 0a31df83..c1e18e7f 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -10,7 +10,7 @@ initLocale('fr', { fr }); - +

Svelte Admin demo app

diff --git a/src/routes/admin/[crud]/[operation]/+page.svelte b/src/routes/admin/[crud]/[operation]/+page.svelte index 59872069..43f4ca6e 100644 --- a/src/routes/admin/[crud]/[operation]/+page.svelte +++ b/src/routes/admin/[crud]/[operation]/+page.svelte @@ -12,7 +12,7 @@ {#key $page} ({ throw new Error(`Invalid "page" value: expected a number, got "${page}".`); } - let entities = getStorage().all(); + const entities = getStorage().all(); const listEntities = entities.slice(itemsPerPage * (page - 1), itemsPerPage * page); diff --git a/src/testApp/internal/memoryStorage.ts b/src/testApp/internal/memoryStorage.ts index 15f5e125..f2895d73 100644 --- a/src/testApp/internal/memoryStorage.ts +++ b/src/testApp/internal/memoryStorage.ts @@ -48,7 +48,8 @@ export class InMemoryStorage implements InternalStorage { try { item = this.get(object.id); } catch (e) { - // + console.error('Could not fetch item from storage: '); + console.error(e); } if (item) { throw new Error(