@lion/ui 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/core/src/SlotMixin.js +180 -42
- package/components/core/test/SlotMixin.test.js +355 -145
- package/components/core/types/SlotMixinTypes.ts +12 -1
- package/components/input-tel/src/LionInputTel.js +0 -9
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +32 -29
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +5 -6
- package/components/localize/src/number/parseNumber.js +15 -36
- package/components/localize/test/number/parseNumber.test.js +3 -12
- package/components/localize/types/LocalizeMixinTypes.ts +1 -1
- package/custom-elements.json +1435 -133
- package/dist-types/components/calendar/src/LionCalendar.d.ts +1 -37
- package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
- package/dist-types/components/core/src/SlotMixin.d.ts +2 -0
- package/dist-types/components/core/src/SlotMixin.d.ts.map +1 -1
- package/dist-types/components/core/test/SlotMixin.test.d.ts +1 -1
- package/dist-types/components/core/test/SlotMixin.test.d.ts.map +1 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts +9 -1
- package/dist-types/components/core/types/SlotMixinTypes.d.ts.map +1 -1
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts +1 -37
- package/dist-types/components/input-amount/src/LionInputAmount.d.ts.map +1 -1
- package/dist-types/components/input-date/src/LionInputDate.d.ts +1 -37
- package/dist-types/components/input-date/src/LionInputDate.d.ts.map +1 -1
- package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts +1 -37
- package/dist-types/components/input-datepicker/src/LionCalendarOverlayFrame.d.ts.map +1 -1
- package/dist-types/components/input-email/src/LionInputEmail.d.ts +1 -37
- package/dist-types/components/input-email/src/LionInputEmail.d.ts.map +1 -1
- package/dist-types/components/input-iban/src/LionInputIban.d.ts +1 -37
- package/dist-types/components/input-iban/src/LionInputIban.d.ts.map +1 -1
- package/dist-types/components/input-tel/src/LionInputTel.d.ts +1 -42
- package/dist-types/components/input-tel/src/LionInputTel.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts +14 -8
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.d.ts.map +1 -1
- package/dist-types/components/localize/src/LocalizeMixin.d.ts +1 -37
- package/dist-types/components/localize/src/LocalizeMixin.d.ts.map +1 -1
- package/dist-types/components/localize/src/number/parseNumber.d.ts.map +1 -1
- package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts +1 -1
- package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts.map +1 -1
- package/dist-types/components/pagination/src/LionPagination.d.ts +1 -37
- package/dist-types/components/pagination/src/LionPagination.d.ts.map +1 -1
- package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts +1 -37
- package/dist-types/components/progress-indicator/src/LionProgressIndicator.d.ts.map +1 -1
- package/dist-types/exports/core.d.ts +1 -0
- package/dist-types/exports/core.d.ts.map +1 -1
- package/dist-types/exports/form-core.d.ts +2 -0
- package/dist-types/exports/form-core.d.ts.map +1 -1
- package/dist-types/exports/input-tel-dropdown.d.ts +2 -0
- package/dist-types/exports/input-tel-dropdown.d.ts.map +1 -1
- package/dist-types/exports/input-tel.d.ts +1 -0
- package/dist-types/exports/input-tel.d.ts.map +1 -1
- package/dist-types/exports/localize.d.ts +3 -0
- package/dist-types/exports/localize.d.ts.map +1 -1
- package/dist-types/exports/overlays.d.ts +4 -0
- package/dist-types/exports/overlays.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/accordion/index.md +3 -0
- package/docs/components/accordion/overview.md +129 -0
- package/docs/components/accordion/reference.md +47 -0
- package/docs/components/accordion/use-cases.md +252 -0
- package/docs/components/button/examples.md +30 -0
- package/docs/components/button/index.md +3 -0
- package/docs/components/button/overview.md +30 -0
- package/docs/components/button/src/icon.svg.js +5 -0
- package/docs/components/button/use-cases.md +106 -0
- package/docs/components/calendar/index.md +3 -0
- package/docs/components/calendar/overview.md +49 -0
- package/docs/components/calendar/use-cases.md +192 -0
- package/docs/components/checkbox-group/index.md +3 -0
- package/docs/components/checkbox-group/overview.md +40 -0
- package/docs/components/checkbox-group/use-cases.md +256 -0
- package/docs/components/collapsible/assets/CustomCollapsible.js +113 -0
- package/docs/components/collapsible/assets/applyDemoCollapsibleStyles.js +37 -0
- package/docs/components/collapsible/examples.md +83 -0
- package/docs/components/collapsible/index.md +3 -0
- package/docs/components/collapsible/overview.md +39 -0
- package/docs/components/collapsible/use-cases.md +79 -0
- package/docs/components/combobox/examples.md +153 -0
- package/docs/components/combobox/index.md +3 -0
- package/docs/components/combobox/overview.md +51 -0
- package/docs/components/combobox/src/LinkMixin.js +60 -0
- package/docs/components/combobox/src/demo-selection-display.js +191 -0
- package/docs/components/combobox/src/gh-combobox/gh-button.js +69 -0
- package/docs/components/combobox/src/gh-combobox/gh-combobox.js +508 -0
- package/docs/components/combobox/src/google-combobox/assets/google-clear-icon.js +9 -0
- package/docs/components/combobox/src/google-combobox/assets/google-search-icon.js +9 -0
- package/docs/components/combobox/src/google-combobox/assets/google-voice-search-icon.js +19 -0
- package/docs/components/combobox/src/google-combobox/assets/googlelogo_color_272x92dp.png +0 -0
- package/docs/components/combobox/src/google-combobox/google-combobox.js +460 -0
- package/docs/components/combobox/src/lazyRender.js +29 -0
- package/docs/components/combobox/src/levenshtein.js +95 -0
- package/docs/components/combobox/src/md-combobox/MdFieldMixin.js +341 -0
- package/docs/components/combobox/src/md-combobox/md-combobox.js +89 -0
- package/docs/components/combobox/src/md-combobox/md-input.js +5 -0
- package/docs/components/combobox/src/md-combobox/style/load-roboto.js +6 -0
- package/docs/components/combobox/src/md-combobox/style/md-ripple.js +81 -0
- package/docs/components/combobox/src/wa-combobox/wa-combobox.js +368 -0
- package/docs/components/combobox/use-cases.md +377 -0
- package/docs/components/dialog/index.md +3 -0
- package/docs/components/dialog/overview.md +63 -0
- package/docs/components/dialog/src/demo-dialog-style.js +3 -0
- package/docs/components/dialog/src/demoStyle.js +39 -0
- package/docs/components/dialog/src/slots-dialog-content.js +32 -0
- package/docs/components/dialog/src/styled-dialog-content.js +38 -0
- package/docs/components/dialog/use-cases.md +154 -0
- package/docs/components/drawer/index.md +3 -0
- package/docs/components/drawer/overview.md +68 -0
- package/docs/components/drawer/src/demoStyle.js +71 -0
- package/docs/components/drawer/use-cases.md +194 -0
- package/docs/components/fieldset/index.md +3 -0
- package/docs/components/fieldset/overview.md +49 -0
- package/docs/components/fieldset/use-cases.md +185 -0
- package/docs/components/form/index.md +3 -0
- package/docs/components/form/overview.md +43 -0
- package/docs/components/form/use-cases.md +72 -0
- package/docs/components/icon/assets/bugs/bug01.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug02.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug05.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug06.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug08.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug12.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug19.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug23.svg.js +2 -0
- package/docs/components/icon/assets/bugs/bug24.svg.js +2 -0
- package/docs/components/icon/assets/iconset-bugs.js +11 -0
- package/docs/components/icon/assets/iconset-misc.js +3 -0
- package/docs/components/icon/assets/iconset-space.js +31 -0
- package/docs/components/icon/assets/misc/arrowLeft.svg.js +6 -0
- package/docs/components/icon/assets/space/aliens-spaceship.svg.js +2 -0
- package/docs/components/icon/assets/space/meteor.svg.js +2 -0
- package/docs/components/icon/assets/space/moon-flag.svg.js +2 -0
- package/docs/components/icon/assets/space/moon.svg.js +2 -0
- package/docs/components/icon/assets/space/night.svg.js +2 -0
- package/docs/components/icon/assets/space/orbit.svg.js +2 -0
- package/docs/components/icon/assets/space/planet.svg.js +2 -0
- package/docs/components/icon/assets/space/robot.svg.js +2 -0
- package/docs/components/icon/assets/space/rocket.svg.js +2 -0
- package/docs/components/icon/assets/space/satellite.svg.js +2 -0
- package/docs/components/icon/assets/space/signal.svg.js +2 -0
- package/docs/components/icon/assets/space/space-helmet.svg.js +2 -0
- package/docs/components/icon/assets/space/sun.svg.js +2 -0
- package/docs/components/icon/assets/space/telescope.svg.js +2 -0
- package/docs/components/icon/index.md +3 -0
- package/docs/components/icon/overview.md +40 -0
- package/docs/components/icon/use-cases.md +93 -0
- package/docs/components/index.md +7 -0
- package/docs/components/input/index.md +3 -0
- package/docs/components/input/overview.md +36 -0
- package/docs/components/input/use-cases.md +77 -0
- package/docs/components/input-amount/index.md +3 -0
- package/docs/components/input-amount/overview.md +49 -0
- package/docs/components/input-amount/use-cases.md +122 -0
- package/docs/components/input-date/index.md +3 -0
- package/docs/components/input-date/overview.md +39 -0
- package/docs/components/input-date/use-cases.md +83 -0
- package/docs/components/input-datepicker/index.md +3 -0
- package/docs/components/input-datepicker/overview.md +42 -0
- package/docs/components/input-datepicker/use-cases.md +78 -0
- package/docs/components/input-email/index.md +3 -0
- package/docs/components/input-email/overview.md +32 -0
- package/docs/components/input-email/use-cases.md +48 -0
- package/docs/components/input-iban/index.md +3 -0
- package/docs/components/input-iban/overview.md +37 -0
- package/docs/components/input-iban/use-cases.md +102 -0
- package/docs/components/input-range/index.md +3 -0
- package/docs/components/input-range/overview.md +34 -0
- package/docs/components/input-range/use-cases.md +108 -0
- package/docs/components/input-stepper/index.md +3 -0
- package/docs/components/input-stepper/overview.md +36 -0
- package/docs/components/input-stepper/use-cases.md +41 -0
- package/docs/components/input-tel/index.md +3 -0
- package/docs/components/input-tel/overview.md +62 -0
- package/docs/components/input-tel/src/h-region-code-table.js +109 -0
- package/docs/components/input-tel/use-cases.md +307 -0
- package/docs/components/input-tel-dropdown/examples.md +32 -0
- package/docs/components/input-tel-dropdown/index.md +3 -0
- package/docs/components/input-tel-dropdown/overview.md +38 -0
- package/docs/components/input-tel-dropdown/src/intl-input-tel-dropdown.js +127 -0
- package/docs/components/input-tel-dropdown/use-cases.md +159 -0
- package/docs/components/listbox/index.md +3 -0
- package/docs/components/listbox/overview.md +42 -0
- package/docs/components/listbox/src/listboxData.js +65 -0
- package/docs/components/listbox/use-cases.md +147 -0
- package/docs/components/pagination/index.md +3 -0
- package/docs/components/pagination/overview.md +29 -0
- package/docs/components/pagination/use-cases.md +99 -0
- package/docs/components/progress-indicator/assets/my-determinate-progress-bar.js +30 -0
- package/docs/components/progress-indicator/assets/my-indeterminate-progress-spinner.js +55 -0
- package/docs/components/progress-indicator/examples.md +125 -0
- package/docs/components/progress-indicator/index.md +3 -0
- package/docs/components/progress-indicator/overview.md +36 -0
- package/docs/components/radio-group/index.md +3 -0
- package/docs/components/radio-group/overview.md +46 -0
- package/docs/components/radio-group/use-cases.md +140 -0
- package/docs/components/select/index.md +3 -0
- package/docs/components/select/overview.md +44 -0
- package/docs/components/select/use-cases.md +55 -0
- package/docs/components/select-rich/examples.md +31 -0
- package/docs/components/select-rich/index.md +3 -0
- package/docs/components/select-rich/overview.md +46 -0
- package/docs/components/select-rich/src/flagStyles.js +1250 -0
- package/docs/components/select-rich/src/flags.png +0 -0
- package/docs/components/select-rich/src/flags@2x.png +0 -0
- package/docs/components/select-rich/src/intl-select-rich.js +194 -0
- package/docs/components/select-rich/src/regionMetaList.js +1717 -0
- package/docs/components/select-rich/use-cases.md +370 -0
- package/docs/components/steps/index.md +3 -0
- package/docs/components/steps/overview.md +63 -0
- package/docs/components/steps/use-cases.md +163 -0
- package/docs/components/switch/index.md +3 -0
- package/docs/components/switch/overview.md +75 -0
- package/docs/components/switch/reference.md +39 -0
- package/docs/components/switch/use-cases.md +76 -0
- package/docs/components/tabs/examples.md +23 -0
- package/docs/components/tabs/index.md +3 -0
- package/docs/components/tabs/overview.md +48 -0
- package/docs/components/tabs/src/lea-tab-panel.js +24 -0
- package/docs/components/tabs/src/lea-tab.js +45 -0
- package/docs/components/tabs/src/lea-tabs.js +28 -0
- package/docs/components/tabs/use-cases.md +219 -0
- package/docs/components/textarea/index.md +3 -0
- package/docs/components/textarea/overview.md +35 -0
- package/docs/components/textarea/use-cases.md +95 -0
- package/docs/components/tooltip/examples.md +39 -0
- package/docs/components/tooltip/index.md +3 -0
- package/docs/components/tooltip/overview.md +44 -0
- package/docs/components/tooltip/use-cases.md +208 -0
- package/docs/fundamentals/index.md +19 -0
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +1 -0
- package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +233 -0
- package/docs/fundamentals/node-tools/index.md +1 -0
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +68 -0
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +111 -0
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +69 -0
- package/docs/fundamentals/node-tools/providence-analytics/assets/_mermaid.svg.js +1202 -0
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +22 -0
- package/docs/fundamentals/node-tools/providence-analytics/index.md +1 -0
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +192 -0
- package/docs/fundamentals/node-tools/publish-docs/index.md +1 -0
- package/docs/fundamentals/node-tools/publish-docs/overview.md +136 -0
- package/docs/fundamentals/node-tools/remark-extend/index.md +1 -0
- package/docs/fundamentals/node-tools/remark-extend/overview.md +274 -0
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +1 -0
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +285 -0
- package/docs/fundamentals/rationales/TypeScript.md +18 -0
- package/docs/fundamentals/rationales/index.md +1 -0
- package/docs/fundamentals/rationales/side-effects.md +203 -0
- package/docs/fundamentals/rationales/versioning.md +35 -0
- package/docs/fundamentals/systems/core/index.md +3 -0
- package/docs/fundamentals/systems/core/overview.md +85 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-1.svg +1 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-2.svg +1 -0
- package/docs/fundamentals/systems/form/assets/FormatMixinDiagram-3.svg +84 -0
- package/docs/fundamentals/systems/form/assets/h-output.js +155 -0
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +245 -0
- package/docs/fundamentals/systems/form/index.md +3 -0
- package/docs/fundamentals/systems/form/interaction-states.md +177 -0
- package/docs/fundamentals/systems/form/model-value.md +35 -0
- package/docs/fundamentals/systems/form/overview.md +82 -0
- package/docs/fundamentals/systems/form/styling.md +101 -0
- package/docs/fundamentals/systems/form/use-cases.md +156 -0
- package/docs/fundamentals/systems/form/validate.md +929 -0
- package/docs/fundamentals/systems/icon/index.md +3 -0
- package/docs/fundamentals/systems/icon/overview.md +124 -0
- package/docs/fundamentals/systems/index.md +1 -0
- package/docs/fundamentals/systems/localize/assets/all-locales.js +437 -0
- package/docs/fundamentals/systems/localize/assets/en-AU.js +6 -0
- package/docs/fundamentals/systems/localize/assets/en-GB.js +6 -0
- package/docs/fundamentals/systems/localize/assets/en-US.js +6 -0
- package/docs/fundamentals/systems/localize/assets/en.js +4 -0
- package/docs/fundamentals/systems/localize/assets/nl-BE.js +6 -0
- package/docs/fundamentals/systems/localize/assets/nl-NL.js +6 -0
- package/docs/fundamentals/systems/localize/assets/nl.js +4 -0
- package/docs/fundamentals/systems/localize/dates.md +195 -0
- package/docs/fundamentals/systems/localize/index.md +3 -0
- package/docs/fundamentals/systems/localize/numbers.md +217 -0
- package/docs/fundamentals/systems/localize/overview.md +48 -0
- package/docs/fundamentals/systems/localize/rationale.md +62 -0
- package/docs/fundamentals/systems/localize/text.md +125 -0
- package/docs/fundamentals/systems/localize/use-cases.md +319 -0
- package/docs/fundamentals/systems/overlays/assets/applyDemoOverlayStyles.js +22 -0
- package/docs/fundamentals/systems/overlays/assets/demo-overlay-backdrop.js +48 -0
- package/docs/fundamentals/systems/overlays/assets/demo-overlay-system.js +42 -0
- package/docs/fundamentals/systems/overlays/assets/umbrella-form.js +133 -0
- package/docs/fundamentals/systems/overlays/configuration.md +453 -0
- package/docs/fundamentals/systems/overlays/form-integration.md +65 -0
- package/docs/fundamentals/systems/overlays/index.md +3 -0
- package/docs/fundamentals/systems/overlays/overview.md +118 -0
- package/docs/fundamentals/systems/overlays/rationale.md +232 -0
- package/docs/fundamentals/systems/overlays/scope.md +176 -0
- package/docs/fundamentals/systems/overlays/use-cases.md +699 -0
- package/docs/fundamentals/tools/ajax/assets/naga.json +9 -0
- package/docs/fundamentals/tools/ajax/assets/pabu.json +9 -0
- package/docs/fundamentals/tools/ajax/index.md +3 -0
- package/docs/fundamentals/tools/ajax/overview.md +128 -0
- package/docs/fundamentals/tools/ajax/use-cases.md +456 -0
- package/docs/fundamentals/tools/helpers/action-logger.md +165 -0
- package/docs/fundamentals/tools/helpers/index.md +3 -0
- package/docs/fundamentals/tools/helpers/overview.md +30 -0
- package/docs/fundamentals/tools/index.md +1 -0
- package/docs/fundamentals/tools/singleton-manager/index.md +3 -0
- package/docs/fundamentals/tools/singleton-manager/overview.md +304 -0
- package/docs/guides/how-to/create-a-custom-field.md +200 -0
- package/docs/guides/how-to/extend-a-native-input.md +66 -0
- package/docs/guides/how-to/get-started.md +77 -0
- package/docs/guides/how-to/index.md +1 -0
- package/docs/guides/index.md +34 -0
- package/docs/guides/principles/definitions-and-terms.md +41 -0
- package/docs/guides/principles/index.md +26 -0
- package/docs/guides/principles/scoped-elements.md +103 -0
- package/docs/guides/principles/styling.md +32 -0
- package/docs/guides/principles/subclasser-apis.md +28 -0
- package/docs/override.js +15 -0
- package/exports/core.js +2 -0
- package/exports/form-core.js +3 -0
- package/exports/input-tel-dropdown.js +3 -0
- package/exports/input-tel.js +2 -0
- package/exports/localize.js +4 -0
- package/exports/overlays.js +5 -0
- package/package.json +3 -2
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Node Tools >> Extend Docs >> Overview ||10
|
|
2
|
+
|
|
3
|
+
When maintaining your own extension layer of lion you most likely want to maintain a similar documentation.
|
|
4
|
+
Copying and rewriting imports/tags the markdown files works but also means that whenever something change you need copy and rewrite again.
|
|
5
|
+
|
|
6
|
+
To do this automatically you can use this preset for [rocket](https://rocket.modern-web.dev/).
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Import lion documentation and adjust it using [remark-extend](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/node-tools/remark-extend/overview.md)
|
|
11
|
+
- Renames named imports and all it's usage
|
|
12
|
+
- Adjusts import paths
|
|
13
|
+
- Replace tags in template literals
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm i -D rocket-preset-extend-lion-docs
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
👉 _rocket.config.js_
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { rocketLaunch } from '@rocket/launch';
|
|
25
|
+
import { extendLionDocs } from 'rocket-preset-extend-lion-docs';
|
|
26
|
+
|
|
27
|
+
const extendLionDocsInstance = await extendLionDocs({
|
|
28
|
+
classPrefix: 'Wolf',
|
|
29
|
+
classBareImport: '@wolf/',
|
|
30
|
+
tagPrefix: 'wolf-',
|
|
31
|
+
tagBareImport: '@wolf/',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
presets: [rocketLaunch(), extendLionDocsInstance],
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Reusing documentation
|
|
40
|
+
|
|
41
|
+
To take an existing documentation you can "import" it using [remark-extend](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/node-tools/remark-extend/overview.md).
|
|
42
|
+
|
|
43
|
+
As an example you can create `docs/components/tabs/overview.md`.
|
|
44
|
+
|
|
45
|
+
In it you do
|
|
46
|
+
|
|
47
|
+
- write a headline
|
|
48
|
+
- use importSmallBlockContent to reuse content from lion
|
|
49
|
+
- add your own installation instruction
|
|
50
|
+
|
|
51
|
+
````md
|
|
52
|
+
# Tabs >> Overview ||10
|
|
53
|
+
|
|
54
|
+
```js ::importSmallBlockContent('@lion/ui/tabs/docs/overview.md', '# Tabs >> Overview ||10.js')
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm i --save @wolf/tabs
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { WolfTabs } from '@wolf/tabs';
|
|
66
|
+
```
|
|
67
|
+
````
|
|
68
|
+
|
|
69
|
+
## How does it work
|
|
70
|
+
|
|
71
|
+
1. `importSmallBlockContent`` will import the content from lion
|
|
72
|
+
2. all code blocks will then be precessed to use `@wolf` instead of `@lion`
|
|
73
|
+
3. all links which are absolute to github will be processed to be local links
|
|
74
|
+
|
|
75
|
+
as an example this is a part of the lion docs for tabs
|
|
76
|
+
|
|
77
|
+
````md
|
|
78
|
+
```js script
|
|
79
|
+
import { LitElement, html } from '@mdjs/mdjs-preview';
|
|
80
|
+
import '@lion/ui/define/lion-tabs.js';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```js preview-story
|
|
84
|
+
export const main = () => html`
|
|
85
|
+
<lion-tabs>
|
|
86
|
+
<button slot="tab">Info</button>
|
|
87
|
+
<p slot="panel">Info page with lots of information about us.</p>
|
|
88
|
+
<button slot="tab">Work</button>
|
|
89
|
+
<p slot="panel">Work page that showcases our work.</p>
|
|
90
|
+
</lion-tabs>
|
|
91
|
+
`;
|
|
92
|
+
```
|
|
93
|
+
````
|
|
94
|
+
|
|
95
|
+
After all replacements the output that will be used for markdown rendering will be
|
|
96
|
+
|
|
97
|
+
````md
|
|
98
|
+
# Tabs >> Overview ||10
|
|
99
|
+
|
|
100
|
+
```js script
|
|
101
|
+
import { LitElement, html } from '@wolf/core';
|
|
102
|
+
import '@wolf/tabs/define';
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```js preview-story
|
|
106
|
+
export const main = () => html`
|
|
107
|
+
<wolf-tabs>
|
|
108
|
+
<button slot="tab">Info</button>
|
|
109
|
+
<p slot="panel">Info page with lots of information about us.</p>
|
|
110
|
+
<button slot="tab">Work</button>
|
|
111
|
+
<p slot="panel">Work page that showcases our work.</p>
|
|
112
|
+
</wolf-tabs>
|
|
113
|
+
`;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Installation
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm i --save @wolf/tabs
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
import { WolfTabs } from '@wolf/tabs';
|
|
124
|
+
```
|
|
125
|
+
````
|
|
126
|
+
|
|
127
|
+
Doing so means you can focus on writing what is specific to your design system extension and you don't need to rewrite all the examples and explanations of lion but you can import them while still using your components.
|
|
128
|
+
|
|
129
|
+
## Use with a monorepo
|
|
130
|
+
|
|
131
|
+
The above setup assumes that you have the same "system" of exports in `@wolf` as we have in `@lion`.
|
|
132
|
+
|
|
133
|
+
So your users are able to do
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
// provide classes as side effect free imports
|
|
137
|
+
import { WolfTabs } from '@wolf/tabs';
|
|
138
|
+
// register web components via `/define`
|
|
139
|
+
import '@wolf/tabs/define';
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
This means you need to have to define the following package entry points for you tabs extension.
|
|
143
|
+
|
|
144
|
+
👉 _tabs/package.json_
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
"exports": {
|
|
148
|
+
".": "./src/index.js",
|
|
149
|
+
"./define": "./src/define/tabs.js",
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Use as a single repo
|
|
154
|
+
|
|
155
|
+
Often its easier for your users to have one package to work with instead of a big list of individual packages.
|
|
156
|
+
If you are distributing one package then your exports/imports will be different.
|
|
157
|
+
|
|
158
|
+
So your users are able to do
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
// provide classes as side effect free imports
|
|
162
|
+
import { WolfTabs } from 'wolf-web/tabs';
|
|
163
|
+
// register web components via `/define`
|
|
164
|
+
import 'wolf-web/tabs/define';
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
👉 _package.json_
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
"exports": {
|
|
171
|
+
".": "./index.js",
|
|
172
|
+
"./tabs/define": "./define/tabs.js",
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The configuration for that is
|
|
177
|
+
|
|
178
|
+
👉 _rocket.config.js_
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
import { rocketLaunch } from '@rocket/launch';
|
|
182
|
+
import { extendLionDocs } from 'rocket-preset-extend-lion-docs';
|
|
183
|
+
|
|
184
|
+
const extendLionDocsInstance = await extendLionDocs({
|
|
185
|
+
classPrefix: 'Wolf',
|
|
186
|
+
classBareImport: 'wolf-web/',
|
|
187
|
+
tagPrefix: 'wolf-',
|
|
188
|
+
tagBareImport: 'wolf-web/',
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export default {
|
|
192
|
+
presets: [rocketLaunch(), extendLionDocsInstance],
|
|
193
|
+
};
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Do not distribute side effects
|
|
197
|
+
|
|
198
|
+
When distributing you may choose to stay side effect free. This means no definitions of custom elements. You may want to do this to "force" usage of a scoped registry in order to support multiple mayor version of a component in a single application. We would recommend [Scoped Elements](https://open-wc.org/docs/development/scoped-elements/) for that.
|
|
199
|
+
|
|
200
|
+
So your users are able to do
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
// provide classes as side effect free imports
|
|
204
|
+
import { WolfTabs } from 'wolf-web/tabs';
|
|
205
|
+
// NOTE: there no way to import a definition as a user
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
For demos it's still useful/needed to have those definitions. To have them but not exposing them you can use private imports which are only available to the package itself. This feature is called [Subpath imports](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#packages_subpath_imports) in node.
|
|
209
|
+
|
|
210
|
+
To enable it you can set the following settings
|
|
211
|
+
|
|
212
|
+
👉 _rocket.config.js_
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
import { rocketLaunch } from '@rocket/launch';
|
|
216
|
+
import { extendLionDocs } from 'rocket-preset-extend-lion-docs';
|
|
217
|
+
|
|
218
|
+
const extendLionDocsInstance = await extendLionDocs({
|
|
219
|
+
classPrefix: 'Wolf',
|
|
220
|
+
classBareImport: 'wolf-web/',
|
|
221
|
+
tagPrefix: 'wolf-',
|
|
222
|
+
tagBareImport: '#',
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export default {
|
|
226
|
+
presets: [rocketLaunch(), extendLionDocsInstance],
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
This rewrites the custom element definition side effects to
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
// from
|
|
234
|
+
import '@lion/ui/define/lion-tabs.js';
|
|
235
|
+
|
|
236
|
+
// to
|
|
237
|
+
import '#tabs/define';
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
In order for such imports to work you need to define them
|
|
241
|
+
|
|
242
|
+
👉 _package.json_
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
"imports": {
|
|
246
|
+
"#tabs/define": "./__element-definitions/wolf-tabs.js",
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Global replacements
|
|
251
|
+
|
|
252
|
+
Sometimes you need a bit more power when extending lion documentation.
|
|
253
|
+
For instance, you're extending repository has a different folder structure. Instead of putting your systems
|
|
254
|
+
documentation inside 'systems', you want to put it in 'web-systems'.
|
|
255
|
+
|
|
256
|
+
The configuration for that is (see `globalReplaceFunction`):
|
|
257
|
+
|
|
258
|
+
👉 _rocket.config.js_
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
import { rocketLaunch } from '@rocket/launch';
|
|
262
|
+
import { extendLionDocs } from 'rocket-preset-extend-lion-docs';
|
|
263
|
+
|
|
264
|
+
const extendLionDocsInstance = await extendLionDocs({
|
|
265
|
+
classPrefix: 'Wolf',
|
|
266
|
+
classBareImport: 'wolf-web/',
|
|
267
|
+
tagPrefix: 'wolf-',
|
|
268
|
+
tagBareImport: 'wolf-web/',
|
|
269
|
+
globalReplaceFunction: node => {
|
|
270
|
+
if (node.type === 'link') {
|
|
271
|
+
// All internal links to '/systems/' (like '(../../fundamentals/systems/overlays/configuration.md)'),
|
|
272
|
+
// will be changed into '/web-systems/' ('(../../fundamentals/web-systems/overlays/configuration.md)').
|
|
273
|
+
node.url = node.url.replace(/\systems\/g, '/web-systems/');
|
|
274
|
+
}
|
|
275
|
+
return node;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
export default {
|
|
280
|
+
presets: [rocketLaunch(), extendLionDocsInstance],
|
|
281
|
+
};
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Remember: with great power comes great responsibility, so make sure your replacements do not introduce unintended
|
|
285
|
+
effects.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Rationales >> TypeScript ||30
|
|
2
|
+
|
|
3
|
+
[TypeScript](https://www.typescriptlang.org) is superset of JavaScript and a popular tool for getting strongly typed syntax and better autocompletion in JavaScript.
|
|
4
|
+
|
|
5
|
+
We've ensured that the entire Lion library is typed so that you can use it in TypeScript, but there are some caveats.
|
|
6
|
+
|
|
7
|
+
In Lion, we rely heavily on [Mixins](https://lit.dev/docs/composition/mixins/#mixin-basics) as a pattern for abstracting certain behaviors and properties into implementable interfaces.
|
|
8
|
+
Since JavaScript has a one-dimensional inheritance chain, inheriting from multiple ancestors has always been tricky, the Mixin pattern is used to get around that.
|
|
9
|
+
|
|
10
|
+
Here's the thing, Mixins have been notoriously difficult to type properly in TypeScript and in addition, we did not feel happy about adding an adhoc compilation step in our developer workflow. Therefore, we opted for typing our code with [JSDoc](https://jsdoc.app/) and using TypeScript to lint our types and generate type definition files.
|
|
11
|
+
|
|
12
|
+
Consuming Lion as `.js` typed by JSDoc is not much different from consuming it as when they were `.ts` files, but due to Mixins being very tricky to type, we've had to use `@ts-ignore` in a couple of places, most importantly, in many of our mixins.
|
|
13
|
+
|
|
14
|
+
For context, here's a [thread on the issue](https://github.com/microsoft/TypeScript/issues/36821) of inheritance type constraints in mixins, where a user suggested allowing to ignore the rule that causes problems.
|
|
15
|
+
This suggestion was declined and in [this comment](https://github.com/microsoft/TypeScript/issues/36821#issuecomment-588375051), Ryan Cavanaugh explained that using `@ts-ignore` is the right way to get around the limitation here.
|
|
16
|
+
As a user of Lion this means that because we've got `@ts-ignore`s in our source code, you may get type errors that originate from Lion, and there's nothing we can do about that, TypeScript's stance is that sometimes rules are too conservative, and ignoring them is the correct answer.
|
|
17
|
+
|
|
18
|
+
In order to ignore type issues coming from Lion, please use the [skipLibCheck](https://www.typescriptlang.org/tsconfig#skipLibCheck) option in your `ts.config.json`, this will ignore issues that aren't coming from your code.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Rationales ||50
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Rationales >> Side Effects ||10
|
|
2
|
+
|
|
3
|
+
All our packages are side effect free due to the fact that es modules are always side effect free even when changing other es modules. Only code which accesses browser globals like `window`, `console` in the root of the module will be treated a side effect and always included.
|
|
4
|
+
Everything else can be tree shaken by [rollup](https://rollupjs.org).
|
|
5
|
+
|
|
6
|
+
## Example
|
|
7
|
+
|
|
8
|
+
In this example we will define a function to override an es module export.
|
|
9
|
+
|
|
10
|
+
👉 `main.js`
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import { somethingElse, overlays } from './overlays.js';
|
|
14
|
+
|
|
15
|
+
console.log(somethingElse);
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
👉 `overlays.js`
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
class OverlayManager {}
|
|
22
|
+
|
|
23
|
+
export let overlays = new OverlayManager();
|
|
24
|
+
|
|
25
|
+
export function setOverlays(newOverlays) {
|
|
26
|
+
overlays = newOverlays;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const somethingElse = 'something else';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Example Result
|
|
33
|
+
|
|
34
|
+
However having this function alone does not mean a side effect as rollup can tree shake it.
|
|
35
|
+
|
|
36
|
+
See the code in [rollup repl][1].
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const somethingElse = 'something else';
|
|
40
|
+
|
|
41
|
+
console.log(somethingElse);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Example Override
|
|
45
|
+
|
|
46
|
+
Let's add an es module which uses that override.
|
|
47
|
+
|
|
48
|
+
👉 `main.js`
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import { somethingElse, overlays } from './overlays.js';
|
|
52
|
+
import './override.js';
|
|
53
|
+
|
|
54
|
+
console.log(somethingElse);
|
|
55
|
+
|
|
56
|
+
// this will trigger loading of full overlays.js & override.js code
|
|
57
|
+
// console.log(overlays.list);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
👉 `override.js`
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
import { setOverlays } from './overlays.js';
|
|
64
|
+
|
|
65
|
+
setOverlays(new Object());
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Example Override Result
|
|
69
|
+
|
|
70
|
+
It will still be fully tree shaken.
|
|
71
|
+
|
|
72
|
+
See the code in [rollup repl][2].
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const somethingElse = 'something else';
|
|
76
|
+
|
|
77
|
+
console.log(somethingElse);
|
|
78
|
+
|
|
79
|
+
// this will trigger loading of full overlays.js & override.js code
|
|
80
|
+
// console.log(overlays.list);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Example Override Result Accessing
|
|
84
|
+
|
|
85
|
+
ONLY if you actually access `overlays` it will include `overlays.js` & `override.js`.
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
class OverlayManager {}
|
|
89
|
+
|
|
90
|
+
let overlays = new OverlayManager();
|
|
91
|
+
|
|
92
|
+
function setOverlays(newOverlays) {
|
|
93
|
+
overlays = newOverlays;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const somethingElse = 'something else';
|
|
97
|
+
|
|
98
|
+
setOverlays(new Object());
|
|
99
|
+
|
|
100
|
+
console.log(somethingElse);
|
|
101
|
+
|
|
102
|
+
// this will trigger loading of full overlays.js & override.js code
|
|
103
|
+
console.log(overlays.list);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Comprehensive Example
|
|
109
|
+
|
|
110
|
+
This time we have a separate controller which also accesses the `overlays`.
|
|
111
|
+
|
|
112
|
+
👉 `main.js`
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
import { somethingElse, setOverlays, overlays } from './overlays.js';
|
|
116
|
+
import { OverlayController, somethingElse2 } from './OverlayController.js';
|
|
117
|
+
|
|
118
|
+
// the following code will tree shake overlays away hence overlays is side effect free
|
|
119
|
+
|
|
120
|
+
setOverlays(new Object());
|
|
121
|
+
console.log(somethingElse);
|
|
122
|
+
console.log(somethingElse2);
|
|
123
|
+
|
|
124
|
+
//** The following will toggle importing of overlays */
|
|
125
|
+
|
|
126
|
+
// 1. import overlays directly and access it
|
|
127
|
+
// console.log(overlays.list);
|
|
128
|
+
|
|
129
|
+
// 2. create an OverlayController which internally accesses overlays
|
|
130
|
+
// const ctrl = new OverlayController();
|
|
131
|
+
// console.log(ctrl.manager.list);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
👉 `overlays.js`
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
class OverlayManager {
|
|
138
|
+
constructor() {
|
|
139
|
+
this.list = [];
|
|
140
|
+
}
|
|
141
|
+
add(a) {
|
|
142
|
+
this.list.push(a);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export let overlays = new OverlayManager();
|
|
147
|
+
|
|
148
|
+
export function setOverlays(newOverlays) {
|
|
149
|
+
overlays = newOverlays;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const somethingElse = 'something else';
|
|
153
|
+
|
|
154
|
+
// the following line is a side effect as it always will be included
|
|
155
|
+
console.log('overlays side effect');
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
👉 `OverlayController.js`
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import { overlays } from './overlays.js';
|
|
162
|
+
|
|
163
|
+
export class OverlayController {
|
|
164
|
+
constructor(config = {}, manager = overlays) {
|
|
165
|
+
this.manager = manager;
|
|
166
|
+
this.manager.add(this);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const somethingElse2 = 'something else';
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Comprehensive Example Result
|
|
174
|
+
|
|
175
|
+
Even with all these intertwined code rollup can tree shake it fully away.
|
|
176
|
+
Again if you access the `overlays` or you start instantiating an `OverlaysController` it will include all the needed code.
|
|
177
|
+
|
|
178
|
+
Be sure to see it for yourself in the [rollup repl][3].
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
const somethingElse = 'something else';
|
|
182
|
+
|
|
183
|
+
// the following line is a side effect as it always will be included
|
|
184
|
+
console.log('overlays side effect');
|
|
185
|
+
|
|
186
|
+
const somethingElse2 = 'something else';
|
|
187
|
+
|
|
188
|
+
console.log(somethingElse);
|
|
189
|
+
console.log(somethingElse2);
|
|
190
|
+
|
|
191
|
+
//** The following will toggle importing of overlays */
|
|
192
|
+
|
|
193
|
+
// 1. import overlays directly and access it
|
|
194
|
+
// console.log(overlays.list);
|
|
195
|
+
|
|
196
|
+
// 2. create an OverlayController which internally accesses overlays
|
|
197
|
+
// const ctrl = new OverlayController();
|
|
198
|
+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TdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Rationales >> Versioning Lion ||20
|
|
2
|
+
|
|
3
|
+
Since Lion is a monorepository where each package is published separately under the `@lion` scope, we have packages that depend on other packages.
|
|
4
|
+
|
|
5
|
+
For example, `@lion/dialog` has a dependency on `@lion/overlays`.
|
|
6
|
+
|
|
7
|
+
The way we now version those is with `^` carets, for example:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@lion/overlays": "^0.30.0"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This means:
|
|
18
|
+
|
|
19
|
+
- For versions >= 1.0.0, get the latest minor of a certain major, major upgrades may contain breaking changes
|
|
20
|
+
- For versions < 1.0.0, get the latest patch of a certain minor, minor upgrades may contain breaking changes
|
|
21
|
+
|
|
22
|
+
See also, [Semantic Versioning](https://semver.org/).
|
|
23
|
+
|
|
24
|
+
In the past, we used to have fixed versioning, our rationale was as follows:
|
|
25
|
+
|
|
26
|
+
> Given there is a subclasser that consumes lion and publishes their own component set, each installation of a certain version of that component set must have the exact same versions of lion installed, so that the experience of the end user is consistent.
|
|
27
|
+
|
|
28
|
+
**However**, if semver is followed properly, users should never get the situation where they get diverging experiences, because that would only happen in a breaking change.
|
|
29
|
+
Additionally, fixing the versions led to other problems:
|
|
30
|
+
|
|
31
|
+
- Undedupable installations of the same package. If there are two installations of `@lion/ui/button` and one is installed as a dependency of another lion package, this installation will never be able to be deduped to another version, even if they.js're on the same minor. This is because the dependency is set to a fixed version, so NPM will see the two installations as incompatible and not dedupe them. For Lion, this can definitely lead to problems, especially with packages like `@lion/form-core`, `@lion/localize`, `@lion/overlays`, due to the singleton nature of some of the parts in those packages.
|
|
32
|
+
- Importing directly from lion as an end user when consuming a subclasser package that uses lion under the hood is dangerous. This is because you will need to always match, **exactly**, the version that is installed by the subclasser package. This means syncing your lion version with the subclasser's installed lion version every time you upgrade.
|
|
33
|
+
- Changesets will see (correctly) every bump in a `@lion` dependency as a semver-incompatible change for its `@lion` dependents and bump them as a result. This means a change to `@lion/core`, no matter how tiny, will bump almost every other `@lion` package "unnecessarily". This results in large changelogs that are mostly meaningless noise, hardly "human readable" which is the goal of changesets when used correctly.
|
|
34
|
+
|
|
35
|
+
Given all this, we changed our approach to versioning and went back to using `^` carets in our versions and **our new recommendation is to depend on `@lion` with `^` carets**. This should prevent majority of undedupable installation problems our users were having, allow importing from `@lion` directly, more safely, make our changelogs cleaner and reduce our publishing bloat.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Systems >> Core >> Overview ||10
|
|
2
|
+
|
|
3
|
+
The core package is mostly for in-depth usage.
|
|
4
|
+
It handles the version of `lit-element` and `lit-html`.
|
|
5
|
+
|
|
6
|
+
To be sure a compatible version is used you should import it via this package.
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
// DO
|
|
10
|
+
import { LitElement, html, render } from 'lit';
|
|
11
|
+
|
|
12
|
+
// DON'T
|
|
13
|
+
import { LitElement, html, render } from 'lit-element';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- [function to deduplicate mixins (dedupeMixin)](https://github.com/ing-bank/lion/blob/edc6920a90aa7658358819e7c324daf6badf7d30/docs/fundamentals/systems/core/#deduping-of-mixins)
|
|
19
|
+
- Mixin to handle disabled (DisabledMixin)
|
|
20
|
+
- Mixin to handle disabled AND tabIndex (DisabledWithTabIndexMixin)
|
|
21
|
+
- Mixin to manage auto-generated needed slot elements in light dom (SlotMixin)
|
|
22
|
+
- Mixin to create scoped styles in LightDOM-using components (ScopedStylesMixin)
|
|
23
|
+
|
|
24
|
+
> These features are not well documented - care to help out?
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm i --save @lion/ui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { dedupeMixin, LitElement } from 'lit';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Example
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const BaseMixin = dedupeMixin((superClass) => {
|
|
40
|
+
return class extends superClass { ... };
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Deduping of mixins
|
|
45
|
+
|
|
46
|
+
### Why is deduping of mixins necessary?
|
|
47
|
+
|
|
48
|
+
Imagine you are developing web components and creating ES classes for Custom Elements. You have two generic mixins (let's say `M1` and `M2`) which require independently the same even more generic mixin (`BaseMixin`). `M1` and `M2` can be used independently, that means they have to inherit from `BaseMixin` also independently. But they can be also used in combination. Sometimes `M1` and `M2` are used in the same component and can mess up the inheritance chain if `BaseMixin` is applied twice.
|
|
49
|
+
In other words, this may happen to the protoype chain `... -> M2 -> BaseMixin -> M1 -> BaseMixin -> ...`.
|
|
50
|
+
|
|
51
|
+
An example of this may be a `LocalizeMixin` used across different components and mixins. Some mixins may need it and many components need it too and can not rely on other mixins to have it by default, so must inherit from it independently.
|
|
52
|
+
|
|
53
|
+
The more generic the mixin is, the higher the chance of being applied more than once. As a mixin author you can't control how it is used, and can't always predict it. So as a safety measure it is always recommended to create deduping mixins.
|
|
54
|
+
|
|
55
|
+
### Usage of dedupeMixin()
|
|
56
|
+
|
|
57
|
+
This is an example of how to make a conventional ES mixin deduping.
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
const BaseMixin = dedupeMixin((superClass) => {
|
|
61
|
+
return class extends superClass { ... };
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// inherits from BaseMixin
|
|
65
|
+
const M1 = dedupeMixin((superClass) => {
|
|
66
|
+
return class extends BaseMixin(superClass) { ... };
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// inherits from BaseMixin
|
|
70
|
+
const M2 = dedupeMixin((superClass) => {
|
|
71
|
+
return class extends BaseMixin(superClass) { ... };
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// component inherits from M1
|
|
75
|
+
// MyCustomElement -> M1 -> BaseMixin -> BaseCustomElement;
|
|
76
|
+
class MyCustomElement extends M1(BaseCustomElement) { ... }
|
|
77
|
+
|
|
78
|
+
// component inherits from M2
|
|
79
|
+
// MyCustomElement -> M2 -> BaseMixin -> BaseCustomElement;
|
|
80
|
+
class MyCustomElement extends M2(BaseCustomElement) { ... }
|
|
81
|
+
|
|
82
|
+
// component inherits from both M1 and M2
|
|
83
|
+
// MyCustomElement -> M2 -> M1 -> BaseMixin -> BaseCustomElement;
|
|
84
|
+
class MyCustomElement extends M2(M1(BaseCustomElement)) { ... }
|
|
85
|
+
```
|