diff --git a/.gitignore b/.gitignore index a2cb1118..99da5033 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,10 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data *.pid @@ -10,35 +14,38 @@ yarn-error.log* *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover -lib-cov +lib-cov/ # Coverage directory used by tools like istanbul -coverage +coverage/ # nyc test coverage -.nyc_output +.nyc_output/ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt +.grunt/ # Bower dependency directory (https://bower.io/) -bower_components +bower_components/ # node-waf configuration -.lock-wscript +.lock-wscript/ # Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release +build/Release/ # Dependency directories node_modules/ jspm_packages/ +# TypeScript cache +*.tsbuildinfo + # Optional npm cache directory -.npm +.npm/ # Optional eslint cache -.eslintcache +.eslintcache/ # Optional REPL history .node_repl_history @@ -51,28 +58,45 @@ jspm_packages/ # dotenv environment variables file .env +.env.development.local +.env.test.local +.env.production.local +.env.local # next.js build output -.next +.next/ -# OS X temporary files -.DS_Store +# Docusaurus cache and generated files +.docusaurus/ -# Visual Studio Code -.vscode -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!*.code-workspace +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# yarn v2 +.yarn/cache/ +.yarn/unplugged/ +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# OS X temporary files +.DS_Store/ # IntelliJ IDEA project files; if you want to commit IntelliJ settings, this recipe may be helpful: # https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore .idea/ *.iml -# Vitest output files -.vite/ +# Visual Studio Code +.vscode/ +!.vscode/tasks.json +!.vscode/launch.json # Rush temporary files common/deploy/ @@ -81,25 +105,25 @@ common/autoinstallers/*/.npmrc **/.rush/temp/ *.lock +# Common toolchain intermediate files +temp/ +lib/ +lib-amd/ +lib-es6/ +lib-esnext/ +lib-commonjs/ +lib-shim/ +dist/ +dist-storybook/ +tsdoc-metadata.json +*.tsbuildinfo + # Heft temporary files -.cache -.heft +.cache/ +.heft/ -# Common toolchain intermediate files -temp -lib -lib-amd -lib-es6 -lib-esnext -lib-commonjs -lib-shim -dist -dist-storybook -*.scss.ts -*.sass.ts - -# Typescript build files -**/tsconfig.tsbuildinfo +# Vitest output files +.vite/ # XState generated files **/*.typegen.ts diff --git a/.prettierignore b/.prettierignore index e163518e..b32353e5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,6 +7,10 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data *.pid @@ -14,38 +18,38 @@ yarn-error.log* *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover -lib-cov +lib-cov/ # Coverage directory used by tools like istanbul -coverage +coverage/ # nyc test coverage -.nyc_output +.nyc_output/ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt +.grunt/ # Bower dependency directory (https://bower.io/) -bower_components +bower_components/ # node-waf configuration -.lock-wscript +.lock-wscript/ # Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Build outputs -dist/ +build/Release/ # Dependency directories node_modules/ jspm_packages/ +# TypeScript cache +*.tsbuildinfo + # Optional npm cache directory -.npm +.npm/ # Optional eslint cache -.eslintcache +.eslintcache/ # Optional REPL history .node_repl_history @@ -58,28 +62,85 @@ jspm_packages/ # dotenv environment variables file .env +.env.development.local +.env.test.local +.env.production.local +.env.local # next.js build output -.next +.next/ + +# Docusaurus cache and generated files +.docusaurus/ + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# yarn v2 +.yarn/cache/ +.yarn/unplugged/ +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* # OS X temporary files -.DS_Store +.DS_Store/ + +# IntelliJ IDEA project files; if you want to commit IntelliJ settings, this recipe may be helpful: +# https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +.idea/ +*.iml + +# Visual Studio Code +.vscode/ +!.vscode/tasks.json +!.vscode/launch.json # Rush temporary files common/deploy/ common/temp/ common/autoinstallers/*/.npmrc **/.rush/temp/ +*.lock + +# Common toolchain intermediate files +temp/ +lib/ +lib-amd/ +lib-es6/ +lib-esnext/ +lib-commonjs/ +lib-shim/ +dist/ +dist-storybook/ +*.tsbuildinfo + +# Heft temporary files +.cache/ +.heft/ + +# Vitest output files +.vite/ +# XState generated files +**/*.typegen.ts #------------------------------------------------------------------------------------------------------------------- # Prettier-specific overrides #------------------------------------------------------------------------------------------------------------------- -# Rush files +# Machine-generated files +common/reviews/ common/changes/ common/scripts/ -common/config/ +common/config/rush/browser-approved-packages.json +common/config/rush/nonbrowser-approved-packages.json CHANGELOG.* # Package manager files @@ -92,5 +153,5 @@ shrinkwrap.json lib .github -# Prettier reformats code blocks inside Markdown, which affects rendered output -*.md \ No newline at end of file +# We'll consider enabling this later; Prettier reformats code blocks, which affects end-user content +*.md diff --git a/aform/.npmignore b/aform/.npmignore index 0c5b1f0c..6a35f587 100644 --- a/aform/.npmignore +++ b/aform/.npmignore @@ -9,6 +9,7 @@ !/src-*/** !/dist/** !ThirdPartyNotice.txt +!tsdoc-metadata.json # Ignore certain patterns that should not get published. /dist/*.stats.* diff --git a/aform/config/api-extractor.json b/aform/config/api-extractor.json new file mode 100644 index 00000000..bb594365 --- /dev/null +++ b/aform/config/api-extractor.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../common/config/api-extractor-base.json", + + "docModel": { + "enabled": true, + "projectFolderUrl": "https://github.com/agritheory/stonecrop/tree/development/aform" + }, + + "messages": { + "extractorMessageReporting": { + // Disable this validation at your own risk: Processing an incorrect file type + // may lead to other errors. Function bodies may incorrectly get emitted in the + // .d.ts rollup. + "ae-wrong-input-file-type": { + "logLevel": "none" + } + } + } +} diff --git a/aform/config/rig.json b/aform/config/rig.json new file mode 100644 index 00000000..4c3bb418 --- /dev/null +++ b/aform/config/rig.json @@ -0,0 +1,6 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "stonecrop-rig" +} diff --git a/aform/package.json b/aform/package.json index cb30faa5..3f8b5b57 100644 --- a/aform/package.json +++ b/aform/package.json @@ -17,28 +17,26 @@ }, "exports": { ".": { - "import": "./dist/aform.js", + "import": { + "types": "./dist/aform/src/index.d.ts", + "default": "./dist/aform.js" + }, "require": "./dist/aform.umd.cjs" }, "./styles": "./dist/style.css" }, - "main": "dist/aform.js", - "module": "dist/aform.js", - "umd": "dist/aform.umd.cjs", - "types": "src/index", + "typings": "./dist/aform/src/index.d.ts", "files": [ "dist/*", "src/*" ], "scripts": { - "prepublish": "tsc -b && vite build", - "build": "tsc -b && vite build", + "prepublish": "heft build && vite build && rushx docs", + "build": "heft build && vite build && rushx docs", "dev": "vite", + "docs": "api-documenter markdown -i temp -o ../docs/aform", "lint": "eslint . --ext .ts,.vue", "preview": "vite preview", - "story:build": "histoire build", - "story:dev": "histoire dev", - "story:preview": "histoire preview", "test": "vitest", "test:coverage": "vitest run --coverage", "test:ui": "vitest --ui" @@ -46,29 +44,28 @@ "dependencies": { "@stonecrop/themes": "workspace:*", "@stonecrop/utilities": "workspace:*", - "uuid": "^9.0.0", - "vue": "^3.4.23" + "vue": "^3.4.31" }, "devDependencies": { - "@histoire/plugin-vue": "^0.17.17", + "@microsoft/api-documenter": "^7.25.3", + "@rushstack/heft": "^0.66.18", "@stonecrop/atable": "workspace:*", - "@types/uuid": "^9.0.0", - "@typescript-eslint/eslint-plugin": "^7.6.0", - "@typescript-eslint/parser": "^7.6.0", - "@vitejs/plugin-vue": "^5.0.4", + "@typescript-eslint/eslint-plugin": "^7.14.1", + "@typescript-eslint/parser": "^7.14.1", + "@vitejs/plugin-vue": "^5.0.5", "@vitest/coverage-istanbul": "^1.6.0", "@vitest/ui": "^1.6.0", "@vue/test-utils": "^2.4.6", - "cypress": "^12.11.0", + "cypress": "^13.11.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-vue": "^9.11.1", "eslint": "^8.40.0", - "histoire": "^0.17.17", "jsdom": "^24.0.0", - "typescript": "^5.4.5", - "vite": "^5.2.9", + "stonecrop-rig": "workspace:*", + "typescript": "^5.5.2", + "vite": "^5.3.2", "vitest": "^1.6.0", - "vue-router": "^4" + "vue-router": "^4.4.0" }, "peerDependencies": { "@stonecrop/atable": "workspace:*" diff --git a/aform/src/components/AForm.vue b/aform/src/components/AForm.vue index 58cc3b80..767dfd13 100644 --- a/aform/src/components/AForm.vue +++ b/aform/src/components/AForm.vue @@ -16,7 +16,7 @@ diff --git a/aform/tsconfig.json b/aform/tsconfig.json index e5c403e5..b4da4e30 100644 --- a/aform/tsconfig.json +++ b/aform/tsconfig.json @@ -1,27 +1,12 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "composite": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "baseUrl": ".", + "tsBuildInfoFile": "./dist/aform.tsbuildinfo", "types": ["vitest/globals", "vitest/jsdom"], "paths": { - "@/*": ["src/*"], - "types/*": ["types/*"] + "@/*": ["./src/*"], + "types/*": ["./src/types/*"] } }, - "include": [ - "env.d.ts", - "src/**/*", - "src/**/*.ts", - "src/**/*.vue", - "stories/**/*.json", - "stories/**/*.story.vue", - "tests/**/*.spec.ts", - "tests/**/*.ts", - "tests/**/*.vue", - "types/**/*.ts" - ] + "include": ["src/**/*", "src/**/*.ts", "src/**/*.vue", "tests/**/*.spec.ts", "tests/**/*.ts", "tests/**/*.vue"] } diff --git a/aform/vite.config.ts b/aform/vite.config.ts index d3f59216..43b54594 100644 --- a/aform/vite.config.ts +++ b/aform/vite.config.ts @@ -1,7 +1,5 @@ -/// /// -import { HstVue } from '@histoire/plugin-vue' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' import { coverageConfigDefaults, defineConfig } from 'vitest/config' @@ -13,9 +11,11 @@ export default defineConfig({ resolve: { alias: { '@': resolve(projectRootDir, 'src'), + types: resolve(projectRootDir, 'src/types'), }, }, build: { + emptyOutDir: false, sourcemap: true, lib: { entry: resolve(projectRootDir, 'src/index.ts'), @@ -30,11 +30,6 @@ export default defineConfig({ }, }, }, - histoire: { - plugins: [HstVue()], - setupFile: '/src/histoire.setup.ts', - storyIgnored: ['**/node_modules/**', '**/dist/**'], - }, test: { globals: true, environment: 'jsdom', @@ -52,9 +47,7 @@ export default defineConfig({ }, exclude: [ ...coverageConfigDefaults.exclude, - '**/*.setup.ts', // ignore histoire setup files 'src/index.ts', // ignore the entry file - 'stories/**', // ignore histoire storybook files 'types/**', // ignore types ], }, diff --git a/atable/.npmignore b/atable/.npmignore index 0c5b1f0c..6a35f587 100644 --- a/atable/.npmignore +++ b/atable/.npmignore @@ -9,6 +9,7 @@ !/src-*/** !/dist/** !ThirdPartyNotice.txt +!tsdoc-metadata.json # Ignore certain patterns that should not get published. /dist/*.stats.* diff --git a/atable/config/api-extractor.json b/atable/config/api-extractor.json new file mode 100644 index 00000000..c2507d49 --- /dev/null +++ b/atable/config/api-extractor.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../common/config/api-extractor-base.json", + + "docModel": { + "enabled": true, + "projectFolderUrl": "https://github.com/agritheory/stonecrop/tree/development/atable" + }, + + "messages": { + "extractorMessageReporting": { + // Disable this validation at your own risk: Processing an incorrect file type + // may lead to other errors. Function bodies may incorrectly get emitted in the + // .d.ts rollup. + "ae-wrong-input-file-type": { + "logLevel": "none" + } + } + } +} diff --git a/atable/config/rig.json b/atable/config/rig.json new file mode 100644 index 00000000..4c3bb418 --- /dev/null +++ b/atable/config/rig.json @@ -0,0 +1,6 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "stonecrop-rig" +} diff --git a/atable/env.d.ts b/atable/env.d.ts deleted file mode 100644 index cbd6e237..00000000 --- a/atable/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/atable/package.json b/atable/package.json index a94c1b1d..bea0d3b3 100644 --- a/atable/package.json +++ b/atable/package.json @@ -17,28 +17,26 @@ }, "exports": { ".": { - "import": "./dist/atable.js", + "import": { + "types": "./dist/atable/src/index.d.ts", + "default": "./dist/atable.js" + }, "require": "./dist/atable.umd.cjs" }, "./styles": "./dist/style.css" }, - "main": "dist/atable.js", - "module": "dist/atable.js", - "umd": "dist/atable.umd.cjs", - "types": "src/index", + "typings": "./dist/atable/src/index.d.ts", "files": [ "dist/*", "src/*" ], "scripts": { - "prepublish": "tsc -b && vite build", - "build": "tsc -b && vite build", + "prepublish": "heft build && vite build && rushx docs", + "build": "heft build && vite build && rushx docs", "dev": "vite", + "docs": "api-documenter markdown -i temp -o ../docs/atable", "lint": "eslint . --ext .ts,.vue", "preview": "vite preview", - "story:build": "histoire build", - "story:dev": "histoire dev", - "story:preview": "histoire preview", "test": "vitest", "test:coverage": "vitest run --coverage", "test:ui": "vitest --ui" @@ -46,34 +44,31 @@ "dependencies": { "@stonecrop/themes": "workspace:*", "@stonecrop/utilities": "workspace:*", - "uuid": "^9.0.0", - "vue": "^3.4.23" + "@vueuse/components": "^10.11.0", + "@vueuse/core": "^10.11.0", + "uuid": "^10.0.0", + "vue": "^3.4.31" }, "devDependencies": { - "@histoire/plugin-vue": "^0.17.17", - "@stonecrop/aform": "workspace:*", - "@types/uuid": "^9.0.0", - "@typescript-eslint/eslint-plugin": "^7.6.0", - "@typescript-eslint/parser": "^7.6.0", - "@vitejs/plugin-vue": "^5.0.4", + "@microsoft/api-documenter": "^7.25.3", + "@rushstack/heft": "^0.66.18", + "@types/uuid": "^10.0.0", + "@typescript-eslint/eslint-plugin": "^7.14.1", + "@typescript-eslint/parser": "^7.14.1", + "@vitejs/plugin-vue": "^5.0.5", "@vitest/coverage-istanbul": "^1.6.0", "@vitest/ui": "^1.6.0", "@vue/test-utils": "^2.4.6", - "@vueuse/components": "^10.9.0", - "@vueuse/core": "^10.9.0", - "cypress": "^12.11.0", + "cypress": "^13.11.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-vue": "^9.11.1", "eslint": "^8.40.0", - "histoire": "^0.17.17", "jsdom": "^24.0.0", - "typescript": "^5.4.5", - "vite": "^5.2.9", + "stonecrop-rig": "workspace:*", + "typescript": "^5.5.2", + "vite": "^5.3.2", "vitest": "^1.6.0", - "vue-router": "^4" - }, - "peerDependencies": { - "@stonecrop/aform": "workspace:*" + "vue-router": "^4.4.0" }, "publishConfig": { "access": "public" diff --git a/atable/src/components/ACell.vue b/atable/src/components/ACell.vue index 33359290..71895b82 100644 --- a/atable/src/components/ACell.vue +++ b/atable/src/components/ACell.vue @@ -69,7 +69,7 @@ const displayValue = computed(() => { } }) -const handleInput = (event: MouseEvent) => { +const handleInput = () => { if (tableData.columns[props.colIndex].mask) { // TODO: add masking to cell values // tableData.columns[props.colIndex].mask(event) diff --git a/atable/src/components/AExpansionRow.vue b/atable/src/components/AExpansionRow.vue index 3bd648b9..7b014fa8 100644 --- a/atable/src/components/AExpansionRow.vue +++ b/atable/src/components/AExpansionRow.vue @@ -17,7 +17,7 @@ import { type KeypressHandlers, useKeyboardNav } from '@stonecrop/utilities' import { computed, inject, ref } from 'vue' import TableDataStore from '.' -import type { TableRow } from 'types' +import type { TableRow } from '@/types' const props = withDefaults( defineProps<{ diff --git a/atable/src/components/ARow.vue b/atable/src/components/ARow.vue index 37fc8106..7c087f7c 100644 --- a/atable/src/components/ARow.vue +++ b/atable/src/components/ARow.vue @@ -20,11 +20,11 @@ diff --git a/beam/src/components/ItemCheck.vue b/beam/src/components/ItemCheck.vue index 87cf0235..3ddb02f9 100644 --- a/beam/src/components/ItemCheck.vue +++ b/beam/src/components/ItemCheck.vue @@ -17,7 +17,7 @@ const emit = defineEmits(['input']) const checked = ref(props.value) -const handleInput = (e: InputEvent) => { +const handleInput = () => { emit('input', checked.value) } diff --git a/beam/src/components/ItemCount.vue b/beam/src/components/ItemCount.vue index da33c828..110bcb56 100644 --- a/beam/src/components/ItemCount.vue +++ b/beam/src/components/ItemCount.vue @@ -31,7 +31,7 @@ const count = ref(props.value) const handleInput = (event: InputEvent | MouseEvent) => { event.preventDefault() event.stopPropagation() - count.value = Number(event.target.innerHTML.replace(/[^0-9]/g, '')) + count.value = Number((event.target as HTMLElement).innerHTML.replace(/[^0-9]/g, '')) emit('input', count.value) } diff --git a/beam/src/components/ListItem.vue b/beam/src/components/ListItem.vue index 163d54d7..79f074a0 100644 --- a/beam/src/components/ListItem.vue +++ b/beam/src/components/ListItem.vue @@ -7,19 +7,21 @@ - + diff --git a/beam/src/components/ListView.vue b/beam/src/components/ListView.vue index 62c6a7a8..d2e78011 100644 --- a/beam/src/components/ListView.vue +++ b/beam/src/components/ListView.vue @@ -16,7 +16,7 @@ diff --git a/desktop/src/components/Doctype.vue b/desktop/src/components/Doctype.vue index 1517cf35..2b9691e8 100644 --- a/desktop/src/components/Doctype.vue +++ b/desktop/src/components/Doctype.vue @@ -4,11 +4,11 @@ diff --git a/aform/stories/dropdown.story.vue b/examples/aform/dropdown.story.vue similarity index 94% rename from aform/stories/dropdown.story.vue rename to examples/aform/dropdown.story.vue index 48f7ddb9..abb59453 100644 --- a/aform/stories/dropdown.story.vue +++ b/examples/aform/dropdown.story.vue @@ -19,8 +19,6 @@ diff --git a/beam/src/histoire.setup.ts b/examples/beam/histoire.setup.ts similarity index 51% rename from beam/src/histoire.setup.ts rename to examples/beam/histoire.setup.ts index 9e2783ca..84a21c72 100644 --- a/beam/src/histoire.setup.ts +++ b/examples/beam/histoire.setup.ts @@ -1,16 +1,17 @@ import { defineSetupVue3 } from '@histoire/plugin-vue' - -import ActionFooter from '@/components/ActionFooter.vue' -import BeamModal from '@/components/BeamModal.vue' -import BeamModalOutlet from '@/components/BeamModalOutlet.vue' -import Confirm from '@/components/Confirm.vue' -import ItemCheck from '@/components/ItemCheck.vue' -import ItemCount from '@/components/ItemCount.vue' -import ListAnchor from '@/components/ListAnchor.vue' -import ListItem from '@/components/ListItem.vue' -import ListView from '@/components/ListView.vue' -import Navbar from '@/components/Navbar.vue' -import ScanInput from '@/components/ScanInput.vue' +import { + ActionFooter, + BeamModal, + BeamModalOutlet, + Confirm, + ItemCheck, + ItemCount, + ListAnchor, + ListItem, + ListView, + Navbar, + ScanInput, +} from '@stonecrop/beam' import PortalVue from 'portal-vue' export const setupVue3 = defineSetupVue3(({ app }) => { diff --git a/examples/beam/vite.config.ts b/examples/beam/vite.config.ts new file mode 100644 index 00000000..d54a2e11 --- /dev/null +++ b/examples/beam/vite.config.ts @@ -0,0 +1,22 @@ +/// + +import { HstVue } from '@histoire/plugin-vue' +import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' +import { defineConfig } from 'vite' + +const projectRootDir = resolve(__dirname) + +export default defineConfig({ + plugins: [vue()], + resolve: { + alias: { + '@': resolve(projectRootDir, 'beam'), + }, + }, + histoire: { + plugins: [HstVue()], + setupFile: 'histoire.setup.ts', + storyIgnored: ['**/node_modules/**', '**/dist/**'], + }, +}) diff --git a/code_editor/stories/default.story.vue b/examples/code_editor/default.story.vue similarity index 90% rename from code_editor/stories/default.story.vue rename to examples/code_editor/default.story.vue index afc2d537..be2e8c23 100644 --- a/code_editor/stories/default.story.vue +++ b/examples/code_editor/default.story.vue @@ -1,14 +1,13 @@ + diff --git a/node_editor/src/histoire.setup.ts b/node_editor/src/histoire.setup.ts deleted file mode 100644 index 746b5ceb..00000000 --- a/node_editor/src/histoire.setup.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineSetupVue3 } from '@histoire/plugin-vue' -//import { BaklavaVuePlugin } from '@baklavajs/plugin-renderer-vue3' - -export const setupVue3 = defineSetupVue3(({ app }) => { - // TODO: (typing) add typing for ADate - //app.use(BaklavaVuePlugin) -}) diff --git a/node_editor/src/index.ts b/node_editor/src/index.ts index 6d886570..b63d506a 100644 --- a/node_editor/src/index.ts +++ b/node_editor/src/index.ts @@ -2,8 +2,14 @@ import { App } from 'vue' import NodeEditor from '@/components/NodeEditor.vue' import StateEditor from '@/components/StateEditor.vue' +export type { EditorStates, FlowElement, FlowElements, Layout } from '@/types' -function install(app: App /* options */) { +/** + * Install all Node Editor components + * @param app - Vue app instance + * @public + */ +function install(app: App) { app.component('NodeEditor', NodeEditor) app.component('StateEditor', StateEditor) } diff --git a/node_editor/src/shims-vue.d.ts b/node_editor/src/shims-vue.d.ts new file mode 100644 index 00000000..87e133ff --- /dev/null +++ b/node_editor/src/shims-vue.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import { ComponentOptions } from 'vue' + const Component: ComponentOptions + export default Component +} diff --git a/node_editor/src/types/index.ts b/node_editor/src/types/index.ts new file mode 100644 index 00000000..e1a1958e --- /dev/null +++ b/node_editor/src/types/index.ts @@ -0,0 +1,24 @@ +import { type Elements, type Element, type XYPosition, Position } from '@vue-flow/core' +import type { AnyStateMachine, AnyStateNodeDefinition, StatesConfig } from 'xstate' + +export type EditorStates = { + [key: string]: Partial | StatesConfig +} + +export type FlowElements = Elements< + { hasInput?: boolean; hasOutput?: boolean }, + { hasInput?: boolean; hasOutput?: boolean } +> + +export type FlowElement = Element< + { hasInput?: boolean; hasOutput?: boolean }, + { hasInput?: boolean; hasOutput?: boolean } +> + +export type Layout = { + [key: string]: { + position?: XYPosition + targetPosition?: Position + sourcePosition?: Position + } +} diff --git a/node_editor/tsconfig.json b/node_editor/tsconfig.json index e39b6886..acea64e0 100644 --- a/node_editor/tsconfig.json +++ b/node_editor/tsconfig.json @@ -1,17 +1,11 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "target": "es2017", - "module": "esnext", - "lib": ["esnext"], - "moduleResolution": "node", - "esModuleInterop": true, - "resolveJsonModule": true, - "jsx": "preserve", - "baseUrl": ".", + "tsBuildInfoFile": "./dist/node_editor.tsbuildinfo", "paths": { - "@/*": ["src/*"] + "@/*": ["./src/*"], + "types/*": ["./src/types/*"] } }, - "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], - "exclude": ["node_modules"] + "include": ["src/**/*", "src/**/*.ts", "src/**/*.vue", "tests/**/*.spec.ts", "tests/**/*.ts", "tests/**/*.vue"] } diff --git a/node_editor/vite.config.ts b/node_editor/vite.config.ts index e7105a68..de7c2b0b 100644 --- a/node_editor/vite.config.ts +++ b/node_editor/vite.config.ts @@ -1,6 +1,3 @@ -/// - -import { HstVue } from '@histoire/plugin-vue' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' import { defineConfig } from 'vite' @@ -15,6 +12,7 @@ export default defineConfig({ }, }, build: { + emptyOutDir: false, sourcemap: true, lib: { entry: resolve(projectRootDir, 'src/index.ts'), @@ -29,9 +27,4 @@ export default defineConfig({ }, }, }, - histoire: { - plugins: [HstVue()], - storyIgnored: ['**/node_modules/**', '**/dist/**'], - }, - optimizeDeps: {}, }) diff --git a/rigs/stonecrop-rig/package.json b/rigs/stonecrop-rig/package.json new file mode 100644 index 00000000..b8d03eba --- /dev/null +++ b/rigs/stonecrop-rig/package.json @@ -0,0 +1,21 @@ +{ + "name": "stonecrop-rig", + "version": "0.2.22", + "description": "Rig setup for Stonecrop monorepo", + "license": "MIT", + "private": "true", + "scripts": { + "build": "", + "_phase:build": "" + }, + "dependencies": { + "@microsoft/api-extractor": "^7.47.0", + "@rushstack/heft": "^0.66.18", + "@rushstack/heft-api-extractor-plugin": "^0.3.38", + "@rushstack/heft-typescript-plugin": "^0.5.16", + "typescript": "^5.5.2" + }, + "engines": { + "node": ">=20.11.0" + } +} diff --git a/rigs/stonecrop-rig/profiles/default/config/api-extractor-task.json b/rigs/stonecrop-rig/profiles/default/config/api-extractor-task.json new file mode 100644 index 00000000..56721e9b --- /dev/null +++ b/rigs/stonecrop-rig/profiles/default/config/api-extractor-task.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/api-extractor-task.schema.json", + "useProjectTypescriptVersion": true +} diff --git a/rigs/stonecrop-rig/profiles/default/config/heft.json b/rigs/stonecrop-rig/profiles/default/config/heft.json new file mode 100644 index 00000000..86263a8f --- /dev/null +++ b/rigs/stonecrop-rig/profiles/default/config/heft.json @@ -0,0 +1,29 @@ +/** + * Defines configuration used by core Heft. + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json", + + "phasesByName": { + "build": { + "phaseDescription": "This phase compiles the project source code.", + + "cleanFiles": [{ "sourcePath": "dist" }], + + "tasksByName": { + "typescript": { + "taskPlugin": { + "pluginPackage": "@rushstack/heft-typescript-plugin" + } + }, + + "api-extractor": { + "taskDependencies": ["typescript"], + "taskPlugin": { + "pluginPackage": "@rushstack/heft-api-extractor-plugin" + } + } + } + } + } +} diff --git a/rigs/stonecrop-rig/profiles/default/config/typescript.json b/rigs/stonecrop-rig/profiles/default/config/typescript.json new file mode 100644 index 00000000..310335cc --- /dev/null +++ b/rigs/stonecrop-rig/profiles/default/config/typescript.json @@ -0,0 +1,93 @@ +/** + * Configures the TypeScript plugin for Heft. This plugin also manages linting. + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for standard + * settings to be shared across multiple projects. + */ + // "extends": "base-project/config/typescript.json", + + /** + * If provided, emit these module kinds in addition to the modules specified in the tsconfig. + * Note that this option only applies to the main tsconfig.json configuration. + */ + "additionalModuleKindsToEmit": [ + // { + // /** + // * (Required) Must be one of "commonjs", "amd", "umd", "system", "es2015", "esnext" + // */ + // "moduleKind": "amd", + // + // /** + // * (Required) The name of the folder where the output will be written. + // */ + // "outFolderName": "lib-amd" + // } + ], + + /** + * If true, emit CommonJS module output to the folder specified in the tsconfig "outDir" compiler option with the .cjs extension alongside (or instead of, if TSConfig specifies CommonJS) the default compilation output. + */ + // "emitCjsExtensionForCommonJS": true, + + /** + * If true, emit ESNext module output to the folder specified in the tsconfig "outDir" compiler option with the .mjs extension alongside (or instead of, if TSConfig specifies ESNext) the default compilation output. + */ + // "emitMjsExtensionForESModule": true, + + /** + * If true and "isolatedModules" is configured in tsconfig.json, use a worker thread to run transpilation concurrently with type checking and declaration emit. + */ + "useTranspilerWorker": true, + + /** + * Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example + * so that these files can be resolved by import statements. + */ + "staticAssetsToCopy": { + /** + * File extensions that should be copied from the src folder to the destination folder(s). + */ + "fileExtensions": [ + ".aac", + ".css", + ".eot", + ".gif", + ".jpeg", + ".jpg", + ".json", + ".m4a", + ".mp3", + ".mp4", + ".oga", + ".otf", + ".png", + ".scss", + ".svg", + ".ttf", + ".wav", + ".webm", + ".webp", + ".woff", + ".woff2" + ] + + /** + * Glob patterns that should be explicitly included. + */ + // "includeGlobs": [ + // "some/path/*.js" + // ], + + /** + * Glob patterns that should be explicitly excluded. This takes precedence over globs listed + * in "includeGlobs" and files that match the file extensions provided in "fileExtensions". + */ + // "excludeGlobs": [ + // "some/path/*.css" + // ] + } +} diff --git a/rush.json b/rush.json index a3da9b75..809bfdbe 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ { "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", - "rushVersion": "5.120.3", - "pnpmVersion": "8.15.7", + "rushVersion": "5.129.6", + "pnpmVersion": "8.15.8", "approvedPackagesPolicy": { "reviewCategories": ["production", "tool", "prototype", "documentation", "utilities"], "ignoredNpmScopes": ["@types"] @@ -18,7 +18,6 @@ "preRushBuild": [], "postRushBuild": [] }, - "ensureConsistentVersions": true, "hotfixChangeEnabled": false, "telemetryEnabled": false, "projects": [ @@ -26,16 +25,12 @@ "packageName": "@stonecrop/aform", "projectFolder": "aform", "reviewCategory": "prototype", - // to avoid circular dependency problems - "decoupledLocalDependencies": ["@stonecrop/atable"], "versionPolicyName": "stonecrop" }, { "packageName": "@stonecrop/atable", "projectFolder": "atable", "reviewCategory": "prototype", - // to avoid circular dependency problems - "decoupledLocalDependencies": ["@stonecrop/aform"], "versionPolicyName": "stonecrop" }, { @@ -91,6 +86,12 @@ "projectFolder": "utilities", "reviewCategory": "utilities", "versionPolicyName": "stonecrop" + }, + { + "packageName": "stonecrop-rig", + "projectFolder": "rigs/stonecrop-rig", + "reviewCategory": "utilities", + "shouldPublish": false } ] } diff --git a/stonecrop/.eslintignore b/stonecrop/.eslintignore index 7faa7cb6..a1ac6083 100644 --- a/stonecrop/.eslintignore +++ b/stonecrop/.eslintignore @@ -1,3 +1,4 @@ dist node_modules +*.typegen.ts .eslintrc.cjs diff --git a/stonecrop/.npmignore b/stonecrop/.npmignore index 0c5b1f0c..6a35f587 100644 --- a/stonecrop/.npmignore +++ b/stonecrop/.npmignore @@ -9,6 +9,7 @@ !/src-*/** !/dist/** !ThirdPartyNotice.txt +!tsdoc-metadata.json # Ignore certain patterns that should not get published. /dist/*.stats.* diff --git a/stonecrop/config/api-extractor.json b/stonecrop/config/api-extractor.json new file mode 100644 index 00000000..16be2037 --- /dev/null +++ b/stonecrop/config/api-extractor.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../common/config/api-extractor-base.json", + + "docModel": { + "enabled": true, + "projectFolderUrl": "https://github.com/agritheory/stonecrop/tree/development/stonecrop" + }, + + "messages": { + "extractorMessageReporting": { + // Disable this validation at your own risk: Processing an incorrect file type + // may lead to other errors. Function bodies may incorrectly get emitted in the + // .d.ts rollup. + "ae-wrong-input-file-type": { + "logLevel": "none" + } + } + } +} diff --git a/stonecrop/config/rig.json b/stonecrop/config/rig.json new file mode 100644 index 00000000..4c3bb418 --- /dev/null +++ b/stonecrop/config/rig.json @@ -0,0 +1,6 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "stonecrop-rig" +} diff --git a/stonecrop/package.json b/stonecrop/package.json index 7f6890cd..69f813a6 100644 --- a/stonecrop/package.json +++ b/stonecrop/package.json @@ -18,22 +18,22 @@ }, "exports": { ".": { - "import": "./dist/stonecrop.js", + "import": { + "types": "./dist/stonecrop/src/index.d.ts", + "default": "./dist/stonecrop.js" + }, "require": "./dist/stonecrop.umd.cjs" } }, - "main": "dist/stonecrop.js", - "module": "dist/stonecrop.js", - "umd": "dist/stonecrop.umd.cjs", - "types": "src/index", + "types": "./dist/stonecrop/src/index.d.ts", "files": [ "dist/*", "src/*" ], "scripts": { - "prepublish": "vite build", - "build": "vite build", - "dev": "vite serve stories/ -c vite.config.ts", + "prepublish": "heft build && vite build && rushx docs", + "build": "heft build && vite build && rushx docs", + "docs": "api-documenter markdown -i temp -o ../docs/stonecrop", "lint": "eslint . --ext .ts,.vue", "preview": "vite preview" }, @@ -43,21 +43,24 @@ "pinia-shared-state": "^0.3.0", "pinia-undo": "^0.1.9", "pinia-xstate": "^1.0.9", - "vue": "^3.4.23", - "vue-router": "^4", - "xstate": "~4.37.2" + "vue": "^3.4.31", + "vue-router": "^4.4.0", + "xstate": "^4.38.3" }, "devDependencies": { + "@microsoft/api-documenter": "^7.25.3", + "@rushstack/heft": "^0.66.18", "@stonecrop/aform": "workspace:*", "@stonecrop/atable": "workspace:*", - "@typescript-eslint/eslint-plugin": "^7.6.0", - "@typescript-eslint/parser": "^7.6.0", - "@vitejs/plugin-vue": "^5.0.4", + "@typescript-eslint/eslint-plugin": "^7.14.1", + "@typescript-eslint/parser": "^7.14.1", + "@vitejs/plugin-vue": "^5.0.5", "eslint": "^8.40.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-vue": "^9.11.1", - "typescript": "^5.4.5", - "vite": "^5.2.9" + "stonecrop-rig": "workspace:*", + "typescript": "^5.5.2", + "vite": "^5.3.2" }, "publishConfig": { "access": "public" diff --git a/stonecrop/src/composable.ts b/stonecrop/src/composable.ts index c8623dd4..ac192ac7 100644 --- a/stonecrop/src/composable.ts +++ b/stonecrop/src/composable.ts @@ -1,8 +1,8 @@ import { inject, onBeforeMount, Ref, ref } from 'vue' -import Registry from './registry' -import { Stonecrop } from './stonecrop' -import { useDataStore } from './stores/data' +import Registry from '@/registry' +import { Stonecrop } from '@/stonecrop' +import { useDataStore } from '@/stores/data' type StonecropReturn = { stonecrop: Ref @@ -45,5 +45,6 @@ export function useStonecrop(registry?: Registry): StonecropReturn { isReady.value = true }) + // @ts-expect-error TODO: fix the type mismatch return { stonecrop, isReady } } diff --git a/stonecrop/src/doctype.ts b/stonecrop/src/doctype.ts index b3710c3b..b99f61c3 100644 --- a/stonecrop/src/doctype.ts +++ b/stonecrop/src/doctype.ts @@ -1,6 +1,6 @@ import { Component } from 'vue' -import type { ImmutableDoctype } from 'types/index' +import type { ImmutableDoctype } from '@/types' export default class DoctypeMeta { readonly doctype: string diff --git a/stonecrop/src/exceptions.ts b/stonecrop/src/exceptions.ts index e7a107ae..e3282155 100644 --- a/stonecrop/src/exceptions.ts +++ b/stonecrop/src/exceptions.ts @@ -1,3 +1,13 @@ +/** + * NotImplementedError + * @param message {string} - The error message + * @class + * @description This error is thrown when a method has not been implemented + * @example + * throw new NotImplementedError('Method not implemented') + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error} + * @public + */ export function NotImplementedError(message: string) { this.message = message || '' } diff --git a/stonecrop/src/index.ts b/stonecrop/src/index.ts index 4355d311..7b7d56e4 100644 --- a/stonecrop/src/index.ts +++ b/stonecrop/src/index.ts @@ -1,6 +1,7 @@ -import { useStonecrop } from './composable' -import DoctypeMeta from './doctype' -import Registry from './registry' -import Stonecrop from './plugins' +import { useStonecrop } from '@/composable' +import DoctypeMeta from '@/doctype' +import Registry from '@/registry' +import Stonecrop from '@/plugins' +export type { ImmutableDoctype, MutableDoctype, Schema, InstallOptions } from '@/types' export { DoctypeMeta, Registry, Stonecrop, useStonecrop } diff --git a/stonecrop/src/plugins/index.ts b/stonecrop/src/plugins/index.ts index 94169d80..fe7200e0 100644 --- a/stonecrop/src/plugins/index.ts +++ b/stonecrop/src/plugins/index.ts @@ -1,11 +1,11 @@ -import { App } from 'vue' +import { App, type Plugin } from 'vue' -import type { InstallOptions } from 'types/index' -import Registry from '../registry' -import router from '../router' -import { pinia } from '../stores' +import Registry from '@/registry' +import router from '@/router' +import { pinia } from '@/stores' +import type { InstallOptions } from '@/types' -export default { +const plugin: Plugin = { install: (app: App, options?: InstallOptions) => { const appRouter = options?.router || router const registry = new Registry(appRouter, options?.getMeta) @@ -21,3 +21,5 @@ export default { } }, } + +export default plugin diff --git a/stonecrop/src/stonecrop.ts b/stonecrop/src/stonecrop.ts index b385daac..dd1986f5 100644 --- a/stonecrop/src/stonecrop.ts +++ b/stonecrop/src/stonecrop.ts @@ -1,8 +1,8 @@ -import type { ImmutableDoctype, Schema } from 'types/index' -import DoctypeMeta from './doctype' -import { NotImplementedError } from './exceptions' -import Registry from './registry' -import { useDataStore } from './stores/data' +import DoctypeMeta from '@/doctype' +import { NotImplementedError } from '@/exceptions' +import Registry from '@/registry' +import { useDataStore } from '@/stores/data' +import type { ImmutableDoctype, Schema } from '@/types' export class Stonecrop { /** @@ -117,7 +117,7 @@ export class Stonecrop { * stonecrop.setup(doctype) */ setup(doctype: DoctypeMeta): void { - this.getMeta(doctype) + void this.getMeta(doctype) this.getWorkflow(doctype) this.getActions(doctype) } diff --git a/stonecrop/src/stores/index.ts b/stonecrop/src/stores/index.ts index 3842c494..1bd57b6b 100644 --- a/stonecrop/src/stores/index.ts +++ b/stonecrop/src/stores/index.ts @@ -1,6 +1,6 @@ import { createPinia } from 'pinia' import { PiniaSharedState } from 'pinia-shared-state' -import { PiniaUndo } from 'pinia-undo' +// import { PiniaUndo } from 'pinia-undo' const pinia = createPinia() diff --git a/stonecrop/src/stores/xstate.ts b/stonecrop/src/stores/xstate.ts index 0f31ef07..493a298a 100644 --- a/stonecrop/src/stores/xstate.ts +++ b/stonecrop/src/stores/xstate.ts @@ -9,7 +9,6 @@ export const counterMachine = createMachine( context: { count: 0, }, - tsTypes: {} as import('./xstate.typegen').Typegen0, states: { active: { on: { diff --git a/stonecrop/types/index.ts b/stonecrop/src/types/index.ts similarity index 84% rename from stonecrop/types/index.ts rename to stonecrop/src/types/index.ts index ba4de349..a26015a9 100644 --- a/stonecrop/types/index.ts +++ b/stonecrop/src/types/index.ts @@ -3,27 +3,27 @@ import { Component } from 'vue' import { Router } from 'vue-router' import { MachineConfig, StateMachine } from 'xstate' -import type { SchemaTypes } from '@stonecrop/aform/types' +import AForm from '@stonecrop/aform' import DoctypeMeta from '@/doctype' export type ImmutableDoctype = Readonly<{ // TODO: allow schema to be a function - schema?: List + schema?: List workflow: StateMachine actions?: Map }> export type MutableDoctype = { // TODO: allow schema to be a function - schema?: SchemaTypes[] + schema?: AForm.SchemaTypes[] workflow: MachineConfig actions?: Record } export type Schema = { doctype: string - schema: List + schema: List } export type InstallOptions = { diff --git a/stonecrop/tsconfig.json b/stonecrop/tsconfig.json index a011acd7..19c07f9f 100644 --- a/stonecrop/tsconfig.json +++ b/stonecrop/tsconfig.json @@ -1,25 +1,11 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "composite": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "baseUrl": ".", + "tsBuildInfoFile": "./dist/stonecrop.tsbuildinfo", "paths": { - "@/*": ["src/*"], - "types/*": ["types/*"] + "@/*": ["./src/*"], + "types/*": ["./src/types/*"] } }, - "include": [ - "env.d.ts", - "src/**/*", - "src/**/*.ts", - "src/**/*.vue", - "stories/**/*.ts", - "stories/**/*.vue", - "tests/**/*.ts", - "tests/**/*.vue", - "types/**/*.ts" - ] + "include": ["env.d.ts", "src/**/*", "src/**/*.ts", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.vue"] } diff --git a/stonecrop/vite.config.ts b/stonecrop/vite.config.ts index c41e442e..a909d731 100644 --- a/stonecrop/vite.config.ts +++ b/stonecrop/vite.config.ts @@ -1,6 +1,6 @@ +import vue from '@vitejs/plugin-vue' import { resolve } from 'path' import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' const projectRootDir = resolve(__dirname) @@ -10,10 +10,12 @@ export default defineConfig({ resolve: { alias: { '@': resolve(projectRootDir, 'src'), + types: resolve(projectRootDir, 'src/types'), }, }, build: { - minify: false, + emptyOutDir: false, + sourcemap: true, lib: { entry: resolve(projectRootDir, 'src/index.ts'), name: '@stonecrop/stonecrop', diff --git a/themes/default/_form.css b/themes/default/_form.css index 69737fc3..0e8840b5 100644 --- a/themes/default/_form.css +++ b/themes/default/_form.css @@ -21,7 +21,7 @@ Holds styles for all form fields .aform__form-element { min-width: 30%; - flex-basis:32%; + flex-basis: 32%; /* flex-grow:1; */ border: 1px solid transparent; padding: 0; diff --git a/themes/default/_login.css b/themes/default/_login.css index fd1b1017..23f158e2 100644 --- a/themes/default/_login.css +++ b/themes/default/_login.css @@ -45,7 +45,7 @@ } .login-form-element { - display: grid; + display: grid; margin: 0.5rem 0; } .login-field { @@ -66,7 +66,7 @@ margin: 0.5rem 0; padding: 0.25rem; position: relative; - cursor:pointer; + cursor: pointer; &:hover { background-color: var(--btn-hover); diff --git a/themes/default/default.css b/themes/default/default.css index b153800a..f4f764b7 100644 --- a/themes/default/default.css +++ b/themes/default/default.css @@ -3,5 +3,3 @@ @import url('./_form.css'); @import url('./_table.css'); @import url('./_login.css'); - - diff --git a/themes/package.json b/themes/package.json index 07f62f13..edcb9055 100644 --- a/themes/package.json +++ b/themes/package.json @@ -21,9 +21,9 @@ "preview": "vite preview" }, "devDependencies": { - "@vitejs/plugin-vue": "^5.0.4", - "vite": "^5.2.9", - "vue": "^3.4.23" + "@vitejs/plugin-vue": "^5.0.5", + "vite": "^5.3.2", + "vue": "^3.4.31" }, "publishConfig": { "access": "public" diff --git a/tsconfig.json b/tsconfig.json index da7bb142..952be02d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,23 +1,16 @@ { - "compilerOptions": { - "rootDir": ".", - "target": "es2017", - "module": "esnext", - "lib": ["dom", "dom.iterable", "esnext"], - "moduleResolution": "node", - "esModuleInterop": true, - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "jsx": "preserve" - }, - "exclude": ["node_modules", "**/*.spec.ts"], + // https://www.typescriptlang.org/docs/handbook/project-references.html#overall-structure + "extends": "./tsconfig.options.json", + "files": [], "references": [ { "path": "./aform" }, { "path": "./atable" }, + { "path": "./beam" }, + { "path": "./code_editor" }, { "path": "./desktop" }, { "path": "./examples" }, { "path": "./graphql_client" }, + { "path": "./node_editor" }, { "path": "./stonecrop" }, { "path": "./utilities" } ] diff --git a/tsconfig.options.json b/tsconfig.options.json new file mode 100644 index 00000000..4186ec92 --- /dev/null +++ b/tsconfig.options.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "preserve", + "lib": ["dom", "dom.iterable", "esnext"], + "outDir": "${configDir}/dist", + "composite": true, + "declaration": true, + "declarationMap": true, + "disableReferencedProjectLoad": true, + "emitDeclarationOnly": true, + "isolatedModules": true, + "skipLibCheck": true + }, + "exclude": ["node_modules", "**/*.spec.ts"] +} diff --git a/utilities/.npmignore b/utilities/.npmignore index 0c5b1f0c..6a35f587 100644 --- a/utilities/.npmignore +++ b/utilities/.npmignore @@ -9,6 +9,7 @@ !/src-*/** !/dist/** !ThirdPartyNotice.txt +!tsdoc-metadata.json # Ignore certain patterns that should not get published. /dist/*.stats.* diff --git a/utilities/config/api-extractor.json b/utilities/config/api-extractor.json new file mode 100644 index 00000000..9ec40303 --- /dev/null +++ b/utilities/config/api-extractor.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "extends": "../../common/config/api-extractor-base.json", + + "docModel": { + "enabled": true, + "projectFolderUrl": "https://github.com/agritheory/stonecrop/tree/development/utilities" + }, + + "messages": { + "extractorMessageReporting": { + // Disable this validation at your own risk: Processing an incorrect file type + // may lead to other errors. Function bodies may incorrectly get emitted in the + // .d.ts rollup. + "ae-wrong-input-file-type": { + "logLevel": "none" + } + } + } +} diff --git a/utilities/config/rig.json b/utilities/config/rig.json new file mode 100644 index 00000000..4c3bb418 --- /dev/null +++ b/utilities/config/rig.json @@ -0,0 +1,6 @@ +// The "rig.json" file directs tools to look for their config files in an external package. +// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package +{ + "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", + "rigPackageName": "stonecrop-rig" +} diff --git a/utilities/env.d.ts b/utilities/env.d.ts deleted file mode 100644 index cbd6e237..00000000 --- a/utilities/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/utilities/package.json b/utilities/package.json index 62269205..bdc9680d 100644 --- a/utilities/package.json +++ b/utilities/package.json @@ -17,45 +17,44 @@ }, "exports": { ".": { - "import": "./dist/utilities.js", + "import": { + "types": "./dist/utilities/src/index.d.ts", + "default": "./dist/utilities.js" + }, "require": "./dist/utilities.umd.cjs" } }, - "main": "dist/utilities.js", - "module": "dist/utilities.js", - "umd": "dist/utilities.umd.cjs", - "types": "src/index", + "typings": "./dist/utilities/src/index.d.ts", "files": [ "dist/*", "src/*" ], "scripts": { - "prepublish": "tsc -b && vite build", - "build": "tsc -b && vite build", + "prepublish": "heft build && vite build && rushx docs", + "build": "heft build && vite build && rushx docs", "dev": "vite", + "docs": "api-documenter markdown -i temp -o ../docs/utilities", "lint": "eslint . --ext .ts,.vue", - "preview": "vite preview", - "story:build": "histoire build", - "story:dev": "histoire dev", - "story:preview": "histoire preview" + "preview": "vite preview" }, "dependencies": { - "vue": "^3.4.23" + "@vueuse/core": "^10.11.0", + "vue": "^3.4.31" }, "devDependencies": { - "@histoire/plugin-vue": "^0.17.17", - "@typescript-eslint/eslint-plugin": "^7.6.0", - "@typescript-eslint/parser": "^7.6.0", - "@vitejs/plugin-vue": "^5.0.4", - "@vueuse/core": "^10.9.0", - "cypress": "^12.11.0", + "@microsoft/api-documenter": "^7.25.3", + "@rushstack/heft": "^0.66.18", + "@typescript-eslint/eslint-plugin": "^7.14.1", + "@typescript-eslint/parser": "^7.14.1", + "@vitejs/plugin-vue": "^5.0.5", + "cypress": "^13.11.0", "eslint": "^8.40.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-vue": "^9.11.1", - "histoire": "^0.17.17", - "typescript": "^5.4.5", - "vite": "^5.2.9", - "vue-router": "^4" + "stonecrop-rig": "workspace:*", + "typescript": "^5.5.2", + "vite": "^5.3.2", + "vue-router": "^4.4.0" }, "publishConfig": { "access": "public" diff --git a/utilities/src/composables/keyboard.ts b/utilities/src/composables/keyboard.ts index 514f0305..c73af707 100644 --- a/utilities/src/composables/keyboard.ts +++ b/utilities/src/composables/keyboard.ts @@ -1,8 +1,8 @@ import { type WatchStopHandle, onBeforeUnmount, onMounted, ref, watch } from 'vue' import { useFocusWithin } from '@vueuse/core' -import type { KeyboardNavigationOptions, KeypressHandlers } from 'types' import { useElementVisibility } from '@/composables/visibility' +import type { KeyboardNavigationOptions, KeypressHandlers } from '@/types' // helper functions const isVisible = (element: HTMLElement) => { diff --git a/utilities/src/index.ts b/utilities/src/index.ts index edd4880b..65e89810 100644 --- a/utilities/src/index.ts +++ b/utilities/src/index.ts @@ -1,8 +1,13 @@ import { App } from 'vue' -import { defaultKeypressHandlers, useKeyboardNav } from './composables/keyboard' -import type { KeypressHandlers } from '../types' +import { defaultKeypressHandlers, useKeyboardNav } from '@/composables/keyboard' +export type { KeypressHandlers, KeyboardNavigationOptions } from '@/types' +/** + * Install all utility components + * @param app - Vue app instance + * @public + */ function install(app: App /* options */) {} -export { KeypressHandlers, defaultKeypressHandlers, install, useKeyboardNav } +export { defaultKeypressHandlers, install, useKeyboardNav } diff --git a/utilities/types/index.ts b/utilities/src/types/index.ts similarity index 100% rename from utilities/types/index.ts rename to utilities/src/types/index.ts diff --git a/utilities/tsconfig.json b/utilities/tsconfig.json index dca84790..94654202 100644 --- a/utilities/tsconfig.json +++ b/utilities/tsconfig.json @@ -1,15 +1,11 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "composite": true, - "declarationMap": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "baseUrl": ".", + "tsBuildInfoFile": "./dist/utilities.tsbuildinfo", "paths": { - "@/*": ["src/*"], - "types/*": ["types/*"] + "@/*": ["./src/*"], + "types/*": ["./src/types/*"] } }, - "include": ["env.d.ts", "src/**/*", "src/**/*.ts", "src/**/*.vue", "types/**/*.ts"] + "include": ["src/**/*", "src/**/*.ts", "src/**/*.vue"] } diff --git a/utilities/vite.config.ts b/utilities/vite.config.ts index 7ce552f4..dc262e14 100644 --- a/utilities/vite.config.ts +++ b/utilities/vite.config.ts @@ -1,6 +1,3 @@ -/// - -import { HstVue } from '@histoire/plugin-vue' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' import { defineConfig } from 'vite' @@ -12,9 +9,11 @@ export default defineConfig({ resolve: { alias: { '@': resolve(projectRootDir, 'src'), + types: resolve(projectRootDir, 'src/types'), }, }, build: { + emptyOutDir: false, sourcemap: true, lib: { entry: resolve(projectRootDir, 'src/index.ts'), @@ -29,8 +28,4 @@ export default defineConfig({ }, }, }, - histoire: { - plugins: [HstVue()], - storyIgnored: ['**/node_modules/**', '**/dist/**'], - }, })