-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17b1f9b
commit 76b5cd6
Showing
3 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "vue3-slider", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"author": "Freddie Nelson <[email protected]> (https://freddienelson.co.uk)", | ||
"description": "A modern, customizable slider built entirely in Vue.js 3 with TypeScript in under 3KB (gzipped) and dependency free.", | ||
"keywords": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { App, DefineComponent, Plugin } from 'vue'; | ||
|
||
// Import vue component | ||
import component from '@/vue3-slider.vue'; | ||
|
||
// Define typescript interfaces for installable component | ||
type InstallableComponent = DefineComponent & { install: Exclude<Plugin['install'], undefined> }; | ||
|
||
// Default export is installable instance of component. | ||
// IIFE injects install function into component, allowing component | ||
// to be registered via Vue.use() as well as Vue.component(), | ||
export default /*#__PURE__*/((): InstallableComponent => { | ||
// Assign InstallableComponent type | ||
const installable = component as unknown as InstallableComponent; | ||
|
||
// Attach install function executed by Vue.use() | ||
installable.install = (app: App) => { | ||
app.component('Vue3Slider', installable); | ||
}; | ||
return installable; | ||
})(); | ||
|
||
// It's possible to expose named exports when writing components that can | ||
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo'; | ||
// export const RollupDemoDirective = directive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
import { App, DefineComponent, Plugin } from 'vue'; | ||
// iife/cjs usage extends esm default export - so import it all | ||
import component, * as namedExports from '@/entry.esm'; | ||
|
||
// Import vue component | ||
import component from '@/vue3-slider.vue'; | ||
// Attach named exports directly to component. IIFE/CJS will | ||
// only expose one global var, with named exports exposed as properties of | ||
// that global var (eg. plugin.namedExport) | ||
Object.entries(namedExports).forEach(([exportName, exported]) => { | ||
if (exportName !== 'default') component[exportName] = exported; | ||
}); | ||
|
||
// Define typescript interfaces for installable component | ||
type InstallableComponent = DefineComponent & { install: Exclude<Plugin['install'], undefined> }; | ||
|
||
// Default export is installable instance of component. | ||
// IIFE injects install function into component, allowing component | ||
// to be registered via Vue.use() as well as Vue.component(), | ||
export default /*#__PURE__*/((): InstallableComponent => { | ||
// Assign InstallableComponent type | ||
const installable = component as unknown as InstallableComponent; | ||
|
||
// Attach install function executed by Vue.use() | ||
installable.install = (app: App) => { | ||
app.component('Vue3Slider', installable); | ||
}; | ||
return installable; | ||
})(); | ||
|
||
// It's possible to expose named exports when writing components that can | ||
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo'; | ||
// export const RollupDemoDirective = directive; | ||
export default component as typeof component & Exclude<typeof namedExports, 'default'>; |