{"id":15890573,"url":"https://github.com/dimfeld/svelte-rough-notation","last_synced_at":"2025-03-20T11:36:13.110Z","repository":{"id":38251563,"uuid":"267431346","full_name":"dimfeld/svelte-rough-notation","owner":"dimfeld","description":"A Svelte wrapper around the rough-notation library","archived":false,"fork":false,"pushed_at":"2024-02-26T19:34:26.000Z","size":64,"stargazers_count":40,"open_issues_count":6,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T00:11:21.187Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/svelte-rough-notation","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimfeld.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-27T21:36:42.000Z","updated_at":"2024-11-25T23:12:45.000Z","dependencies_parsed_at":"2024-10-28T00:54:13.101Z","dependency_job_id":null,"html_url":"https://github.com/dimfeld/svelte-rough-notation","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":0.06666666666666665,"last_synced_commit":"bccc62c09aad4b64224710b9aa1390cbcf7a9438"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsvelte-rough-notation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsvelte-rough-notation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsvelte-rough-notation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Fsvelte-rough-notation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimfeld","download_url":"https://codeload.github.com/dimfeld/svelte-rough-notation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244017379,"owners_count":20384324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T07:06:48.551Z","updated_at":"2025-03-20T11:36:12.776Z","avatar_url":"https://github.com/dimfeld.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a Svelte wrapper around the [rough-notation](https://github.com/rough-stuff/rough-notation) library.\n\nIt exposes both a wrapper component using a slot, and an action that can be used on a DOM element with Svelte's `use:` syntax.\n\n# Wrapper Component\n\nThe component can be toggled by setting the `visible` boolean property, or through the same `show` and `hide` API exposed by the original component. It also has properties for each configuration option exposed by rough-notation, and these can be updated after the component is created.\n\n```html\n\n\u003cscript\u003e\n  import Annotation from 'svelte-rough-notation';\n  import { onMount } from 'svelte';\n\n  let rn;\n  let visible = false;\n  onMount(() =\u003e {\n    setTimeout(() =\u003e {\n      visible = true; // or rn.visible = true or rn.show()\n    }, 1000);\n  });\n\u003c/script\u003e\n\n\u003cAnnotation bind:visible bind:this={rn} type=\"box\" padding={10}\u003eSome text\u003c/Annotation\u003e\n```\n\nAnnotation groups work as well. The `rough-notation` group implementation uses an undocumented attribute of the annotation, but this Svelte wrapper supports it, so you can just pass the component instance directly to the annotation group.\n\n```html\n\u003cscript\u003e\n  import Annotation from \"svelte-rough-notation\";\n  import { annotationGroup } from \"rough-notation\";\n  import { onMount } from \"svelte\";\n\n  let groupAnnotations = [];\n  onMount(() =\u003e {\n    ag = annotationGroup(groupAnnotations);\n  });\n\n\u003c/script\u003e\n\n\n\u003cbutton on:click={() =\u003e ag.show()}\u003eShow Group\u003c/button\u003e\nHere we have\n\u003cAnnotation bind:this={groupAnnotations[0]} type=\"underline\" color=\"red\"\u003esome important things\u003c/Annotation\u003e\nand also\n\u003cAnnotation bind:this={groupAnnotations[1]} type=\"box\" color=\"green\"\u003esome more things\u003c/Annotation\u003e\n```\n\n# Svelte Action\n\nThe action's configuration can contain all the options exposed by rough-notation, as well as a `visible` property that controls the show/hide behavior of the annotation. Updates to the configuration will be applied to the annotation.\n\nAnnotation groups are not supported with the action version of the Svelte wrapper.\n\n```html\n\n\u003cscript\u003e\n  import { annotate } from 'svelte-rough-notation';\n\u003c/script\u003e\n\n\u003cspan use:annotate={{ type: 'box', iterations: 2, visible: true }}\u003eSome text\u003c/span\u003e\n```\n\n# Example\n\nThere is a small sample app in the `site` directory of this repository, or you can check it out [in the Svelte REPL](https://svelte.dev/repl/e0346ec2945e4b3abbaceebf50163d2d?version=3.23.0)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Fsvelte-rough-notation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimfeld%2Fsvelte-rough-notation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Fsvelte-rough-notation/lists"}