generated from unplugin/unplugin-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(packages): update outputs package; expose plugin-types
- Loading branch information
Showing
42 changed files
with
1,801 additions
and
348 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
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
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,2 +1,3 @@ | ||
export * from './utils/runtime-plugin' | ||
export * from './utils/virtual' | ||
export * from './utils/plugin-types' |
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,10 @@ | ||
export const pluginTypes = { | ||
imports: [ | ||
'import type { ReactStyledComponentFactory } from \'@pinceau/react\'', | ||
], | ||
global: [ | ||
'export const $styled: { [Type in SupportedHTMLElements]: ReactStyledComponentFactory<Type> }', | ||
], | ||
raw: [ | ||
], | ||
} |
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,20 +1,7 @@ | ||
import { useRuntimeSheet, useThemeSheet } from '@pinceau/runtime' | ||
const PinceauProvider = window.__modules__['@pinceau/outputs/react-plugin'].PinceauProvider | ||
|
||
export const PinceauReactOptions = { dev: false, colorSchemeMode: 'media', computedStyles: true, variants: true, ssr: { theme: true, runtime: true }, appId: false } | ||
const PinceauReactOptions = window.__modules__['@pinceau/outputs/react-plugin'].PinceauReactOptions | ||
|
||
export const PinceauContext = React.createContext() | ||
const usePinceauContext = window.__modules__['@pinceau/outputs/react-plugin'].usePinceauContext | ||
|
||
export const usePinceauContext = () => React.useContext(PinceauContext) | ||
|
||
export function PinceauProvider({ options, children, cb }) { | ||
const userOptions = { ...PinceauReactOptions, ...options } | ||
|
||
const themeSheet = useThemeSheet(userOptions) | ||
const runtimeSheet = useRuntimeSheet({ themeSheet, ...userOptions }) | ||
|
||
const ssr = { toString: () => runtimeSheet.toString() } | ||
|
||
if (cb) { cb(ssr) } | ||
|
||
return React.createElement(PinceauContext.Provider, { value: { themeSheet, runtimeSheet, ssr }, children }) | ||
} | ||
export { PinceauProvider, PinceauReactOptions, usePinceauContext } |
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,20 +1,11 @@ | ||
import { useRuntimeSheet, useThemeSheet } from '@pinceau/runtime' | ||
const getThemeSheet = window.__modules__['@pinceau/outputs/svelte-plugin'].getThemeSheet | ||
|
||
export const PinceauSvelteOptions = { dev: false, colorSchemeMode: 'media', computedStyles: true, variants: true, ssr: { theme: true, runtime: true }, appId: false } | ||
const getRuntimeSheet = window.__modules__['@pinceau/outputs/svelte-plugin'].getRuntimeSheet | ||
|
||
let userOptions | ||
const PinceauSvelteOptions = window.__modules__['@pinceau/outputs/svelte-plugin'].PinceauSvelteOptions | ||
|
||
let themeSheet | ||
export const getRuntimeSheet = () => runtimeSheet | ||
const pinceauPlugin = window.__modules__['@pinceau/outputs/svelte-plugin'].pinceauPlugin | ||
|
||
let runtimeSheet | ||
export const getThemeSheet = () => themeSheet | ||
const ssr = window.__modules__['@pinceau/outputs/svelte-plugin'].ssr | ||
|
||
export function pinceauPlugin(options) { | ||
userOptions = { ...PinceauSvelteOptions, ...options } | ||
|
||
themeSheet = useThemeSheet(userOptions) | ||
runtimeSheet = useRuntimeSheet({ themeSheet, ...userOptions }) | ||
} | ||
|
||
export const ssr = { toString: () => runtimeSheet.toString() } | ||
export { getThemeSheet, getRuntimeSheet, PinceauSvelteOptions, pinceauPlugin, ssr } |
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,17 +1,5 @@ | ||
import { useRuntimeSheet, useThemeSheet } from '@pinceau/runtime' | ||
const PinceauVueOptions = window.__modules__['@pinceau/outputs/vue-plugin'].PinceauVueOptions | ||
|
||
export const PinceauVueOptions = { dev: false, colorSchemeMode: 'media', computedStyles: true, variants: true, ssr: { theme: true, runtime: true }, appId: false } | ||
const PinceauVue = window.__modules__['@pinceau/outputs/vue-plugin'].PinceauVue | ||
|
||
export const PinceauVue = { | ||
install(app, options = {}) { | ||
const _options = { ...PinceauVueOptions, ...options } | ||
|
||
const themeSheet = useThemeSheet(_options) | ||
app.provide('pinceauThemeSheet', themeSheet) | ||
|
||
const runtimeSheet = useRuntimeSheet({ themeSheet, ..._options }) | ||
app.provide('pinceauRuntimeSheet', runtimeSheet) | ||
|
||
app.config.globalProperties.$pinceauSSR = { toString: () => runtimeSheet.toString() } | ||
}, | ||
} | ||
export { PinceauVueOptions, PinceauVue } |
Oops, something went wrong.