### Development Server Start Source: https://github.com/michael/svedit/blob/main/README.md Command to start the development server after installing dependencies. ```bash npm run dev ``` -------------------------------- ### Svelte Component Integration Source: https://github.com/michael/svedit/blob/main/README.md Provides an example of how to use the Svedit and NodeArrayProperty components in a Svelte application to make pages editable. It shows passing the document and specifying the path for the node array. ```js ``` -------------------------------- ### SvelteKit Basic Structure Source: https://github.com/michael/svedit/blob/main/src/app.html This snippet illustrates the fundamental layout of a SvelteKit application, indicating where the head and body content are injected. It's a standard starting point for SvelteKit projects. ```svelte %sveltekit.head% %sveltekit.body% ``` -------------------------------- ### Text Selection Example Source: https://github.com/michael/svedit/blob/main/README.md Illustrates the structure of a text selection, which defines a range of characters within a string property. It includes the type, path to the property, and anchor/focus offsets. ```js { type: 'text', path: ['page_1234', 'body', 0, 'content'], anchor_offset: 1, focus_offset: 1 } ``` -------------------------------- ### Node Selection Example Source: https://github.com/michael/svedit/blob/main/README.md Shows the structure of a node selection, which spans across a range of nodes within a node array. It specifies the type, path to the array, and anchor/focus offsets for the selected nodes. ```js { type: 'node', path: ['page_1234', 'body'], anchor_offset: 2, focus_offset: 4 } ``` -------------------------------- ### Svedit Document Serialization Format Example Source: https://github.com/michael/svedit/blob/main/README.md Illustrates the JSON format used to serialize Svedit documents for editing sessions in the browser, showing an array of nodes with their IDs, types, and content references. ```js const raw_doc = [ { id: 'document_nav_item_1', type: 'document_nav_item', url: '/homepage', label: 'Home', }, { id: 'nav_1', type: 'nav', nav_items: ['document_nav_item_1'], }, { id: 'paragraph_1', content: ['Hello world.', []], }, { id: 'list_item_1', type: 'list_item', content: ['first list item', []], }, { id: 'list_item_2', type: 'list_item', content: ['second list item', []], }, { id: 'list_1', type: 'list', list_items: ['list_item_1', 'list_item_2'], }, { id: 'page_1', type: 'page', body: ['nav_1', 'paragraph_1', 'list_1'], }, ] ``` -------------------------------- ### Development and Testing Commands Source: https://github.com/michael/svedit/blob/main/CLAUDE.md Provides essential npm commands for running the development server, building for production, previewing the build, and executing unit and end-to-end tests. ```bash npm run dev npm run build npm run preview npm run test:unit npm run test:e2e npm run test ``` -------------------------------- ### Production Build Command Source: https://github.com/michael/svedit/blob/main/README.md Command to create a production-ready build of the application. ```bash npm run build ``` -------------------------------- ### Document Graph Traversal and Modification Source: https://github.com/michael/svedit/blob/main/README.md Demonstrates how to initialize a Document, retrieve nodes and their properties, and modify the document through transactions. It highlights the use of $state.snapshot for observing changes. ```js const doc = new Document(document_schema, raw_doc); // get the body (=array of node ids) const body = doc.get(['page_1', 'body']); // => ['nav_1', 'paragraph_1', 'list_1'] console.log($state.snapshot(body)); const nav = doc.get(['nav_1']) // => { id: 'nav_1', type: 'nav', nav_items: ['document_nav_item_1'] } console.log('nav.nav_items before:', $state.snapshot(nav.nav_items)); // Documents need to be changed through transactions, which can consist of one or // multiple ops that are applied in a single step and undo/redo-able. const tr = doc.tr; const new_nav_items = nav.nav_items.slice(0, -1); tr.set(['nav_1', 'nav_items'], new_nav_items); doc.apply(tr); console.log('nav.nav_items after:', $state.snapshot(nav.nav_items)); ``` -------------------------------- ### SIL Open Font License (OFL) Version 1.1 Source: https://github.com/michael/svedit/blob/main/static/fonts/OFL.txt The SIL Open Font License (OFL) Version 1.1 provides a free and open framework for font sharing and improvement. It allows for free use, study, modification, and redistribution of font software, with specific conditions regarding selling the font software by itself, bundling, reserved names, and endorsements. ```APIDOC SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. ``` -------------------------------- ### Code Style Guidelines Source: https://github.com/michael/svedit/blob/main/CLAUDE.md Enforces snake_case for custom identifiers in JavaScript/TypeScript and Svelte files, while preserving camelCase for native web platform APIs and Svelte event handlers/properties. ```javascript // Custom variables and functions should use snake_case let my_variable = 10; function my_function() { // ... } // Native APIs and Svelte event handlers retain camelCase window.getSelection(); document.activeElement; onclick={handleClick}; innerHTML; ``` -------------------------------- ### Svedit Document Schema Definition Source: https://github.com/michael/svedit/blob/main/README.md Defines the structure and types for Svedit documents, specifying properties and their expected node types for elements like pages, paragraphs, lists, and navigation. ```js const document_schema = { page: { body: { type: 'node_array', node_types: ['nav', 'paragraph', 'list'], default_node_type: 'paragraph', } }, paragraph: { content: { type: 'annotated_text' } }, list_item: { content: { type: 'annotated_string' }, }, list: { list_items: { type: 'node_array', node_types: ['list_item'], default_node_type: 'list_item', } }, nav: { nav_items: { type: 'node_array', node_types: ['nav_item'], default_node_type: 'nav_item', } }, nav_item: { url: { type: 'string' }, label: { type: 'string' }, } }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.