Giter VIP home page Giter VIP logo

svelte-parts's Introduction

svelte-parts

docs: https://svelte-parts.surge.sh

install

npm install svelte-parts

components

  • DropFile - Drop files(s) or click to browse file system
  • Form - Yet another form component
  • FormBuilder - UI to create form descriptions for Form
  • Icons - SVG icons from feather icons, maki icons and octicons
  • Map - Mapping components using leaflet
  • Markdown - Use markdown blocks in your svelte app
  • Modal - Just a modal
  • Zoom - Allow pan and zoom on images

update 2023-01-28

Now using svelte-kit to package the components. It fixes typescript errors in svelte@3. All components are now available under the same npm library: svelte-parts. The old @svelte-parts/... libraries are deprecated but still available.

The @svelte-parts/editor was using an older version of codemirror and is not ported to svelte-parts.

svelte-parts's People

Contributors

dependabot[bot] avatar idris-maps avatar stophecom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

svelte-parts's Issues

Default values for unchanged form

When a form is created from data and submitted, only changed values are evaluated and sent back to the server, for example:

"fields": [
                            {
                                "type": "text",
                                "property": "upper_line",
                                "label": "Upper Line",
                                "notRequired": true
                            },
                            {
                                "type": "text",
                                "property": "bottom_line",
                                "label": "Bottom Line",
                                "notRequired": true
                            },
                            {
                                "type": "date",
                                "property": "onair_date",
                                "label": "Date"
                            },
                            {
                                "type": "checkbox",
                                "property": "12h",
                                "label": "AM/PM",
                                "value": true
                            },
                            {
                            "type": "radio",
                            "property": "pill",
                            "label": "Choose your pill",
                            "options": [
                                "red",
                                "blue"
                            ],
                            "value": ""
                            }
                        ]

Generates the following form:
image

Pressing "submit" after setting up a date (required) produces:
image

It does not seem possible to receive all the fields with the default values instead (but it would be nice to get them)

image

Svelte says "editor is incorrectly packaged"

I'm trying to use the editor package, almost exactly as you've recommended in the readme

<script lang="ts">
  import { articles } from '$lib/store';
  import Editor from '@svelte-parts/editor';
  import 'codemirror/lib/codemirror.css';
</script>

<Editor initialValue={$articles[0].content} />

But I get the following error

@svelte-parts/editor is incorrectly packaged. Please contact the package author to fix.
7:39:52 PM [vite] Error when evaluating SSR module /node_modules/codemirror/lib/codemirror.js?v=4b019038:
ReferenceError: navigator is not defined
    at /node_modules/codemirror/lib/codemirror.js?v=4b019038:18:19
    at /node_modules/codemirror/lib/codemirror.js?v=4b019038:13:49
    at /node_modules/codemirror/lib/codemirror.js?v=4b019038:14:2
    at instantiateModule (node_modules/vite/dist/node/chunks/dep-7817f5b4.js:67424:15)

Any idea why this might be happening? Or how I can fix it?

Improvements to @svelte-parts/drop-file

Hi A***, great repo!
I just checked out drop-file - it's great. I noticed that newer svelte version complains about typescript.

Type definitions are missing for this Svelte Component. If you are using Svelte 3.31+, use SvelteComponentTyped to add a definition:
  import type { SvelteComponentTyped } from "svelte";
  class ComponentName extends SvelteComponentTyped<{propertyName: string;}> {}

Also, I was wondering if the property multiple should be optional, since it would be better aligned with the native file input. (Also I only need one file in my app :))

Let me know, I can create PR.

Form: Hook for custom field

I have a ForeignKey.svelte component which implements an autocomplete feature where an inline form facilitates the creation of a new related instance (if it does not exist).

It would be lovely to be able to include it in the json object which creates the initial form:

const fields = {}

Form fixes

  • Set default for select and radio
  • Animate choice in builder
  • Builder, number steps only allow integer
  • Builder, set default color

<Editor> is not a valid SSR component.

I tried to [https://github.com/codemirror/codemirror5/issues/5492](CodeMirror issues) disable SSR, but found that I needed to disable SSR globally.

https://kit.svelte.dev/docs#ssr-and-javascript-ssr

disable SSR a page-level ssr export don't work.

markdown.svelte

<script context="module">
  import Editor from '@svelte-parts/editor';

  export const ssr = false;
</script>

<Editor/>

error log:

<Editor> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules

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.