Giter Site home page Giter Site logo

Svelte Integration about emoji-mart HOT 1 OPEN

halafi avatar halafi commented on August 22, 2024 7
Svelte Integration

from emoji-mart.

Comments (1)

Tenuka22 avatar Tenuka22 commented on August 22, 2024

`<script lang="ts">
import data from '@emoji-mart/data';
import { Picker } from 'emoji-mart';
import { onMount, createEventDispatcher, onDestroy } from 'svelte';

let emojiPickerEl: HTMLElement | null = null;
let picker: any;
let mounted = false;

const dispatch = createEventDispatcher();

onMount(() => {
	if (emojiPickerEl) {
		picker = new Picker({ data });
		emojiPickerEl.appendChild(picker);
		setTimeout(() => {
			mounted = true;
		}, 1);
	}
});

onDestroy(() => {
	picker = null;
	emojiPickerEl = null;
});

</script>`

I've created the component but this gives a ton of errors

`[{
"resource": "/e:/PROJECTS/nemori/src/lib/components/emoji-mart.svelte",
"owner": "generated_diagnostic_collection_name#1",
"code": "a11y-click-events-have-key-events",
"severity": 4,
"message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as <button type="button"> or might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"source": "svelte",
"startLineNumber": 28,
"startColumn": 1,
"endLineNumber": 34,
"endColumn": 3
}]
11:39:39 AM [vite-plugin-svelte] E:/PROJECTS/nemori/src/lib/components/emoji-mart.svelte:23:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as or might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.
11:39:47 AM [vite] Error when evaluating SSR module /src/lib/components/emoji-mart.svelte: failed to import "emoji-mart"
|- SyntaxError: [vite] Named export 'Picker' not found. The requested module 'emoji-mart' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'emoji-mart';
const {Picker} = pkg;

at analyzeImportedModDifference (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:51938:15)      
at nodeImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52946:5)
at async ssrImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52800:16)
at async eval (E:/PROJECTS/nemori/src/lib/components/emoji-mart.svelte:5:31)
at async instantiateModule (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52858:5)

11:39:47 AM [vite] Error when evaluating SSR module /src/routes/(root)/_components/announcement-manage-form.svelte: failed to import "emoji-mart"
|- SyntaxError: [vite] Named export 'Picker' not found. The requested module 'emoji-mart' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'emoji-mart';
const {Picker} = pkg;

at analyzeImportedModDifference (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:51938:15)      
at nodeImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52946:5)
at async ssrImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52800:16)
at async eval (E:/PROJECTS/nemori/src/lib/components/emoji-mart.svelte:5:31)
at async instantiateModule (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52858:5)

11:39:47 AM [vite] Error when evaluating SSR module /src/routes/(root)/calendar/create/announcement/+page.svelte: failed to import "emoji-mart"
|- SyntaxError: [vite] Named export 'Picker' not found. The requested module 'emoji-mart' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'emoji-mart';
const {Picker} = pkg;

at analyzeImportedModDifference (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:51938:15)      
at nodeImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52946:5)
at async ssrImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52800:16)
at async eval (E:/PROJECTS/nemori/src/lib/components/emoji-mart.svelte:5:31)
at async instantiateModule (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52858:5)

SyntaxError: [vite] Named export 'Picker' not found. The requested module 'emoji-mart' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'emoji-mart';
const {Picker} = pkg;

at analyzeImportedModDifference (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:51938:15)      
at nodeImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52946:5)
at async ssrImport (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52800:16)
at async eval (E:/PROJECTS/nemori/src/lib/components/emoji-mart.svelte:5:31)
at async instantiateModule (file:///E:/PROJECTS/nemori/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:52858:5)

11:39:51 AM [vite] ✨ new dependencies optimized: devalue
11:39:51 AM [vite] ✨ optimized dependencies changed. reloading
11:40:17 AM [vite] ✨ new dependencies optimized: lucide-svelte
11:40:17 AM [vite] ✨ optimized dependencies changed. reloading
prerun(C-node) worker= false
Running in main thread, faking onCustomMessage
`

from emoji-mart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.