Created
June 7, 2023 19:43
-
-
Save AleksejDix/33179a6e16cd95fd6e7b771f96b02080 to your computer and use it in GitHub Desktop.
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
import { defaultConfig } from '@formkit/vue' | |
import { de, en, fr, it } from '@formkit/i18n' | |
import { generateClasses } from '@formkit/themes' | |
import { genesisIcons } from '@formkit/icons' | |
import genesis from '@formkit/themes/tailwindcss/genesis' | |
import type { FormKitClasses } from '@formkit/core' | |
import { createProPlugin, datepicker, mask } from '@formkit/pro' | |
// main.js or formkit.config.ts | |
const proPlugin = createProPlugin('KEY, { | |
datepicker, | |
mask | |
}) | |
export const formkitConfig = defaultConfig({ | |
locales: { de, fr, it, en }, | |
locale: 'en', | |
icons: { | |
...genesisIcons | |
}, | |
config: { | |
classes: generateClasses(genesis) as Record<string, FormKitClasses | string | Record<string, boolean>> | |
}, | |
plugins: [proPlugin] | |
}) |
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
<Deep-Pay></Deep-Pay> | |
<script type="module" src="/src/main.ts"></script> |
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
<script lang="ts"> | |
import App from './App.vue' | |
import { defineCustomElement, createApp, h, getCurrentInstance } from 'vue' | |
import { plugin as formkit } from '@formkit/vue' | |
import { formkitConfig } from './formkit.config' | |
import styles from './assets/style.css?inline' | |
import pro from './../node_modules/@formkit/pro/genesis.css?inline' | |
export default defineCustomElement({ | |
styles: [ | |
` | |
:host { | |
all: initial; | |
display: block; | |
} | |
`, | |
styles, | |
pro | |
], | |
setup() { | |
const app = createApp(App) | |
app.use(formkit, formkitConfig) | |
const inst = getCurrentInstance() | |
if (inst) { | |
Object.assign((inst as any).appContext, app._context) | |
Object.assign((inst as any).provides, app._context.provides) | |
} | |
}, | |
render() { | |
return h(App) | |
} | |
}) | |
</script> |
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
import DeepPay from './Main.ce.vue' | |
customElements.define('deep-pay', DeepPay) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment