diff --git a/.gitignore b/.gitignore index 629ca0e3db0..44a5122d2ab 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ node_modules/ support/output-targets/custom-elements/bundles/ src/**/components.d.ts src/**/*.js -src/assets/styles/_hydration.scss __docs-temp__/* # User Settings, Caches & Temp Files diff --git a/package.json b/package.json index 162f0f486a0..c193ade7750 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "hydrate/" ], "scripts": { - "build": "npm run util:hydration-styles && npm run util:copy-icons && stencil build && npm run util:patch-es5-helpers", - "build:watch": "npm run util:hydration-styles && npm run util:copy-icons && stencil build --watch", - "build:watch-dev": "npm run util:hydration-styles && npm run util:copy-icons && stencil build --dev --watch", + "build": "npm run util:copy-icons && stencil build && npm run util:patch-es5-helpers", + "build:watch": "npm run util:copy-icons && stencil build --watch", + "build:watch-dev": "npm run util:copy-icons && stencil build --dev --watch", "deps:update": "updtr --exclude chalk cheerio typescript @types/jest jest jest-cli ts-jest puppeteer && npm audit fix", "docs": "concurrently --kill-others --raw \"npm:util:build-docs && build-storybook --output-dir ./docs\" \"ts-node ./support/cleanOnProcessExit.ts --path ./__docs-temp__\"", "docs:preview": "concurrently --raw \"npm:util:build-docs && start-storybook\" \"ts-node ./support/cleanOnProcessExit.ts --path ./__docs-temp__\"", @@ -42,18 +42,17 @@ "test:prerender": "stencil build --no-docs --prerender", "test:storybook": "concurrently --raw \"npm:util:build-docs && screener-storybook --conf screener.config.js\"", "test:watch": "npm run util:run-tests -- --watchAll", - "util:build-docs": "npm run util:hydration-styles && npm run util:copy-icons && stencil build --config stencil.storybook.config.ts", + "util:build-docs": "npm run util:copy-icons && stencil build --config stencil.storybook.config.ts", "util:clean-tested-build": "npm ci && npm test && npm run build", "util:copy-icons": "cpy \"./node_modules/@esri/calcite-ui-icons/js/*.json\" \"./src/components/icon/assets/icon/\" --flat", "util:deploy-next": "npm run util:prep-next && npm run util:push-tags && npm run util:publish-next", "util:deploy-next-from-ci": "ts-node --project ./tsconfig-node-scripts.json support/deployNextFromCI.ts", - "util:hydration-styles": "ts-node support/hydrationStyles.ts", "util:patch-es5-helpers": "ts-node support/patchES5Helpers.ts", "util:prep-next": "ts-node --project ./tsconfig-node-scripts.json support/prepReleaseCommit.ts --next && npm run build", "util:publish-next": "npm publish --tag next", "util:check-squash-mergeable-branch": "ts-node --project ./tsconfig-node-scripts.json support/checkSquashMergeableBranch.ts", "util:push-tags": "git push --atomic --follow-tags origin master", - "util:run-tests": "npm run util:hydration-styles && npm run util:copy-icons && stencil test --no-docs --spec --e2e" + "util:run-tests": "npm run util:copy-icons && stencil test --no-docs --spec --e2e" }, "repository": { "type": "git", diff --git a/src/assets/styles/global.scss b/src/assets/styles/global.scss index b5911f1400d..c770ad9c5d8 100644 --- a/src/assets/styles/global.scss +++ b/src/assets/styles/global.scss @@ -4,9 +4,6 @@ /* CSS vars (@include in global) */ @import "type"; -/* Hydration styles to hide non-hydrated components */ -@import "hydration"; - @mixin calcite-theme-light-extended { @include calcite-theme-light(); --calcite-theme-name: "light"; diff --git a/stencil.config.ts b/stencil.config.ts index 2027c443dbc..5ffa9069afd 100644 --- a/stencil.config.ts +++ b/stencil.config.ts @@ -95,7 +95,6 @@ export const create: () => Config = () => ({ } } ], - invisiblePrehydration: false, globalStyle: "src/assets/styles/global.scss", plugins: [ sass({ diff --git a/support/hydrationStyles.ts b/support/hydrationStyles.ts deleted file mode 100644 index 793bff7323f..00000000000 --- a/support/hydrationStyles.ts +++ /dev/null @@ -1,33 +0,0 @@ -type Dirent = import("fs").Dirent; - -const fs = require("fs"); -const path = require("path"); - -const basePath = path.normalize(`${__dirname}/../src/components/`); - -async function filter(array: T[], predicate: (item: T) => Promise): Promise { - const results = await Promise.all(array.map((item) => predicate(item))); - return array.filter((_item, index) => results[index]); -} - -async function isCalciteComponent(entry: Dirent): Promise { - if (!entry.isDirectory()) { - return false; - } - const files = await fs.promises.readdir(path.join(basePath, entry.name)); - return files?.includes(`${entry.name}.tsx`); -} - -(async function () { - const stylePath = path.normalize(`${__dirname}/../src/assets/styles/_hydration.scss`); - const components = await fs.promises.readdir(basePath, { withFileTypes: true }); - const selectors = (await filter(components, isCalciteComponent)).map( - ({ name }) => `calcite-${name}:not([calcite-hydrated])` - ); - const fileContents = `// generated by support/hydrationStyles.ts -${selectors.join(",\n")} { - visibility: hidden; - pointer-events: none; -}`; - await fs.promises.writeFile(stylePath, fileContents); -})();