From 98dac4ce935082a54074c8b57276dce2cf2b20e1 Mon Sep 17 00:00:00 2001 From: Westbrook Johnson Date: Tue, 6 Apr 2021 08:41:29 -0400 Subject: [PATCH] feat: split icons into their own export --- packages/bundle/README.md | 8 ++++---- packages/bundle/package.json | 4 +++- packages/bundle/src/icons.ts | 16 ++++++++++++++++ packages/bundle/src/index.ts | 4 ---- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 packages/bundle/src/icons.ts diff --git a/packages/bundle/README.md b/packages/bundle/README.md index c54c5173f0..006b329506 100644 --- a/packages/bundle/README.md +++ b/packages/bundle/README.md @@ -29,10 +29,10 @@ While this bundle directly re-exports the majority of functionality as they woul #### UI -`@spectrum-web-components/icons-ui` is renamed to `UIIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle` like the following: +`@spectrum-web-components/icons-ui` is renamed to `UIIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle/icons.js` like the following: ``` -import { UIIcons } from '@spectrum-web-components/bundle'; +import { UIIcons } from '@spectrum-web-components/bundle/icons.js'; console.log(UIIcons.AsteriskIcon()); @@ -43,10 +43,10 @@ TemplateResult {strings: Array[1], values: Array[0], type: "html", processor: De #### Workflow -`@spectrum-web-components/icons-workflow` is namespaced to `WorkflowIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle` like the following: +`@spectrum-web-components/icons-workflow` is namespaced to `WorkflowIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle/icons.js` like the following: ``` -import { IconsWorkflow } from '@spectrum-web-components/bundle'; +import { IconsWorkflow } from '@spectrum-web-components/bundle/icons.js'; console.log(IconsWorkflow.CircleIcon()); diff --git a/packages/bundle/package.json b/packages/bundle/package.json index 1768ca407c..f231034c56 100644 --- a/packages/bundle/package.json +++ b/packages/bundle/package.json @@ -29,7 +29,9 @@ "./src/*": "./src/*", "./package.json": "./package.json", "./elements": "./elements.js", - "./elements.js": "./elements.js" + "./elements.js": "./elements.js", + "./icons": "./src/icons.js", + "./icons.js": "./src/icons.js" }, "files": [ "custom-elements.json", diff --git a/packages/bundle/src/icons.ts b/packages/bundle/src/icons.ts new file mode 100644 index 0000000000..fc52f01644 --- /dev/null +++ b/packages/bundle/src/icons.ts @@ -0,0 +1,16 @@ +/* +Copyright 2020 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +import * as UIIcons from '@spectrum-web-components/icons-ui'; +export { UIIcons }; +import * as WorkflowIcons from '@spectrum-web-components/icons-workflow'; +export { WorkflowIcons }; diff --git a/packages/bundle/src/index.ts b/packages/bundle/src/index.ts index 6bdf3d3850..3c0d95eaeb 100644 --- a/packages/bundle/src/index.ts +++ b/packages/bundle/src/index.ts @@ -34,10 +34,6 @@ export * from '@spectrum-web-components/field-group'; export * from '@spectrum-web-components/field-label'; export * from '@spectrum-web-components/icon'; export * from '@spectrum-web-components/icons'; -import * as UIIcons from '@spectrum-web-components/icons-ui'; -export { UIIcons }; -import * as WorkflowIcons from '@spectrum-web-components/icons-workflow'; -export { WorkflowIcons }; export * from '@spectrum-web-components/illustrated-message'; export * from '@spectrum-web-components/link'; export * from '@spectrum-web-components/menu';