diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ebcdad1..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lit-html-editor/node_modules \ No newline at end of file diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e55cc34..0000000 --- a/.gitmodules +++ /dev/null @@ -1,39 +0,0 @@ -[submodule "lit-code-editor"] - path = lit-code-editor - url = https://github.com/rodydavis/lit-code-editor -[submodule "lit-vscode-extension"] - path = lit-vscode-extension - url = https://github.com/rodydavis/lit-vscode-extension -[submodule "lit-draggable-dom"] - path = lit-draggable-dom - url = https://github.com/rodydavis/lit-draggable-dom -[submodule "lit-sheet-music"] - path = lit-sheet-music - url = https://github.com/rodydavis/lit-sheet-music -[submodule "lit-html-table"] - path = lit-html-table - url = https://github.com/rodydavis/lit-html-table -[submodule "lit-html-editor"] - path = lit-html-editor - url = https://github.com/rodydavis/lit-html-editor -[submodule "figma_lit_example"] - path = figma_lit_example - url = https://github.com/rodydavis/figma_lit_example -[submodule "flutter_hybrid_template"] - path = flutter_hybrid_template - url = https://github.com/rodydavis/flutter_hybrid_template -[submodule "lit-3d-piano"] - path = lit-3d-piano - url = https://github.com/rodydavis/lit-3d-piano -[submodule "vite-rxdb-lit"] - path = vite-rxdb-lit - url = https://github.com/rodydavis/vite-rxdb-lit -[submodule "lit-native"] - path = lit-native - url = https://github.com/rodydavis/lit-native -[submodule "html-editor"] - path = html-editor - url = https://github.com/rodydavis/html-editor -[submodule "lit-node-editor"] - path = lit-node-editor - url = https://github.com/rodydavis/lit-node-editor diff --git a/README.md b/README.md index becf3e6..cd1b6ed 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,25 @@ # Lit Examples -Examples created by me and mostly used in my [blog](https://rodydavis.com). \ No newline at end of file +Consolidation of all Lit repositories directly into folders. + +## Consolidated Repositories +- [figma-to-lit](./figma-to-lit) +- [figma_lit_example](./figma_lit_example) +- [lit-3d-piano](./lit-3d-piano) +- [lit-calculator](./lit-calculator) +- [lit-code-editor](./lit-code-editor) +- [lit-draggable-dom](./lit-draggable-dom) +- [lit-file-based-routing](./lit-file-based-routing) +- [lit-force-graph](./lit-force-graph) +- [lit-html-editor](./lit-html-editor) +- [lit-html-table](./lit-html-table) +- [lit-modules](./lit-modules) +- [lit-native](./lit-native) +- [lit-node-editor](./lit-node-editor) +- [lit-sheet-music](./lit-sheet-music) +- [lit-starter-ts](./lit-starter-ts) +- [lit-vscode-extension](./lit-vscode-extension) +- [lit-wmr](./lit-wmr) +- [vite-lit-capacitor](./vite-lit-capacitor) +- [vite-lit-element-starter](./vite-lit-element-starter) +- [vite-rxdb-lit](./vite-rxdb-lit) diff --git a/figma-to-lit/.gitignore b/figma-to-lit/.gitignore new file mode 100644 index 0000000..f16fba9 --- /dev/null +++ b/figma-to-lit/.gitignore @@ -0,0 +1,8 @@ +# Node +*.log +*.log.* +node_modules + +out/ +dist/ +code.js diff --git a/figma-to-lit/LICENSE b/figma-to-lit/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/figma-to-lit/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/figma-to-lit/README.md b/figma-to-lit/README.md new file mode 100644 index 0000000..85d5c68 --- /dev/null +++ b/figma-to-lit/README.md @@ -0,0 +1,5 @@ +# Figma to Lit + +This is a example plugin for Figma DevMode that exports a component to Lit Web Components. + +There is an option to export single or multiple components. diff --git a/figma-to-lit/code.ts b/figma-to-lit/code.ts new file mode 100644 index 0000000..b4235ec --- /dev/null +++ b/figma-to-lit/code.ts @@ -0,0 +1,461 @@ +import { camelCase, paramCase, pascalCase, snakeCase } from "change-case"; +// @ts-ignore +import Mustache from 'mustache'; + +figma.codegen.on("generate", async (event) => { + const args = await createTemplate(event.node); + return [ + { + language: "TYPESCRIPT", + code: renderTemplate(args, true), + title: "Lit (TS)", + }, + { + language: "JAVASCRIPT", + code: renderTemplate(args, false), + title: "Lit (JS)", + }, + ]; +}); + +const names = new Map(); + +function uniqueName(node: SceneNode | Variable) { + for (const [key, value] of names) { + if (value.id === node.id) { + return key; + } + } + function getName() { + let target = node.name; + if (target.includes('#')) { + target = target.split('#')[0]; + } + return pascalCase(target); + } + let target = getName(); + let count = 0; + while (true) { + if (!names.has(target)) { + names.set(target, node); + break; + } + target = `${getName()}${++count}`; + } + console.log(node, target); + return target; +} + +function normalize(str: string) { + const regex = /[^\w\s\d]/g; + return str.replace(regex, ''); +} + +function className(str: string) { + // Convert raw name to PascalCase + let result = normalize(str); + if (/^\d/.test(str)) { + result = `X ${result}`; + } + if (!result.endsWith("Element")) { + result += " Element"; + } + return pascalCase(result); +} + +function tagName(str: string) { + // Convert raw name to kebab-case + let result = normalize(str.trim()); + if (/^\d/.test(str)) { + result = `x-${result}`; + } + result = paramCase(result); + if (!result.endsWith("-element")) { + result += "-element"; + } + return paramCase(result); +} + +function propertyName(str: string) { + let result = normalize(str); + if (/^\d/.test(str)) { + result = `x-${result}`; + } + return camelCase(result); +} + +const litTSTemplate = ` +import {html, css, LitElement} from 'lit'; +import {customElement, property} from 'lit/decorators.js'; + +{{#components}} +@customElement('{{tag}}') +export class {{name}} extends LitElement { + static styles = css\` + {{#styles}} + .{{selector}} { + {{#attributes}} + {{key}}: {{value}}; + {{/attributes}} + } + {{/styles}} + \`; + + {{#properties}} + @property({type: {{type}}}) {{name}} = {{value}}; + {{/properties}} + + {{#events}} + {{name}}(e: {{type}}) { + console.log('{{name}} {{type}}', e); + } + {{/events}} + + render() { + return html\` +{{#xml}}{{node}}{{/xml}} + \`; + } +} + +{{/components}} +`.trim(); + +const litJSTemplate = ` +import {html, css, LitElement} from 'lit'; + +{{#components}} +export class {{name}} extends LitElement { + static styles = css\` + {{#styles}} + .{{selector}} { + {{#attributes}} + {{key}}: {{value}}; + {{/attributes}} + } + {{/styles}} + \`; + + static properties = { + {{#properties}} + {{name}}: {type: {{type}}}, + {{/properties}} + }; + + constructor() { + super(); + {{#properties}} + this.{{name}} = {{value}}; + {{/properties}} + } + + {{#events}} + {{name}}(e: {{type}}) { + console.log('{{name}} {{type}}', e); + } + {{/events}} + + render() { + return html\` +{{#xml}}{{node}}{{/xml}} + \`; + } +} +customElements.define('{{tag}}', {{name}}); +{{/components}} +`.trim(); + +interface LitTemplate { + components: LitComponent[]; +} + +interface LitComponent { + tag: string; + name: string; + styles: LitStyle[]; + properties: LitProperty[]; + events: LitEvent[]; + node: LitNode; +} + +interface LitStyle { + selector: string; + attributes: LitStyleAttribute[]; +} + +interface LitStyleAttribute { + key: string; + value: string; +} + +interface LitEvent { + type: string; + name: string; +} + +interface LitProperty { + type: string; + name: string; + value: string; +} + +interface LitNode { + tag: string; + attributes: LitStyleAttribute[] | null; + children: LitNode[] | string[] | null; + component: boolean; + node: SceneNode, +} + +async function createTemplate(node: SceneNode): Promise { + const components: LitComponent[] = []; + + async function addComponent(target: SceneNode) { + // const globalAttrs = getNodeProperties(target, { recursive: true }); + if (isComponent(target) || target === node) { + const styles: LitStyle[] = []; + const events: LitEvent[] = []; + const properties: LitProperty[] = []; + + async function addStyle(child: SceneNode) { + if (isComponent(child) && target !== child) return; + + const css = await child.getCSSAsync(); + styles.push({ + selector: tagName(uniqueName(child)), + attributes: Object.entries(css).map((([key, value]) => ({ key, value }))) + }); + + if ('children' in child) { + for (const item of child.children) { + await addStyle(item); + } + } + } + + await addStyle(target); + + const attrs = getNodeProperties(target, { recursive: true }); + for (const [key, value] of Object.entries({ ...attrs })) { + properties.push({ + type: 'String', + name: propertyName(key), + value: typeof value === 'string' ? `'${value}'` : value, + }); + } + + function addEvents(child: SceneNode) { + if ('reactions' in child) { + const reactions = child.reactions; + for (const item of reactions) { + if (item.trigger) { + const type = item.trigger.type; + if (type === 'ON_CLICK') { + const eventName = propertyName(`${snakeCase(uniqueName(child))}-${type}`); + events.push({ + name: eventName, + type: 'Event', + }); + } + } + } + } + if ('children' in child) { + for (const item of child.children) { + if (!isComponent(item)) { + addEvents(item); + } + } + } + } + + addEvents(target); + + const component: LitComponent = { + node: nodeTree(target), + name: className(uniqueName(target)), + tag: tagName(uniqueName(target)), + styles, + events, + properties, + }; + components.push(component); + + if ('children' in target) { + for (const child of target.children) { + await addComponent(child); + } + } + } + } + + await addComponent(node); + + return { components }; +} + +function renderXml(node: LitNode) { + const sb: string[] = []; + if (node.component) { + if (node.attributes) { + sb.push(`<${node.tag} `) + for (const attr of node.attributes) { + sb.push(` ${propertyName(attr.key)}=\${this.${propertyName(attr.key)}} `) + } + sb.push(`>`) + } else { + sb.push(`<${node.tag}>`) + } + sb.push(``) + } else { + let events = false; + let element = 'div'; + if ('reactions' in node.node) { + const reactions = node.node.reactions; + events = reactions.length > 0; + for (const item of reactions) { + if (item.trigger) { + if ( + item.trigger.type === "ON_CLICK" || + item.trigger.type === "ON_HOVER" || + item.trigger.type === "ON_PRESS" || + item.trigger.type === "MOUSE_DOWN" + ) { + element = 'button'; + } + } + } + } + if (events) { + sb.push(`<${element} class="${node.tag}"`) + if ('reactions' in node.node) { + const reactions = node.node.reactions; + for (const item of reactions) { + if (item.trigger) { + const type = item.trigger.type; + if (type === 'ON_CLICK') { + const eventName = propertyName(`${snakeCase(uniqueName(node.node))}-${type}`); + sb.push(` @click=\${this.${eventName}}`); + } + } + } + } + sb.push(`>`) + } else { + sb.push(`<${element} class="${node.tag}">`) + } + if (node.children) { + for (const child of node.children) { + if (typeof child === 'string') { + let bound = false; + if (node.node.boundVariables?.characters) { + const variable = figma.variables.getVariableById(node.node.boundVariables.characters.id); + if (variable) { + sb.push(` \${this.${propertyName(uniqueName(variable))}}`); + bound = true; + } + } else if (node.node.componentPropertyReferences?.characters) { + const label = node.node.componentPropertyReferences.characters.split('#')[0]; + sb.push(` \${this.${propertyName(label)}}`); + bound = true; + } + if (!bound) sb.push(` ${child}`); + } else { + sb.push(` ${renderXml(child)}`); + } + } + } + sb.push(``) + } + return sb.join('\n'); +} + +function renderTemplate(args: LitTemplate, typescript: boolean = true) { + const template = typescript ? litTSTemplate : litJSTemplate; + Mustache.escape = function (text: string) { return text; }; + return Mustache.render(template, { + ...args, + "xml": function () { + return () => renderXml(this.node); + } + }); +} + +function getNodeProperties(node: SceneNode, options?: { + recursive?: boolean +}) { + const attributes: { [key: string]: string } = {}; + + if (node.type === 'COMPONENT') { + const properties = node.componentPropertyDefinitions; + for (const [key, value] of Object.entries(properties)) { + const label = key.split('#')[0]; + attributes[label] = `${value.defaultValue}`; + } + } + if (node.type === 'INSTANCE') { + const properties = node.componentProperties; + for (const [key, value] of Object.entries(properties)) { + const label = key.split('#')[0]; + attributes[label] = `${value.value}`; + } + } + if (node.boundVariables) { + const variables = node.boundVariables! + if (variables?.characters) { + const variable = figma.variables.getVariableById(variables.characters.id); + if (variable) { + attributes[uniqueName(variable)] = ''; + } + } + } + + const references = node.componentPropertyReferences; + if (references?.characters) { + const label = references.characters.split('#')[0]; + attributes[label] = attributes[label] ?? label; + } + + if (options?.recursive) { + if ('children' in node) { + for (const child of node.children) { + const attrs = getNodeProperties(child, { recursive: true }); + for (const [key, value] of Object.entries(attrs)) { + attributes[key] = value; + } + } + } + } + + return attributes; +} + +function nodeTree(node: SceneNode, root: boolean = true): LitNode { + const children: LitNode[] = []; + const attributes = getNodeProperties(node, { recursive: true }); + if ('children' in node) { + for (const child of node.children) { + children.push(nodeTree(child, false)); + } + } + const attrs = Object.entries(attributes).map(([key, value]) => ({ key, value })); + let str: string | null = null; + if ('characters' in node) { + str = node.characters; + } + return { + node, + tag: tagName(uniqueName(node)), + children: children.length === 0 ? (str ? [str] : null) : children, + attributes: attrs.length === 0 ? null : attrs, + component: isComponent(node) && !root, + }; +} + +function isComponent(node: SceneNode) { + return ( + node.type === "COMPONENT" || + node.type === "INSTANCE" || + node.type === 'FRAME' + ); +} diff --git a/figma-to-lit/manifest.json b/figma-to-lit/manifest.json new file mode 100644 index 0000000..1de6075 --- /dev/null +++ b/figma-to-lit/manifest.json @@ -0,0 +1,42 @@ +{ + "name": "Figma to Lit", + "id": "1253959744483104113", + "api": "1.0.0", + "main": "code.js", + "capabilities": [ + "codegen" + ], + "enableProposedApi": false, + "editorType": [ + "dev" + ], + "ui": "ui.html", + "codegenPreferences": [ + { + "itemType": "select", + "propertyName": "outputType", + "label": "Output Type", + "options": [ + { + "label": "Single Web Component", + "value": "single", "isDefault": true + }, + { + "label": "Separate Web Components", + "value": "multi" + } + ] + } + ], + "codegenLanguages": [ + { + "label": "Lit", + "value": "typescript" + } + ], + "networkAccess": { + "allowedDomains": [ + "none" + ] + } +} \ No newline at end of file diff --git a/figma-to-lit/package.json b/figma-to-lit/package.json new file mode 100644 index 0000000..2423bee --- /dev/null +++ b/figma-to-lit/package.json @@ -0,0 +1,24 @@ +{ + "name": "figma-lit-exporter", + "version": "1.0.0", + "description": "Lit (Web Component) export for Figma", + "main": "code.js", + "scripts": { + "build": "esbuild code.ts --bundle --outfile=code.js --target=ES6", + "watch": "esbuild code.ts --bundle --outfile=code.js --target=ES6 --watch" + }, + "author": "", + "license": "", + "devDependencies": { + "@figma/plugin-typings": "*", + "@types/mustache": "^4.2.2", + "esbuild": "^0.18.7", + "typescript": "*" + }, + "dependencies": { + "change-case": "^4.1.2", + "js-beautify": "^1.14.8", + "mustache": "^4.2.0", + "xml-formatter": "^3.4.1" + } +} \ No newline at end of file diff --git a/figma-to-lit/pnpm-lock.yaml b/figma-to-lit/pnpm-lock.yaml new file mode 100644 index 0000000..a9a71ab --- /dev/null +++ b/figma-to-lit/pnpm-lock.yaml @@ -0,0 +1,532 @@ +lockfileVersion: 5.4 + +specifiers: + '@figma/plugin-typings': '*' + '@types/mustache': ^4.2.2 + change-case: ^4.1.2 + esbuild: ^0.18.7 + js-beautify: ^1.14.8 + mustache: ^4.2.0 + typescript: '*' + xml-formatter: ^3.4.1 + +dependencies: + change-case: 4.1.2 + js-beautify: 1.14.8 + mustache: 4.2.0 + xml-formatter: 3.4.1 + +devDependencies: + '@figma/plugin-typings': 1.68.0 + '@types/mustache': 4.2.2 + esbuild: 0.18.9 + typescript: 5.1.3 + +packages: + + /@esbuild/android-arm/0.18.9: + resolution: {integrity: sha512-v1cr0l0RZOzIgLtTe8M1cRFFP0ICRdymPPa8HCPUpgZ+XasQrd5Mxyp9KlDqXLLyGmnZpzhufKEThLIihQL53A==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64/0.18.9: + resolution: {integrity: sha512-G1rIBpSgjv0DEFmBYjljL85l4asf1dtQYwjoD02A5YG85JV3dsQSJL94vsEMWYMWkNd46hcvz3suURuY4dr+9g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64/0.18.9: + resolution: {integrity: sha512-rPgcISGfoP7/Yk8+0eUf9R/KLCYGgqtojz/Uvj26wp7/EclwxoaOMArBnDChfuWF5YLdS16dDfqb4qwXS087lw==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64/0.18.9: + resolution: {integrity: sha512-vw9kWBT2EvDhLAVkI5c2KWFh+GMwgXrzR1QnIpZazA+tIacaelNLMMSTHEJisOeQqiMQhv8goTODFm9liS7wpw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64/0.18.9: + resolution: {integrity: sha512-tDbKKMUeS0PckRtIxdF3+NgkE19kTyLFmUQ0umgXDnBvcWC3/DqhZyu4P4Af3zBzOfWH5DAAmGW1hgy53Z706w==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64/0.18.9: + resolution: {integrity: sha512-Anyk3qeTKJUcxiLE8VQ6y6frVuqFc71M5TEc2EzvXchoy6oWn5eZK+MpZBVnENVMSDA4wOjDKiFsPtVhnrhHHA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64/0.18.9: + resolution: {integrity: sha512-BsOYio/4p/6RWG+sDQXVYet8qQ0bB91rfO0YNk5s0HlqE9vEth3Yi1jFNi4v7bUA4vQDWWoybpA/9NTz1sM88A==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm/0.18.9: + resolution: {integrity: sha512-YotJBEt9swVrEBRBIXQzI03A4kDQSWk+mbGTTBreIRvWWWTXXqhNYZgqiwnEvtyQi9aqSipEzkRzAGNqs54EXw==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64/0.18.9: + resolution: {integrity: sha512-2fJtf4KKR301FrhRNY1KIgVid2nUrZV6fzx39E+JgT3jAw2NsZYUiphR31CyH4MloyoEwgQTnskwaQH+nT4bHA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32/0.18.9: + resolution: {integrity: sha512-pTTBAGi2lrduXo4vATnqCtFi9zRbyXOlcV+euznW5EoFyjAIR+JCQgFDeFCMo343E2EI2MgV7ZQctO8IWcsdsA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64/0.18.9: + resolution: {integrity: sha512-hmsjvhwHrsCKPthXhhNjLE+QON8uQCE9P/OBktaYOD8UDfmz9+txm04uXhnkRH0fDEqStsDEedbX+8KPg1CwyA==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el/0.18.9: + resolution: {integrity: sha512-Ymv4j25ie7mVEVlcThnOlRVvqDSsj22MJBH31QGMsyA0dUwReqCg9yNqRM2Dh8QHDRO2UrMhGmiL6BaTdBWlQw==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64/0.18.9: + resolution: {integrity: sha512-y2viEHwLpNfWP1eLa+vV+DWIbw/pQyv1Vf6qxSGJeBQmmu9T2hOagMiCr6zhDo89l+MUAXiShdKmqlKI6HdCkw==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64/0.18.9: + resolution: {integrity: sha512-na8WG8Z7z1EIUcJFuXKOawJEsq8luOur7LHK/ophO0+RSE8A9yxCsKYhaN9IxlR1UciAuHjo/7d5yiflABwUmA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x/0.18.9: + resolution: {integrity: sha512-XsnaI89KstE0jG4cMdzuJ8SKcKAod26had7U/4SzvuMrci0/XyEQXB1jikn6MB7LPGrd5rcLeYp3F7psUxhkWw==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64/0.18.9: + resolution: {integrity: sha512-odEbmjtm3tLPtY43FRWOG+CLN7d4ooQpGjYVFVti5rLXLym26dORxnlbekNPXuQRuQKNMPczNNWE1jOc8yAyJQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64/0.18.9: + resolution: {integrity: sha512-j/GgOjKNUPd54isC/RBYlS6CREbulnMWAJEIKTnPM0QnY0pEGfMHkFh73bsmZdovp/97zRty0NdePRk4dTP/cw==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64/0.18.9: + resolution: {integrity: sha512-DN0Z9RGU/hlaMWSG9GaDLvlu0718u1HDGiF19wJ35fUznf9yJYgXDwZ5/cRQXUewHXJB0pD/VyQfRLDP3M4maw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64/0.18.9: + resolution: {integrity: sha512-W/eHabLCXdki/8H3jmfE/ClDuh3bQQKpYfQHGQ7lQync9W72ZdVr2y1iWfEVTE7ZK/DQROo3GyfTkx5HPBZxmQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64/0.18.9: + resolution: {integrity: sha512-84FMz3Sh1hwGk/oWy6XGIW2bGVcsqvHLjjtbwd982XoTHOvQSthhrMef0J+4ShE1ZE7VeUXHIt2Mfer+myedYw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32/0.18.9: + resolution: {integrity: sha512-/RsFTk0P13Nb+ixBVZfPdlLWKsP+he3ZLxOO/1eCsZZ2U7c/JxB053U7kURsyhhUPwiGzGVaAQAeyhGtYe8ehw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64/0.18.9: + resolution: {integrity: sha512-S+oBiO8UE1hmDJZlZJ6HZEdBBrxCGovwN66P9rle4DWVktM5fsMouYhpbtUf4WQLEy0HvcE2ZOQ2gIq8v0BkBw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@figma/plugin-typings/1.68.0: + resolution: {integrity: sha512-hT+iqf5CRRqKI7NmPdwml+Ld/mG1QM8VcZZURV2AowIy6vC3VQ2iIIT5d7ulDnQU+WzQDvaGaDAw/J5X6tQ2Ww==} + dev: true + + /@types/mustache/4.2.2: + resolution: {integrity: sha512-MUSpfpW0yZbTgjekDbH0shMYBUD+X/uJJJMm9LXN1d5yjl5lCY1vN/eWKD6D1tOtjA6206K0zcIPnUaFMurdNA==} + dev: true + + /abbrev/1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + dev: false + + /balanced-match/1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: false + + /brace-expansion/2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: false + + /camel-case/4.1.2: + resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} + dependencies: + pascal-case: 3.1.2 + tslib: 2.5.3 + dev: false + + /capital-case/1.0.4: + resolution: {integrity: sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==} + dependencies: + no-case: 3.0.4 + tslib: 2.5.3 + upper-case-first: 2.0.2 + dev: false + + /change-case/4.1.2: + resolution: {integrity: sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==} + dependencies: + camel-case: 4.1.2 + capital-case: 1.0.4 + constant-case: 3.0.4 + dot-case: 3.0.4 + header-case: 2.0.4 + no-case: 3.0.4 + param-case: 3.0.4 + pascal-case: 3.1.2 + path-case: 3.0.4 + sentence-case: 3.0.4 + snake-case: 3.0.4 + tslib: 2.5.3 + dev: false + + /commander/2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + dev: false + + /config-chain/1.1.13: + resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} + dependencies: + ini: 1.3.8 + proto-list: 1.2.4 + dev: false + + /constant-case/3.0.4: + resolution: {integrity: sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==} + dependencies: + no-case: 3.0.4 + tslib: 2.5.3 + upper-case: 2.0.2 + dev: false + + /dot-case/3.0.4: + resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} + dependencies: + no-case: 3.0.4 + tslib: 2.5.3 + dev: false + + /editorconfig/0.15.3: + resolution: {integrity: sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==} + hasBin: true + dependencies: + commander: 2.20.3 + lru-cache: 4.1.5 + semver: 5.7.1 + sigmund: 1.0.1 + dev: false + + /esbuild/0.18.9: + resolution: {integrity: sha512-rFw+7KsO3vF/imkldsCcIGnQVJ11Zq5a178SVS0N0wwFQ/alzS8owG06rivQ8FEuc66SJupdhTuYT7mnvmidLA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.18.9 + '@esbuild/android-arm64': 0.18.9 + '@esbuild/android-x64': 0.18.9 + '@esbuild/darwin-arm64': 0.18.9 + '@esbuild/darwin-x64': 0.18.9 + '@esbuild/freebsd-arm64': 0.18.9 + '@esbuild/freebsd-x64': 0.18.9 + '@esbuild/linux-arm': 0.18.9 + '@esbuild/linux-arm64': 0.18.9 + '@esbuild/linux-ia32': 0.18.9 + '@esbuild/linux-loong64': 0.18.9 + '@esbuild/linux-mips64el': 0.18.9 + '@esbuild/linux-ppc64': 0.18.9 + '@esbuild/linux-riscv64': 0.18.9 + '@esbuild/linux-s390x': 0.18.9 + '@esbuild/linux-x64': 0.18.9 + '@esbuild/netbsd-x64': 0.18.9 + '@esbuild/openbsd-x64': 0.18.9 + '@esbuild/sunos-x64': 0.18.9 + '@esbuild/win32-arm64': 0.18.9 + '@esbuild/win32-ia32': 0.18.9 + '@esbuild/win32-x64': 0.18.9 + dev: true + + /fs.realpath/1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: false + + /glob/8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + dev: false + + /header-case/2.0.4: + resolution: {integrity: sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==} + dependencies: + capital-case: 1.0.4 + tslib: 2.5.3 + dev: false + + /inflight/1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: false + + /inherits/2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: false + + /ini/1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + dev: false + + /js-beautify/1.14.8: + resolution: {integrity: sha512-4S7HFeI9YfRvRgKnEweohs0tgJj28InHVIj4Nl8Htf96Y6pHg3+tJrmo4ucAM9f7l4SHbFI3IvFAZ2a1eQPbyg==} + engines: {node: '>=12'} + hasBin: true + dependencies: + config-chain: 1.1.13 + editorconfig: 0.15.3 + glob: 8.1.0 + nopt: 6.0.0 + dev: false + + /lower-case/2.0.2: + resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} + dependencies: + tslib: 2.5.3 + dev: false + + /lru-cache/4.1.5: + resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} + dependencies: + pseudomap: 1.0.2 + yallist: 2.1.2 + dev: false + + /minimatch/5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: false + + /mustache/4.2.0: + resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==} + hasBin: true + dev: false + + /no-case/3.0.4: + resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} + dependencies: + lower-case: 2.0.2 + tslib: 2.5.3 + dev: false + + /nopt/6.0.0: + resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + hasBin: true + dependencies: + abbrev: 1.1.1 + dev: false + + /once/1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: false + + /param-case/3.0.4: + resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} + dependencies: + dot-case: 3.0.4 + tslib: 2.5.3 + dev: false + + /pascal-case/3.1.2: + resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} + dependencies: + no-case: 3.0.4 + tslib: 2.5.3 + dev: false + + /path-case/3.0.4: + resolution: {integrity: sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==} + dependencies: + dot-case: 3.0.4 + tslib: 2.5.3 + dev: false + + /proto-list/1.2.4: + resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} + dev: false + + /pseudomap/1.0.2: + resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} + dev: false + + /semver/5.7.1: + resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} + hasBin: true + dev: false + + /sentence-case/3.0.4: + resolution: {integrity: sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==} + dependencies: + no-case: 3.0.4 + tslib: 2.5.3 + upper-case-first: 2.0.2 + dev: false + + /sigmund/1.0.1: + resolution: {integrity: sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g==} + dev: false + + /snake-case/3.0.4: + resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} + dependencies: + dot-case: 3.0.4 + tslib: 2.5.3 + dev: false + + /tslib/2.5.3: + resolution: {integrity: sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==} + dev: false + + /typescript/5.1.3: + resolution: {integrity: sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /upper-case-first/2.0.2: + resolution: {integrity: sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==} + dependencies: + tslib: 2.5.3 + dev: false + + /upper-case/2.0.2: + resolution: {integrity: sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==} + dependencies: + tslib: 2.5.3 + dev: false + + /wrappy/1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: false + + /xml-formatter/3.4.1: + resolution: {integrity: sha512-C7VwnZpz662mZlKtrdREucsABAIlmdph/nMEUszTMsRAGGPMSNfyNOU4UaPBqxXYVadb9uSpc1Xibbj6XpbGRA==} + engines: {node: '>= 14'} + dependencies: + xml-parser-xo: 4.1.0 + dev: false + + /xml-parser-xo/4.1.0: + resolution: {integrity: sha512-9mQMLmq8J++XlQH9WF57oQxFVbR3YM6dPPtTuV+++aMe2gRoRU/kj819/6IptUmfhC1d2DSFiYxEcpkoLabeJw==} + engines: {node: '>= 14'} + dev: false + + /yallist/2.1.2: + resolution: {integrity: sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==} + dev: false diff --git a/figma-to-lit/tsconfig.json b/figma-to-lit/tsconfig.json new file mode 100644 index 0000000..de8f042 --- /dev/null +++ b/figma-to-lit/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "es6", + "lib": ["es2017"], + "strict": true, + "moduleResolution": "node", + "typeRoots": [ + "./node_modules/@types", + "./node_modules/@figma" + ] + } +} diff --git a/figma-to-lit/ui.html b/figma-to-lit/ui.html new file mode 100644 index 0000000..e69de29 diff --git a/figma_lit_example b/figma_lit_example deleted file mode 160000 index 9513698..0000000 --- a/figma_lit_example +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 95136985ffafb4eebf551d0a294c405f7c202b0b diff --git a/figma_lit_example/.gitignore b/figma_lit_example/.gitignore new file mode 100644 index 0000000..b949553 --- /dev/null +++ b/figma_lit_example/.gitignore @@ -0,0 +1,7 @@ +lit-plugin +lib +dist +build +node_modules +.vscode +package-lock.json \ No newline at end of file diff --git a/figma_lit_example/LICENSE b/figma_lit_example/LICENSE new file mode 100644 index 0000000..9a94a22 --- /dev/null +++ b/figma_lit_example/LICENSE @@ -0,0 +1,43 @@ +Apache License, Version 2.0 +SPDX short identifier: Apache-2.0 +Further resources on the Apache License, Version 2.0 +  +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +1. Definitions. +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. +6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +END OF TERMS AND CONDITIONS +APPENDIX: How to apply the Apache License to your work +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. \ No newline at end of file diff --git a/figma_lit_example/README.md b/figma_lit_example/README.md new file mode 100644 index 0000000..ab6de39 --- /dev/null +++ b/figma_lit_example/README.md @@ -0,0 +1,10 @@ +# Figma + Lit Example + +Example of how on build a Figma plugin with Lit. + +Blog post: https://rodydavis.com/posts/figma-and-lit/ + +It also includes an example on how to call WASM! + +Learn more about figma plugins: +https://www.figma.com/plugin-docs/setup/ diff --git a/figma_lit_example/asconfig.json b/figma_lit_example/asconfig.json new file mode 100644 index 0000000..6405405 --- /dev/null +++ b/figma_lit_example/asconfig.json @@ -0,0 +1,20 @@ +{ + "targets": { + "debug": { + "binaryFile": "build/untouched.wasm", + "textFile": "build/untouched.wat", + "sourceMap": true, + "debug": true + }, + "release": { + "binaryFile": "build/optimized.wasm", + "textFile": "build/optimized.wat", + "sourceMap": true, + "optimizeLevel": 3, + "shrinkLevel": 1, + "converge": false, + "noAssert": false + } + }, + "options": {} +} \ No newline at end of file diff --git a/figma_lit_example/assembly/index.ts b/figma_lit_example/assembly/index.ts new file mode 100644 index 0000000..66a9aaf --- /dev/null +++ b/figma_lit_example/assembly/index.ts @@ -0,0 +1,5 @@ +// The entry file of your WebAssembly module. + +export function add(a: i32, b: i32): i32 { + return a + b; +} diff --git a/figma_lit_example/assembly/tsconfig.json b/figma_lit_example/assembly/tsconfig.json new file mode 100644 index 0000000..e28fcf2 --- /dev/null +++ b/figma_lit_example/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "assemblyscript/std/assembly.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/figma_lit_example/index.js b/figma_lit_example/index.js new file mode 100644 index 0000000..04bc346 --- /dev/null +++ b/figma_lit_example/index.js @@ -0,0 +1,5 @@ +const fs = require("fs"); +const loader = require("@assemblyscript/loader"); +const imports = { /* imports go here */ }; +const wasmModule = loader.instantiateSync(fs.readFileSync(__dirname + "/build/optimized.wasm"), imports); +module.exports = wasmModule.exports; diff --git a/figma_lit_example/manifest.json b/figma_lit_example/manifest.json new file mode 100644 index 0000000..1bc87e1 --- /dev/null +++ b/figma_lit_example/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "figma_lit_example", + "id": "973668777853442323", + "api": "1.0.0", + "main": "code.js", + "ui": "ui.html" +} \ No newline at end of file diff --git a/figma_lit_example/package.json b/figma_lit_example/package.json new file mode 100644 index 0000000..bce8188 --- /dev/null +++ b/figma_lit_example/package.json @@ -0,0 +1,39 @@ +{ + "name": "figma_lit_example", + "version": "1.0.0", + "description": "Lit Figma Plugin", + "dependencies": { + "@assemblyscript/loader": "^0.19.3", + "lit": "*" + }, + "devDependencies": { + "@figma/plugin-typings": "^1.23.0", + "assemblyscript": "^0.19.3", + "css-loader": "^5.2.4", + "html-webpack-inline-source-plugin": "^1.0.0-beta.2", + "html-webpack-plugin": "^4.3.0", + "js-inline-wasm": "0.0.7", + "ts-loader": "^8.0.0", + "typescript": "^4.2.4", + "url-loader": "^4.1.1", + "webpack": "^4.44.1", + "webpack-cli": "^4.6.0" + }, + "scripts": { + "dev": "npx webpack --mode=development --watch", + "copy": "mkdir -p lit-plugin && cp ./manifest.json ./lit-plugin/manifest.json && cp ./dist/ui.html ./lit-plugin/ui.html && cp ./dist/code.js ./lit-plugin/code.js", + "build": "npx webpack --mode=production && npm run copy", + "zip": "npm run build && zip -r lit-plugin.zip lit-plugin", + "asbuild:untouched": "asc assembly/index.ts --target debug", + "asbuild:optimized": "asc assembly/index.ts --target release", + "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", + "inlinewasm": "inlinewasm build/optimized.wasm --output src/wasm.ts", + "test": "node tests" + }, + "browserslist": [ + "last 1 Chrome versions" + ], + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/figma_lit_example/src/code.ts b/figma_lit_example/src/code.ts new file mode 100644 index 0000000..6a2994d --- /dev/null +++ b/figma_lit_example/src/code.ts @@ -0,0 +1,27 @@ +const options: ShowUIOptions = { + width: 250, + height: 200, +}; + +figma.showUI(__html__, options); + +figma.ui.onmessage = msg => { + switch (msg.type) { + case 'create-rectangles': + const nodes: SceneNode[] = []; + for (let i = 0; i < msg.count; i++) { + const rect = figma.createRectangle(); + rect.x = i * 150; + rect.fills = [{ type: 'SOLID', color: { r: 1, g: 0.5, b: 0 } }]; + figma.currentPage.appendChild(rect); + nodes.push(rect); + } + figma.currentPage.selection = nodes; + figma.viewport.scrollAndZoomIntoView(nodes); + break; + default: + break; + } + + figma.closePlugin(); +}; diff --git a/figma_lit_example/src/my-app.ts b/figma_lit_example/src/my-app.ts new file mode 100644 index 0000000..58247aa --- /dev/null +++ b/figma_lit_example/src/my-app.ts @@ -0,0 +1,34 @@ +import { html, LitElement } from "lit"; +import { customElement, property, query } from "lit/decorators.js"; + +@customElement("my-app") +export class MyApp extends LitElement { + @property() amount = "5"; // <-- Pass in a value for the number of rectangles to create + @query("#count") countInput!: HTMLInputElement; + + render() { + return html` +
+

Rectangle Creator

+ +

Count:

+ + +
+ `; + } + + create() { + const count = parseInt(this.countInput.value, 10); + this.sendMessage("create-rectangles", { count }); + } + + cancel() { + this.sendMessage("cancel"); + } + + private sendMessage(type: string, content: Object = {}) { + const message = { pluginMessage: { type: type, ...content } }; + parent.postMessage(message, "*"); + } +} diff --git a/figma_lit_example/src/ui.ts b/figma_lit_example/src/ui.ts new file mode 100644 index 0000000..b20170e --- /dev/null +++ b/figma_lit_example/src/ui.ts @@ -0,0 +1,11 @@ +import "./my-app"; + +import wasm from "./wasm"; // <-- Our WASM file to load + +WebAssembly.instantiateStreaming(wasm as Promise).then((obj) => { + // @ts-ignore + const value: number = obj.instance.exports.add(2, 4); + console.log("return from wasm", value); + const elem = document.querySelector("my-app")! as HTMLElement; + elem.setAttribute("amount", `${value}`); +}); diff --git a/figma_lit_example/src/wasm.ts b/figma_lit_example/src/wasm.ts new file mode 100644 index 0000000..e12114c --- /dev/null +++ b/figma_lit_example/src/wasm.ts @@ -0,0 +1,10 @@ +const encoded = 'AGFzbQEAAAABBwFgAn9/AX8DAgEABQMBAAAHEAIDYWRkAAAGbWVtb3J5AgAKCQEHACAAIAFqCwAmEHNvdXJjZU1hcHBpbmdVUkwULi9vcHRpbWl6ZWQud2FzbS5tYXA='; +export default new Promise(resolve => { + const decoded = atob(encoded); + const len = decoded.length; + const bytes = new Uint8Array(len); + for (var i = 0; i < len; i++) { + bytes[i] = decoded.charCodeAt(i); + } + resolve(new Response(bytes, { status: 200, headers: { "Content-Type": "application/wasm" } })); +}); diff --git a/figma_lit_example/tests/index.js b/figma_lit_example/tests/index.js new file mode 100644 index 0000000..670df4e --- /dev/null +++ b/figma_lit_example/tests/index.js @@ -0,0 +1,4 @@ +const assert = require("assert"); +const myModule = require(".."); +assert.strictEqual(myModule.add(1, 2), 3); +console.log("ok"); diff --git a/figma_lit_example/tsconfig.json b/figma_lit_example/tsconfig.json new file mode 100644 index 0000000..7539ac5 --- /dev/null +++ b/figma_lit_example/tsconfig.json @@ -0,0 +1,51 @@ +{ + "compilerOptions": { + "target": "es2017", + "module": "esNext", + "moduleResolution": "node", + "lib": ["es2017", "dom", "dom.iterable"], + "typeRoots": ["./node_modules/@types", "./node_modules/@figma"], + "declaration": true, + "sourceMap": true, + "inlineSources": true, + "noUnusedLocals": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "experimentalDecorators": true, + "skipLibCheck": true, + "strict": true, + "noImplicitAny": false, + "outDir": "./lib", + "baseUrl": "./packages", + "importHelpers": true, + "plugins": [ + { + "name": "ts-lit-plugin", + "rules": { + "no-unknown-tag-name": "error", + "no-unclosed-tag": "error", + "no-unknown-property": "error", + "no-unintended-mixed-binding": "error", + "no-invalid-boolean-binding": "error", + "no-expressionless-property-binding": "error", + "no-noncallable-event-binding": "error", + "no-boolean-in-attribute-binding": "error", + "no-complex-attribute-binding": "error", + "no-nullable-attribute-binding": "error", + "no-incompatible-type-binding": "error", + "no-invalid-directive-binding": "error", + "no-incompatible-property-type": "error", + "no-unknown-property-converter": "error", + "no-invalid-attribute-name": "error", + "no-invalid-tag-name": "error", + "no-unknown-attribute": "off", + "no-unknown-event": "off", + "no-unknown-slot": "off", + "no-invalid-css": "off" + } + } + ] + }, + "include": ["src/**/*.ts"], + "references": [] +} diff --git a/figma_lit_example/ui.html b/figma_lit_example/ui.html new file mode 100644 index 0000000..0fa29e1 --- /dev/null +++ b/figma_lit_example/ui.html @@ -0,0 +1 @@ + diff --git a/figma_lit_example/webpack.config.js b/figma_lit_example/webpack.config.js new file mode 100644 index 0000000..4257d6e --- /dev/null +++ b/figma_lit_example/webpack.config.js @@ -0,0 +1,35 @@ +const HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const path = require("path"); + +module.exports = (env, argv) => ({ + mode: argv.mode === "production" ? "production" : "development", + devtool: argv.mode === "production" ? false : "inline-source-map", + entry: { + ui: "./src/ui.ts", + code: "./src/code.ts", + app: "./src/my-app.ts", + }, + module: { + rules: [ + { test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/ }, + { test: /\.css$/, use: ["style-loader", { loader: "css-loader" }] }, + { test: /\.(png|jpg|gif|webp|svg)$/, loader: "url-loader" }, + ], + }, + resolve: { extensions: [".ts", ".js"] }, + output: { + filename: "[name].js", + path: path.resolve(__dirname, "dist"), + }, + plugins: [ + new HtmlWebpackPlugin({ + template: path.resolve(__dirname, "ui.html"), + filename: "ui.html", + inject: true, + inlineSource: ".(js|css)$", + chunks: ["ui"], + }), + new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin), + ], +}); diff --git a/flutter_hybrid_template b/flutter_hybrid_template deleted file mode 160000 index 7d86185..0000000 --- a/flutter_hybrid_template +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7d86185f50dd43c484d400e7b341d429b8915e3c diff --git a/html-editor b/html-editor deleted file mode 160000 index 226ada8..0000000 --- a/html-editor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 226ada8eeacc4ff814132fa9df1777261b85cf36 diff --git a/lit-3d-piano b/lit-3d-piano deleted file mode 160000 index 240c9d6..0000000 --- a/lit-3d-piano +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 240c9d633a5e66cfb814f53b7ccbd5ffced2bdc6 diff --git a/lit-3d-piano/.github/workflows/ci.yml b/lit-3d-piano/.github/workflows/ci.yml new file mode 100644 index 0000000..d71d029 --- /dev/null +++ b/lit-3d-piano/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Demo + +on: + push: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist diff --git a/lit-3d-piano/.gitignore b/lit-3d-piano/.gitignore new file mode 100644 index 0000000..759ef53 --- /dev/null +++ b/lit-3d-piano/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +types +*.local diff --git a/lit-3d-piano/LICENSE b/lit-3d-piano/LICENSE new file mode 100644 index 0000000..396a87f --- /dev/null +++ b/lit-3d-piano/LICENSE @@ -0,0 +1,43 @@ +Apache License, Version 2.0 +SPDX short identifier: Apache-2.0 +Further resources on the Apache License, Version 2.0 + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +1. Definitions. +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. +6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +END OF TERMS AND CONDITIONS +APPENDIX: How to apply the Apache License to your work +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. \ No newline at end of file diff --git a/lit-3d-piano/README.md b/lit-3d-piano/README.md new file mode 100644 index 0000000..b4617ff --- /dev/null +++ b/lit-3d-piano/README.md @@ -0,0 +1,9 @@ +# 3D Piano + +[![Demo](https://github.com/rodydavis/lit-3d-piano/actions/workflows/ci.yml/badge.svg)](https://github.com/rodydavis/lit-3d-piano/actions/workflows/ci.yml) + +3D Piano built with Lit, Three.js and Tone.js + +Online demo [here](https://rodydavis.github.io/lit-3d-piano/). + +![](/screenshot.png) \ No newline at end of file diff --git a/lit-3d-piano/index.html b/lit-3d-piano/index.html new file mode 100644 index 0000000..61168b4 --- /dev/null +++ b/lit-3d-piano/index.html @@ -0,0 +1,31 @@ + + + + + + + 3D Piano + + + + + + + diff --git a/lit-3d-piano/package-lock.json b/lit-3d-piano/package-lock.json new file mode 100644 index 0000000..cf42b91 --- /dev/null +++ b/lit-3d-piano/package-lock.json @@ -0,0 +1,509 @@ +{ + "name": "lit-3d-piano", + "version": "0.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "version": "0.0.0", + "dependencies": { + "lit": "*", + "three": "^0.130.1", + "tone": "^14.7.77" + }, + "devDependencies": { + "@types/node": "^16.3.0", + "@types/three": "^0.130.0", + "typescript": "^4.3.2", + "vite": "^2.4.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@lit/reactive-element": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.0.0-rc.2.tgz", + "integrity": "sha512-cujeIl5Ei8FC7UHf4/4Q3bRJOtdTe1vpJV/JEBYCggedmQ+2P8A2oz7eE+Vxi6OJ4nc0X+KZxXnBoH4QrEbmEQ==" + }, + "node_modules/@types/node": { + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.0.tgz", + "integrity": "sha512-OydMCocGMGqw/1BnWbhtK+AtwyWTOigtrQlRe57OQmTNcI3HKlVI5FGlh+c4mSqInMPLynFrTlYjfajPu9O/eQ==", + "dev": true + }, + "node_modules/@types/three": { + "version": "0.130.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.130.0.tgz", + "integrity": "sha512-7MKKxlEjHoAGTBRxEcDOjO4OvOrvUM6xtyjPiubNcU6bRPNmjNaV/PI9tiaXkk8cauZ9FuRbdCV4g0rQod+FkQ==", + "dev": true + }, + "node_modules/@types/trusted-types": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz", + "integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==" + }, + "node_modules/automation-events": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.3.tgz", + "integrity": "sha512-FVIO4QTVi4u4ORRMszcXhoUj1U8rtgIVCbMKgw1i/zlcbEn1MICbhfquDJiA1QZgh0KysUGuxrn2JeloH04drQ==", + "dependencies": { + "@babel/runtime": "^7.14.6", + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=12.20.1" + } + }, + "node_modules/colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.12.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.15.tgz", + "integrity": "sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/lit": { + "version": "2.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.0.0-rc.2.tgz", + "integrity": "sha512-BOCuoJR04WaTV8UqTKk09cNcQA10Aq2LCcBOiHuF7TzWH5RNDsbCBP5QM9sLBSotGTXbDug/gFO08jq6TbyEtw==", + "dependencies": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-element": "^3.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + } + }, + "node_modules/lit/node_modules/lit-element": { + "version": "3.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.0.0-rc.2.tgz", + "integrity": "sha512-2Z7DabJ3b5K+p5073vFjMODoaWqy5PIaI4y6ADKm+fCGc8OnX9fU9dMoUEBZjFpd/bEFR9PBp050tUtBnT9XTQ==", + "dependencies": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + } + }, + "node_modules/lit/node_modules/lit-html": { + "version": "2.0.0-rc.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0-rc.3.tgz", + "integrity": "sha512-Y6P8LlAyQuqvzq6l/Nc4z5/P5M/rVLYKQIRxcNwSuGajK0g4kbcBFQqZmgvqKG+ak+dHZjfm2HUw9TF5N/pkCw==", + "dependencies": { + "@types/trusted-types": "^1.0.1" + } + }, + "node_modules/nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz", + "integrity": "sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA==", + "dev": true, + "dependencies": { + "colorette": "^1.2.2", + "nanoid": "^3.1.23", + "source-map-js": "^0.6.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==" + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.52.8", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.8.tgz", + "integrity": "sha512-IjAB0C6KK5/lvqzJWAzsvOik+jV5Bt907QdkQ/gDP4j+R9KYNI1tjqdxiPitGPVrWC21Mf/ucXgowUjN/VemaQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/standardized-audio-context": { + "version": "25.2.9", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.2.9.tgz", + "integrity": "sha512-8xRl8Cqv3j8UZdRvAYhgqSpVRntjxUBxute+9Zg8zeXTr+aRfDgbAu5FHzTLpUlu8uAJ9232CdOOMkTceSNAWA==", + "dependencies": { + "@babel/runtime": "^7.14.6", + "automation-events": "^4.0.3", + "tslib": "^2.3.0" + } + }, + "node_modules/three": { + "version": "0.130.1", + "resolved": "https://registry.npmjs.org/three/-/three-0.130.1.tgz", + "integrity": "sha512-OSPPKcGvFSiGkG3jFrwwC76PBV/ZSrGxpBbg28bW8s9GU8r/y2spNGtEXHEb/CVqo0Ctf5Lx2rVaxQZB6OasaA==" + }, + "node_modules/tone": { + "version": "14.7.77", + "resolved": "https://registry.npmjs.org/tone/-/tone-14.7.77.tgz", + "integrity": "sha512-tCfK73IkLHyzoKUvGq47gyDyxiKLFvKiVCOobynGgBB9Dl0NkxTM2p+eRJXyCYrjJwy9Y0XCMqD3uOYsYt2Fdg==", + "dependencies": { + "standardized-audio-context": "^25.1.8", + "tslib": "^2.0.1" + } + }, + "node_modules/tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + }, + "node_modules/typescript": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", + "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/vite": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.4.1.tgz", + "integrity": "sha512-4BpKRis9uxIqPfIEcJ18LTBsamqnDFxTx45CXwagHjNltHa6PFEvf8Pe6OpgIHb0OyWT30OXOSSQvdOaX4OBiQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.12.8", + "postcss": "^8.3.5", + "resolve": "^1.20.0", + "rollup": "^2.38.5" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": ">=12.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + } + }, + "dependencies": { + "@babel/runtime": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz", + "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@lit/reactive-element": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.0.0-rc.2.tgz", + "integrity": "sha512-cujeIl5Ei8FC7UHf4/4Q3bRJOtdTe1vpJV/JEBYCggedmQ+2P8A2oz7eE+Vxi6OJ4nc0X+KZxXnBoH4QrEbmEQ==" + }, + "@types/node": { + "version": "16.3.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.0.tgz", + "integrity": "sha512-OydMCocGMGqw/1BnWbhtK+AtwyWTOigtrQlRe57OQmTNcI3HKlVI5FGlh+c4mSqInMPLynFrTlYjfajPu9O/eQ==", + "dev": true + }, + "@types/three": { + "version": "0.130.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.130.0.tgz", + "integrity": "sha512-7MKKxlEjHoAGTBRxEcDOjO4OvOrvUM6xtyjPiubNcU6bRPNmjNaV/PI9tiaXkk8cauZ9FuRbdCV4g0rQod+FkQ==", + "dev": true + }, + "@types/trusted-types": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz", + "integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==" + }, + "automation-events": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/automation-events/-/automation-events-4.0.3.tgz", + "integrity": "sha512-FVIO4QTVi4u4ORRMszcXhoUj1U8rtgIVCbMKgw1i/zlcbEn1MICbhfquDJiA1QZgh0KysUGuxrn2JeloH04drQ==", + "requires": { + "@babel/runtime": "^7.14.6", + "tslib": "^2.3.0" + } + }, + "colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "dev": true + }, + "esbuild": { + "version": "0.12.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.15.tgz", + "integrity": "sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "lit": { + "version": "2.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.0.0-rc.2.tgz", + "integrity": "sha512-BOCuoJR04WaTV8UqTKk09cNcQA10Aq2LCcBOiHuF7TzWH5RNDsbCBP5QM9sLBSotGTXbDug/gFO08jq6TbyEtw==", + "requires": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-element": "^3.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + }, + "dependencies": { + "lit-element": { + "version": "3.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.0.0-rc.2.tgz", + "integrity": "sha512-2Z7DabJ3b5K+p5073vFjMODoaWqy5PIaI4y6ADKm+fCGc8OnX9fU9dMoUEBZjFpd/bEFR9PBp050tUtBnT9XTQ==", + "requires": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + } + }, + "lit-html": { + "version": "2.0.0-rc.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0-rc.3.tgz", + "integrity": "sha512-Y6P8LlAyQuqvzq6l/Nc4z5/P5M/rVLYKQIRxcNwSuGajK0g4kbcBFQqZmgvqKG+ak+dHZjfm2HUw9TF5N/pkCw==", + "requires": { + "@types/trusted-types": "^1.0.1" + } + } + } + }, + "nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "postcss": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz", + "integrity": "sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA==", + "dev": true, + "requires": { + "colorette": "^1.2.2", + "nanoid": "^3.1.23", + "source-map-js": "^0.6.2" + } + }, + "regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==" + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.52.8", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.8.tgz", + "integrity": "sha512-IjAB0C6KK5/lvqzJWAzsvOik+jV5Bt907QdkQ/gDP4j+R9KYNI1tjqdxiPitGPVrWC21Mf/ucXgowUjN/VemaQ==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "dev": true + }, + "standardized-audio-context": { + "version": "25.2.9", + "resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.2.9.tgz", + "integrity": "sha512-8xRl8Cqv3j8UZdRvAYhgqSpVRntjxUBxute+9Zg8zeXTr+aRfDgbAu5FHzTLpUlu8uAJ9232CdOOMkTceSNAWA==", + "requires": { + "@babel/runtime": "^7.14.6", + "automation-events": "^4.0.3", + "tslib": "^2.3.0" + } + }, + "three": { + "version": "0.130.1", + "resolved": "https://registry.npmjs.org/three/-/three-0.130.1.tgz", + "integrity": "sha512-OSPPKcGvFSiGkG3jFrwwC76PBV/ZSrGxpBbg28bW8s9GU8r/y2spNGtEXHEb/CVqo0Ctf5Lx2rVaxQZB6OasaA==" + }, + "tone": { + "version": "14.7.77", + "resolved": "https://registry.npmjs.org/tone/-/tone-14.7.77.tgz", + "integrity": "sha512-tCfK73IkLHyzoKUvGq47gyDyxiKLFvKiVCOobynGgBB9Dl0NkxTM2p+eRJXyCYrjJwy9Y0XCMqD3uOYsYt2Fdg==", + "requires": { + "standardized-audio-context": "^25.1.8", + "tslib": "^2.0.1" + } + }, + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + }, + "typescript": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", + "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "dev": true + }, + "vite": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.4.1.tgz", + "integrity": "sha512-4BpKRis9uxIqPfIEcJ18LTBsamqnDFxTx45CXwagHjNltHa6PFEvf8Pe6OpgIHb0OyWT30OXOSSQvdOaX4OBiQ==", + "dev": true, + "requires": { + "esbuild": "^0.12.8", + "fsevents": "~2.3.2", + "postcss": "^8.3.5", + "resolve": "^1.20.0", + "rollup": "^2.38.5" + } + } + } +} diff --git a/lit-3d-piano/package.json b/lit-3d-piano/package.json new file mode 100644 index 0000000..3d7d01d --- /dev/null +++ b/lit-3d-piano/package.json @@ -0,0 +1,18 @@ +{ + "name": "lit-3d-piano", + "scripts": { + "dev": "vite", + "build": "tsc && vite build" + }, + "dependencies": { + "lit": "*", + "three": "^0.130.1", + "tone": "^14.7.77" + }, + "devDependencies": { + "@types/node": "^16.3.0", + "@types/three": "^0.130.0", + "typescript": "^4.3.2", + "vite": "^2.4.0" + } +} diff --git a/lit-3d-piano/screenshot.png b/lit-3d-piano/screenshot.png new file mode 100644 index 0000000..3240ba2 Binary files /dev/null and b/lit-3d-piano/screenshot.png differ diff --git a/lit-3d-piano/src/favicon.svg b/lit-3d-piano/src/favicon.svg new file mode 100644 index 0000000..de4aedd --- /dev/null +++ b/lit-3d-piano/src/favicon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/lit-3d-piano/src/piano-component.ts b/lit-3d-piano/src/piano-component.ts new file mode 100644 index 0000000..b0ea6d0 --- /dev/null +++ b/lit-3d-piano/src/piano-component.ts @@ -0,0 +1,297 @@ +import { html, css, LitElement } from "lit"; +import { customElement, query, state } from "lit/decorators.js"; +import * as THREE from "three"; +import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"; +import * as Tone from "tone"; + +@customElement("piano-component") +export class PianoComponent extends LitElement { + @query("canvas") canvas!: HTMLCanvasElement; + @state() octave = 2; + @state() note = ""; + synth = new Tone.PolySynth().toDestination(); + raycaster = new THREE.Raycaster(); + scene = new THREE.Scene(); + camera = new THREE.PerspectiveCamera( + 70, + window.innerWidth / window.innerHeight, + 0.001, + 10 + ); + renderer?: THREE.WebGLRenderer; + controls?: OrbitControls; + + public get context(): CanvasRenderingContext2D { + const ctx = this.canvas.getContext("2d")!; + ctx.imageSmoothingEnabled = true; + return ctx; + } + + static styles = css` + main { + width: 100%; + height: 100vh; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + } + canvas { + width: 100%; + height: 100%; + z-index: 0; + } + .controls { + z-index: 1; + position: fixed; + color: white; + font-size: 18px; + right: 10px; + top: 10px; + } + .note { + z-index: 1; + position: fixed; + color: white; + font-size: 18px; + left: 10px; + top: 10px; + } + `; + + render() { + const tapNote = (x: number, y: number) => { + const dx = (x / window.innerWidth) * 2 - 1; + const dy = -(y / window.innerHeight) * 2 + 1; + this.findNote(new THREE.Vector2(dx, dy)); + }; + return html`
+ { + e.preventDefault(); + for (const touch of e.touches) { + tapNote(touch.clientX, touch.clientY); + } + }} + @touchmove=${(e: any) => (e.preventDefault())} + @touchcancel=${() => (this.onKeyUp())} + @touchend=${() => (this.onKeyUp())} + @mousedown=${(e: any) => { + e.preventDefault(); + tapNote(e.clientX, e.clientY); + }} + @mouseup=${() => (this.onKeyUp())} + > +
+ OCTAVE: ${octaves[this.octave]} + + +
+
NOTE: ${this.note}
+
`; + } + + onKeyUp = () => {}; + + findNote(mouse: THREE.Vector2) { + this.raycaster.setFromCamera(mouse, this.camera); + const intersects = this.raycaster.intersectObjects( + this.scene.children, + true + ); + const obj = intersects.length > 0 ? intersects[0] : null; + if (obj?.object?.userData) { + if (obj.object instanceof THREE.Mesh) { + obj.object.material.color.set("gray"); + const { note } = obj.object.userData; + this.playNote(note, (color) => { + // @ts-ignore + obj?.object?.material.color.set(color); + }); + } + } + } + + playNote(note: string, update: (color: string) => void) { + this.note = note; + const color = note.includes("#") ? "black" : "white"; + this.synth.triggerAttackRelease(note, "8n"); + this.onKeyUp = () => { + update(color); + }; + } + + findNode( + note: string, + nodes: THREE.Object3D[] + ): THREE.Mesh | null { + for (const node of nodes) { + if (node instanceof THREE.Mesh) { + return node; + } + if (node instanceof THREE.Group) { + const child = this.findNode(note, node.children); + if (child) return child; + } + } + return null; + } + + noteMap: any = { + C: "C#", + D: "D#", + F: "F#", + G: "G#", + A: "A#", + }; + + buildPiano() { + const group = new THREE.Group(); + for (let i = 0; i < octaves.length; i++) { + const node = this.buildOctave(i, octaves[i]); + group.add(node); + } + group.position.x -= 2.5; + this.scene.add(group); + } + + buildOctave(offset: number, octave: number) { + const group = new THREE.Group(); + for (let i = 0; i < notes.length; i++) { + const key = `${notes[i]}${octave}` as any; + const note = this.buildPianoKey(i * 0.2, key); + if (Object.keys(this.noteMap).includes(notes[i])) { + const note = `${this.noteMap[notes[i]]}${octave}`; + const accidental = this.buildAccidental(i * 0.2, note as any); + accidental.castShadow = true; + accidental.receiveShadow = false; + group.add(accidental); + } + note.castShadow = true; + note.receiveShadow = false; + group.add(note); + } + group.position.x += 1.4 * offset; + return group; + } + + keyOptions = { + depth: 0.1, + width: 0.2, + height: 0.4, + }; + + buildPianoKey(offset: number, note: NoteName) { + const geometry = new THREE.BoxGeometry( + this.keyOptions.width * 0.8, + this.keyOptions.height, + this.keyOptions.depth + ); + const material = new THREE.MeshStandardMaterial({ color: "white" }); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x += offset; + mesh.userData["note"] = note; + return mesh; + } + + buildAccidental(offset: number, note: NoteName) { + const geometry = new THREE.BoxGeometry( + this.keyOptions.width * 0.8, + this.keyOptions.height * 0.6, + this.keyOptions.depth + ); + const material = new THREE.MeshStandardMaterial({ color: "black" }); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x += offset + 0.1; + mesh.position.y += 0.08; + mesh.position.z += 0.1; + mesh.userData["note"] = note; + return mesh; + } + + paint() { + this.renderer!.render(this.scene, this.camera); + this.controls!.update(); + } + + firstUpdated() { + this.camera.position.z = 1; + this.renderer = new THREE.WebGLRenderer({ + antialias: true, + canvas: this.canvas, + alpha: true, + }); + this.controls = new OrbitControls(this.camera, this.renderer.domElement); + this.controls.screenSpacePanning = true; + this.controls.enableKeys = true; + this.renderer!.setSize(window.innerWidth, window.innerHeight); + this.renderer.setAnimationLoop(() => this.paint()); + this.renderer.setClearColor("red", 1); + + const bgLight = new THREE.AmbientLight(0x404040); + this.scene.add(bgLight); + + const light = new THREE.DirectionalLight(0x404040, 100); + light.position.set(10, 4, 0.7); + light.castShadow = true; + this.scene.add(light); + + light.shadow.mapSize.width = 512; + light.shadow.mapSize.height = 512; + light.shadow.camera.near = 0.5; + light.shadow.camera.far = 500; + + this.buildPiano(); + + document.addEventListener( + "keydown", + (e: any) => { + const key = e.key; + if (key === "z" && this.octave != 0) this.octave -= 1; + if (key === "x" && this.octave != octaves.length - 1) this.octave += 1; + const play = (note: string) => { + this.playNote(`${note}${octaves[this.octave]}`, () => {}); + }; + if (key === "a") play("C"); + if (key === "w") play("C#"); + if (key === "s") play("D"); + if (key === "E") play("D#"); + if (key === "d") play("E"); + if (key === "f") play("F"); + if (key === "t") play("F#"); + if (key === "g") play("G"); + if (key === "y") play("G#"); + if (key === "h") play("A"); + if (key === "u") play("A#"); + if (key === "j") play("B"); + if (key === "k") play("C"); + if (key === "o") play("C#"); + if (key === "l") play("D"); + if (key === "p") play("D#"); + }, + false + ); + + window.addEventListener( + "resize", + () => { + this.renderer!.setSize(window.innerWidth, window.innerHeight); + }, + false + ); + } +} +const notes = ["C", "D", "E", "F", "G", "A", "B"] as const; +type Note = typeof notes[number]; +const octaves = [2, 3, 4, 5] as const; +type Octave = typeof octaves[number]; +type NoteName = `${Note}${Octave}`; diff --git a/lit-3d-piano/src/vite-env.d.ts b/lit-3d-piano/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/lit-3d-piano/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/lit-3d-piano/tsconfig.json b/lit-3d-piano/tsconfig.json new file mode 100644 index 0000000..3c7c385 --- /dev/null +++ b/lit-3d-piano/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "lib": [ + "esnext", + "dom" + ], + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "./types", + "rootDir": "./src", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [] +} \ No newline at end of file diff --git a/lit-3d-piano/vite.config.ts b/lit-3d-piano/vite.config.ts new file mode 100644 index 0000000..930e746 --- /dev/null +++ b/lit-3d-piano/vite.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; + +export default defineConfig({ + base: "/lit-3d-piano/", + build: { + lib: { + entry: "src/lit-sheet-music.ts", + formats: ["es"], + }, + rollupOptions: { + input: { + main: resolve(__dirname, "index.html"), + }, + }, + }, +}); diff --git a/lit-calculator/.bazelignore b/lit-calculator/.bazelignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/lit-calculator/.bazelignore @@ -0,0 +1 @@ +node_modules diff --git a/lit-calculator/.bazelrc b/lit-calculator/.bazelrc new file mode 100644 index 0000000..0a284db --- /dev/null +++ b/lit-calculator/.bazelrc @@ -0,0 +1 @@ +common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig diff --git a/lit-calculator/.gitattributes b/lit-calculator/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/lit-calculator/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/lit-calculator/.github/workflows/deploy.yml b/lit-calculator/.github/workflows/deploy.yml new file mode 100644 index 0000000..b4d490a --- /dev/null +++ b/lit-calculator/.github/workflows/deploy.yml @@ -0,0 +1,68 @@ +name: Build and Deploy + +on: + push: + branches: ["main", "master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + REGISTRY: git.rodydavis.dev + + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.7.1 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - name: Set up Bazel (Bazelisk) + run: npm install -g @bazel/bazelisk + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Verify Hermetic Bazel Build + run: bazel build //... + + - name: Build Site + run: pnpm run build + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to registry + uses: docker/login-action@v4 + with: + registry: ${{ env.REGISTRY }} + username: ${{ gitea.actor }} + password: ${{ secrets.GIT_TOKEN }} + + - name: Build and push image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ gitea.repository }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max + diff --git a/lit-calculator/.gitignore b/lit-calculator/.gitignore new file mode 100644 index 0000000..f04a3d2 --- /dev/null +++ b/lit-calculator/.gitignore @@ -0,0 +1,55 @@ +# ========================================== +# 🌌 Federated Workspaces - Ultimate Ignores +# ========================================== + +# --- System & Editor Files --- +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +.vscode/ +.idea/ +*.swp +*.swo + +# --- Bazel Convenience Symlinks & Outputs --- +bazel-* +bazel_out/ + +# --- C/C++ Outputs --- +*.o +*.obj +*.a +*.lib +*.so +*.dylib +*.dll +*.out +*.exe + +# --- Go Outputs --- +*.test +*.prof +__debug_bin +MODULE.bazel.lock + +# --- Node / JavaScript / pnpm --- +node_modules/ +.npm/ +.pnpm-store/ +.pnpm-debug.log* +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# --- Dart / Flutter --- +.dart_tool/ +.packages +.pub-cache/ +.pub/ +/build/ +*.flutter-plugins +*.flutter-plugins-dependencies diff --git a/lit-calculator/.nojekyll b/lit-calculator/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/lit-calculator/BUILD.bazel b/lit-calculator/BUILD.bazel new file mode 100644 index 0000000..35e6320 --- /dev/null +++ b/lit-calculator/BUILD.bazel @@ -0,0 +1,24 @@ +load("@aspect_rules_js//npm:defs.bzl", "npm_link_package") +load("@npm//:defs.bzl", "npm_link_all_packages") +load("@aspect_rules_ts//ts:defs.bzl", "ts_config", "ts_project") + +npm_link_all_packages(name = "node_modules") + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + visibility = ["//visibility:public"], +) + +ts_project( + name = "build", + srcs = glob(["docs/**/*.ts"]), + declaration = True, + source_map = True, + transpiler = "tsc", + tsconfig = ":tsconfig", + deps = [ + "//:node_modules", + ], + visibility = ["//visibility:public"], +) diff --git a/lit-calculator/Dockerfile b/lit-calculator/Dockerfile new file mode 100644 index 0000000..fbf53b6 --- /dev/null +++ b/lit-calculator/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:alpine +COPY docs /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/lit-calculator/LICENSE b/lit-calculator/LICENSE new file mode 100644 index 0000000..fe0b37c --- /dev/null +++ b/lit-calculator/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Rody Davis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lit-calculator/MODULE.bazel b/lit-calculator/MODULE.bazel new file mode 100644 index 0000000..7a6bd1e --- /dev/null +++ b/lit-calculator/MODULE.bazel @@ -0,0 +1,22 @@ +module( + name = "lit_calculator", + version = "1.0.0", +) + +bazel_dep(name = "aspect_rules_js", version = "3.1.1") +bazel_dep(name = "aspect_rules_ts", version = "3.1.0") +bazel_dep(name = "rules_nodejs", version = "6.7.3") + +npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm") + +npm.npm_translate_lock( + name = "npm", + pnpm_lock = "//:pnpm-lock.yaml", + verify_node_modules_ignored = "//:.bazelignore", +) + +use_repo(npm, "npm") + +rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True) +rules_ts_ext.deps() +use_repo(rules_ts_ext, "npm_typescript") diff --git a/lit-calculator/README.md b/lit-calculator/README.md new file mode 100644 index 0000000..0558a02 --- /dev/null +++ b/lit-calculator/README.md @@ -0,0 +1,5 @@ +# Lit Calculator + +Reactive calculator made with LitElement and no build system or framework. + +Demo: https://rodydavis.github.io/lit-calculator/ diff --git a/lit-calculator/docs/calculator.ts b/lit-calculator/docs/calculator.ts new file mode 100644 index 0000000..5cd92a5 --- /dev/null +++ b/lit-calculator/docs/calculator.ts @@ -0,0 +1,158 @@ +import { LitElement, html, css } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import "./keypad-input.js"; +import "./key-pad.js"; +import "./display-output.js"; + +@customElement("app-calculator") +export class AppCalculator extends LitElement { + @property() + width = "500px"; + + @property() + primaryColor = "red"; + + @property() + accentColor = "black"; + + static styles = css` + #base { + border: 2px solid black; + padding-bottom: 20px; + --base-padding: 10px; + } + + #actions { + padding-top: var(--base-padding); + padding-left: var(--base-padding); + } + + button { + font-size: 17px; + } + `; + + connectedCallback() { + super.connectedCallback(); + // @ts-ignore + window.addEventListener("select-number", this._handleNumber); + } + disconnectedCallback() { + // @ts-ignore + window.removeEventListener("select-number", this._handleNumber); + super.disconnectedCallback(); + } + + _staging: string = ""; + _value: string = ""; + _mode: string = ""; + + public get mode(): string { + return this._mode; + } + + public set mode(v: string) { + const oldMode = this._mode; + const oldVal = this.value; + this._mode = v; + + // @ts-ignore + this.requestUpdate("mode", oldMode); + // @ts-ignore + this.requestUpdate("value", oldVal); + } + + private get value(): string { + if (this.mode == "") return this._value; + return this._staging; + } + + private set value(v: string) { + var oldVal = ""; + if (this.mode == "") { + oldVal = this._value; + this._value = v; + } else { + oldVal = this._staging; + this._staging = v; + } + // @ts-ignore + this.requestUpdate("value", oldVal); + } + + _handleNumber = (event: CustomEvent) => { + const num = event.detail.value; + event.stopPropagation(); + if (num === "=") { + this.calculate(); + return; + } + if (this.value === "0") { + this.value = ""; + } + if (num === "." && this.value.includes(".")) { + return; + } + this.value += num; + }; + + clear = () => { + this.value = ""; + this._staging = ""; + this._value = ""; + this.mode = ""; + }; + + calculate = () => { + const staging = Number(this._staging || "0"); + const current = Number(this._value || "0"); + var result: number = 0; + // Calculate + switch (this.mode) { + case "+": + result = staging + current; + break; + case "-": + result = staging - current; + break; + case "/": + result = staging / current; + break; + case "*": + result = staging * current; + break; + default: + break; + } + const output = result.toString(); + this.value = output; + this._staging = output; + }; + + // Render element DOM by returning a `lit-html` template. + render() { + return html`
+ +
+ + + + + +
+ +
`; + } +} diff --git a/lit-calculator/docs/display-output.ts b/lit-calculator/docs/display-output.ts new file mode 100644 index 0000000..bccfff9 --- /dev/null +++ b/lit-calculator/docs/display-output.ts @@ -0,0 +1,43 @@ +import { LitElement, html, css } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +@customElement("display-output") +export class CalcDisplay extends LitElement { + @property() + color = "black"; + + @property() + textColor = "white"; + + @property() + value = ""; + + static styles = css` + #base { + background-color: black; + text-align: end; + display: inline-block; + margin: var(--base-padding); + width: calc(100% - calc(var(--base-padding) * 2)); + border-bottom: 2px solid black; + } + + #text-display { + color: white; + margin: 0px; + padding-top: 40px; + padding-right: 10px; + padding-bottom: 10px; + font-size: 36px; + } + `; + + // Render element DOM by returning a `lit-html` template. + render() { + return html`
+
+ ${this.value || "0"} +
+
`; + } +} diff --git a/lit-calculator/docs/index.html b/lit-calculator/docs/index.html new file mode 100644 index 0000000..06217a2 --- /dev/null +++ b/lit-calculator/docs/index.html @@ -0,0 +1,17 @@ + + + + + + + Lit Calculator + + + + + + diff --git a/lit-calculator/docs/key-pad.ts b/lit-calculator/docs/key-pad.ts new file mode 100644 index 0000000..4228e1d --- /dev/null +++ b/lit-calculator/docs/key-pad.ts @@ -0,0 +1,97 @@ +import { LitElement, html, css } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +@customElement("key-pad") +export class CalcKeyPad extends LitElement { + @property() + accentColor = "blue"; + + @property() + textColor = "white"; + + @property() + actionColor = "black"; + + @property() + actionTextColor = "white"; + + static styles = css` + #base { + display: grid; + grid-template-columns: 33% 33% 33%; + padding-left: calc(var(--base-padding) / 2); + padding-right: calc(var(--base-padding) / 2); + } + + keypad-input { + display: inline-grid; + margin: 5px; + } + `; + + // Render element DOM by returning a `lit-html` template. + render() { + return html`
+ + + + + + + + + + + + +
`; + } +} diff --git a/lit-calculator/docs/keypad-input.ts b/lit-calculator/docs/keypad-input.ts new file mode 100644 index 0000000..92ce673 --- /dev/null +++ b/lit-calculator/docs/keypad-input.ts @@ -0,0 +1,64 @@ +import { LitElement, html, css } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +@customElement("keypad-input") +export class CalcNumber extends LitElement { + @property() + number = "0"; + + @property() + color = "black"; + + @property() + textColor = "white"; + + static styles = css` + #base { + width: 100%; + height: 100%; + border-radius: 10px; + text-align: center; + float: left; + } + + #base:hover { + box-shadow: 0 0 11px rgba(33, 33, 33, 0.2); + } + + #base:active { + background-color: lightgrey; + } + + button { + outline: 0 none; + color: white; + margin-top: 10px; + margin-bottom: 10px; + font-size: 20px; + } + `; + + _onTap(e: Event) { + e.preventDefault(); + + const event = new CustomEvent("select-number", { + detail: { value: this.number } as any, + bubbles: true, + cancelable: true, + }); + + // @ts-ignore + window.dispatchEvent(event); + } + + // Render element DOM by returning a `lit-html` template. + render() { + return html` `; + } +} diff --git a/lit-calculator/docs/style.css b/lit-calculator/docs/style.css new file mode 100644 index 0000000..30e11c7 --- /dev/null +++ b/lit-calculator/docs/style.css @@ -0,0 +1,10 @@ +body { + margin: 0px; + padding: 0px; + font-family: sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #f0f2f5; +} diff --git a/lit-calculator/package.json b/lit-calculator/package.json new file mode 100644 index 0000000..c127b62 --- /dev/null +++ b/lit-calculator/package.json @@ -0,0 +1,18 @@ +{ + "name": "lit-calculator", + "version": "1.0.0", + "private": true, + "scripts": { + "build": "esbuild docs/calculator.ts --bundle --outfile=docs/calculator.js --format=esm --minify --target=es2022" + }, + "dependencies": { + "lit": "^3.1.2" + }, + "devDependencies": { + "typescript": "^5.4.0", + "esbuild": "^0.20.1" + }, + "pnpm": { + "onlyBuiltDependencies": [] + } +} diff --git a/lit-calculator/pnpm-lock.yaml b/lit-calculator/pnpm-lock.yaml new file mode 100644 index 0000000..334f39d --- /dev/null +++ b/lit-calculator/pnpm-lock.yaml @@ -0,0 +1,311 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + lit: + specifier: ^3.1.2 + version: 3.3.3 + devDependencies: + esbuild: + specifier: ^0.20.1 + version: 0.20.2 + typescript: + specifier: ^5.4.0 + version: 5.9.3 + +packages: + + '@esbuild/aix-ppc64@0.20.2': + resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.20.2': + resolution: {integrity: sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.20.2': + resolution: {integrity: sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.20.2': + resolution: {integrity: sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.20.2': + resolution: {integrity: sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.20.2': + resolution: {integrity: sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.20.2': + resolution: {integrity: sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.20.2': + resolution: {integrity: sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.20.2': + resolution: {integrity: sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.20.2': + resolution: {integrity: sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.20.2': + resolution: {integrity: sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.20.2': + resolution: {integrity: sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.20.2': + resolution: {integrity: sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.20.2': + resolution: {integrity: sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.20.2': + resolution: {integrity: sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.20.2': + resolution: {integrity: sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.20.2': + resolution: {integrity: sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-x64@0.20.2': + resolution: {integrity: sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-x64@0.20.2': + resolution: {integrity: sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + + '@esbuild/sunos-x64@0.20.2': + resolution: {integrity: sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.20.2': + resolution: {integrity: sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.20.2': + resolution: {integrity: sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.20.2': + resolution: {integrity: sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + + '@lit-labs/ssr-dom-shim@1.6.0': + resolution: {integrity: sha512-VHb0ALPMTlgKjM6yIxxoQNnpKyUKLD04VzeQdsiXkMqkvYlAHxq9glGLmgbb889/1GsohSOAjvQYoiBppXFqrQ==} + + '@lit/reactive-element@2.1.2': + resolution: {integrity: sha512-pbCDiVMnne1lYUIaYNN5wrwQXDtHaYtg7YEFPeW+hws6U47WeFvISGUWekPGKWOP1ygrs0ef0o1VJMk1exos5A==} + + '@types/trusted-types@2.0.7': + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + + esbuild@0.20.2: + resolution: {integrity: sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==} + engines: {node: '>=12'} + hasBin: true + + lit-element@4.2.2: + resolution: {integrity: sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w==} + + lit-html@3.3.3: + resolution: {integrity: sha512-el8M6jK2o3RXBnrSHX3ZKrsN8zEV63pSExTO1wYJz7QndGYZ8353e2a5PPX+qHe2aGayfnchQmkAojaWAREOIA==} + + lit@3.3.3: + resolution: {integrity: sha512-fycuvZg/hkpozL00lm1pEJH5nN/lr9ZXd6mJI2HSN4+Bzc+LDNdEApJ6HFbPkdFNHLvOplIIuJvxkS4XUxqirw==} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + +snapshots: + + '@esbuild/aix-ppc64@0.20.2': + optional: true + + '@esbuild/android-arm64@0.20.2': + optional: true + + '@esbuild/android-arm@0.20.2': + optional: true + + '@esbuild/android-x64@0.20.2': + optional: true + + '@esbuild/darwin-arm64@0.20.2': + optional: true + + '@esbuild/darwin-x64@0.20.2': + optional: true + + '@esbuild/freebsd-arm64@0.20.2': + optional: true + + '@esbuild/freebsd-x64@0.20.2': + optional: true + + '@esbuild/linux-arm64@0.20.2': + optional: true + + '@esbuild/linux-arm@0.20.2': + optional: true + + '@esbuild/linux-ia32@0.20.2': + optional: true + + '@esbuild/linux-loong64@0.20.2': + optional: true + + '@esbuild/linux-mips64el@0.20.2': + optional: true + + '@esbuild/linux-ppc64@0.20.2': + optional: true + + '@esbuild/linux-riscv64@0.20.2': + optional: true + + '@esbuild/linux-s390x@0.20.2': + optional: true + + '@esbuild/linux-x64@0.20.2': + optional: true + + '@esbuild/netbsd-x64@0.20.2': + optional: true + + '@esbuild/openbsd-x64@0.20.2': + optional: true + + '@esbuild/sunos-x64@0.20.2': + optional: true + + '@esbuild/win32-arm64@0.20.2': + optional: true + + '@esbuild/win32-ia32@0.20.2': + optional: true + + '@esbuild/win32-x64@0.20.2': + optional: true + + '@lit-labs/ssr-dom-shim@1.6.0': {} + + '@lit/reactive-element@2.1.2': + dependencies: + '@lit-labs/ssr-dom-shim': 1.6.0 + + '@types/trusted-types@2.0.7': {} + + esbuild@0.20.2: + optionalDependencies: + '@esbuild/aix-ppc64': 0.20.2 + '@esbuild/android-arm': 0.20.2 + '@esbuild/android-arm64': 0.20.2 + '@esbuild/android-x64': 0.20.2 + '@esbuild/darwin-arm64': 0.20.2 + '@esbuild/darwin-x64': 0.20.2 + '@esbuild/freebsd-arm64': 0.20.2 + '@esbuild/freebsd-x64': 0.20.2 + '@esbuild/linux-arm': 0.20.2 + '@esbuild/linux-arm64': 0.20.2 + '@esbuild/linux-ia32': 0.20.2 + '@esbuild/linux-loong64': 0.20.2 + '@esbuild/linux-mips64el': 0.20.2 + '@esbuild/linux-ppc64': 0.20.2 + '@esbuild/linux-riscv64': 0.20.2 + '@esbuild/linux-s390x': 0.20.2 + '@esbuild/linux-x64': 0.20.2 + '@esbuild/netbsd-x64': 0.20.2 + '@esbuild/openbsd-x64': 0.20.2 + '@esbuild/sunos-x64': 0.20.2 + '@esbuild/win32-arm64': 0.20.2 + '@esbuild/win32-ia32': 0.20.2 + '@esbuild/win32-x64': 0.20.2 + + lit-element@4.2.2: + dependencies: + '@lit-labs/ssr-dom-shim': 1.6.0 + '@lit/reactive-element': 2.1.2 + lit-html: 3.3.3 + + lit-html@3.3.3: + dependencies: + '@types/trusted-types': 2.0.7 + + lit@3.3.3: + dependencies: + '@lit/reactive-element': 2.1.2 + lit-element: 4.2.2 + lit-html: 3.3.3 + + typescript@5.9.3: {} diff --git a/lit-calculator/tsconfig.json b/lit-calculator/tsconfig.json new file mode 100644 index 0000000..d6a7d71 --- /dev/null +++ b/lit-calculator/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "node", + "lib": ["esnext", "dom"], + "declaration": true, + "sourceMap": true, + "inlineSources": false, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "skipLibCheck": true, + "experimentalDecorators": true + }, + "include": ["docs/**/*"], + "exclude": ["node_modules", "**/*.spec.ts"] +} diff --git a/lit-code-editor b/lit-code-editor deleted file mode 160000 index 7af8265..0000000 --- a/lit-code-editor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7af8265f7213a163aa79d795a1b9ff6486d251ac diff --git a/lit-code-editor/.github/workflows/ci.yml b/lit-code-editor/.github/workflows/ci.yml new file mode 100644 index 0000000..dbcaaa5 --- /dev/null +++ b/lit-code-editor/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Demo + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist diff --git a/lit-code-editor/.gitignore b/lit-code-editor/.gitignore new file mode 100644 index 0000000..759ef53 --- /dev/null +++ b/lit-code-editor/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +types +*.local diff --git a/lit-code-editor/LICENSE b/lit-code-editor/LICENSE new file mode 100644 index 0000000..396a87f --- /dev/null +++ b/lit-code-editor/LICENSE @@ -0,0 +1,43 @@ +Apache License, Version 2.0 +SPDX short identifier: Apache-2.0 +Further resources on the Apache License, Version 2.0 + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +1. Definitions. +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. +6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +END OF TERMS AND CONDITIONS +APPENDIX: How to apply the Apache License to your work +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. \ No newline at end of file diff --git a/lit-code-editor/README.md b/lit-code-editor/README.md new file mode 100644 index 0000000..a77440d --- /dev/null +++ b/lit-code-editor/README.md @@ -0,0 +1,9 @@ +# Lit Code Editor + +[![Demo](https://github.com/rodydavis/lit-code-editor/actions/workflows/ci.yml/badge.svg)](https://github.com/rodydavis/lit-code-editor/actions/workflows/ci.yml) + +Simple example of Lit + Vite + Monaco Editor as a web component that can be embedded in pages. + +Online demo: https://rodydavis.github.io/lit-code-editor/ + +Another version to look at: https://github.com/vanillawc/wc-monaco-editor diff --git a/lit-code-editor/index.html b/lit-code-editor/index.html new file mode 100644 index 0000000..18b51c4 --- /dev/null +++ b/lit-code-editor/index.html @@ -0,0 +1,27 @@ + + + + + + + Lit Code Editor + + + + + + + + + diff --git a/lit-code-editor/package-lock.json b/lit-code-editor/package-lock.json new file mode 100644 index 0000000..c95f072 --- /dev/null +++ b/lit-code-editor/package-lock.json @@ -0,0 +1,255 @@ +{ + "name": "lit-code-editor", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@lit/reactive-element": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.0.0-rc.2.tgz", + "integrity": "sha512-cujeIl5Ei8FC7UHf4/4Q3bRJOtdTe1vpJV/JEBYCggedmQ+2P8A2oz7eE+Vxi6OJ4nc0X+KZxXnBoH4QrEbmEQ==" + }, + "@types/node": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.7.tgz", + "integrity": "sha512-aDDY54sst8sx47CWT6QQqIZp45yURq4dic0+HCYfYNcY5Ejlb/CLmFnRLfy3wQuYafOeh3lB/DAKaqRKBtcZmA==", + "dev": true + }, + "@types/trusted-types": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz", + "integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==" + }, + "ast-types": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.14.2.tgz", + "integrity": "sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA==", + "dev": true, + "requires": { + "tslib": "^2.0.1" + } + }, + "colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "dev": true + }, + "es-module-lexer": { + "version": "0.3.26", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.3.26.tgz", + "integrity": "sha512-Va0Q/xqtrss45hWzP8CZJwzGSZJjDM5/MJRE3IXXnUCcVLElR9BRaE9F62BopysASyc4nM3uwhSW7FFB9nlWAA==", + "dev": true + }, + "esbuild": { + "version": "0.12.17", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.17.tgz", + "integrity": "sha512-GshKJyVYUnlSXIZj/NheC2O0Kblh42CS7P1wJyTbbIHevTG4jYMS9NNw8EOd8dDWD0dzydYHS01MpZoUcQXB4g==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", + "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "lit": { + "version": "2.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.0.0-rc.2.tgz", + "integrity": "sha512-BOCuoJR04WaTV8UqTKk09cNcQA10Aq2LCcBOiHuF7TzWH5RNDsbCBP5QM9sLBSotGTXbDug/gFO08jq6TbyEtw==", + "requires": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-element": "^3.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + }, + "dependencies": { + "lit-element": { + "version": "3.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.0.0-rc.2.tgz", + "integrity": "sha512-2Z7DabJ3b5K+p5073vFjMODoaWqy5PIaI4y6ADKm+fCGc8OnX9fU9dMoUEBZjFpd/bEFR9PBp050tUtBnT9XTQ==", + "requires": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + } + }, + "lit-html": { + "version": "2.0.0-rc.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0-rc.3.tgz", + "integrity": "sha512-Y6P8LlAyQuqvzq6l/Nc4z5/P5M/rVLYKQIRxcNwSuGajK0g4kbcBFQqZmgvqKG+ak+dHZjfm2HUw9TF5N/pkCw==", + "requires": { + "@types/trusted-types": "^1.0.1" + } + } + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "monaco-editor": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.26.1.tgz", + "integrity": "sha512-mm45nUrBDk0DgZKgbD7+bhDOtcAFNGPJJRAdS6Su1kTGl6XEgC7U3xOmDUW/0RrLf+jlvCGaqLvD4p2VjwuwwQ==" + }, + "nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "postcss": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz", + "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==", + "dev": true, + "requires": { + "colorette": "^1.2.2", + "nanoid": "^3.1.23", + "source-map-js": "^0.6.2" + } + }, + "recast": { + "version": "0.20.5", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.20.5.tgz", + "integrity": "sha512-E5qICoPoNL4yU0H0NoBDntNB0Q5oMSNh9usFctYniLBluTthi3RsQVBXIJNbApOlvSwW/RGxIuokPcAc59J5fQ==", + "dev": true, + "requires": { + "ast-types": "0.14.2", + "esprima": "~4.0.0", + "source-map": "~0.6.1", + "tslib": "^2.0.1" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.55.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.55.1.tgz", + "integrity": "sha512-1P9w5fpb6b4qroePh8vHKGIvPNxwoCQhjJpIqfZGHLKpZ0xcU2/XBmFxFbc9697/6bmHpmFTLk5R1dAQhFSo0g==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "rollup-plugin-monaco-editor": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-monaco-editor/-/rollup-plugin-monaco-editor-0.1.0.tgz", + "integrity": "sha512-58+N51L8lhhZt8LhoJCRAoPiRSUcRYxFnEPEubZaj2JeDT9MdEAs7BhJLj/EHFJ/5qYCwsaxRtOClrXjh34sCA==", + "dev": true, + "requires": { + "es-module-lexer": "^0.3.26", + "recast": "^0.20.4", + "regenerator-runtime": "^0.13.9", + "semver": "^7.3.5" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "dev": true + }, + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==", + "dev": true + }, + "typescript": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", + "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "dev": true + }, + "vite": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.4.4.tgz", + "integrity": "sha512-m1wK6pFJKmaYA6AeZIUXyiAgUAAJzVXhIMYCdZUpCaFMGps0v0IlNJtbmPvkUhVEyautalajmnW5X6NboUPsnw==", + "dev": true, + "requires": { + "esbuild": "^0.12.8", + "fsevents": "~2.3.2", + "postcss": "^8.3.6", + "resolve": "^1.20.0", + "rollup": "^2.38.5" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } +} diff --git a/lit-code-editor/package.json b/lit-code-editor/package.json new file mode 100644 index 0000000..5e7155e --- /dev/null +++ b/lit-code-editor/package.json @@ -0,0 +1,23 @@ +{ + "name": "lit-code-editor", + "version": "0.0.0", + "files": [ + "dist", + "types" + ], + "scripts": { + "start": "npm run dev", + "dev": "vite", + "build": "tsc && vite build", + "serve": "tsc && vite preview" + }, + "dependencies": { + "lit": "*", + "monaco-editor": "^0.26.1" + }, + "devDependencies": { + "@types/node": "^16.4.7", + "typescript": "^4.3.5", + "vite": "^2.4.4" + } +} \ No newline at end of file diff --git a/lit-code-editor/src/code-editor.d.ts b/lit-code-editor/src/code-editor.d.ts new file mode 100644 index 0000000..2a70456 --- /dev/null +++ b/lit-code-editor/src/code-editor.d.ts @@ -0,0 +1,27 @@ +import { LitElement } from "lit"; +import * as monaco from "monaco-editor"; +export declare class CodeEditor extends LitElement { + private container; + editor?: monaco.editor.IStandaloneCodeEditor; + readOnly?: boolean; + theme?: string; + language?: string; + code?: string; + static styles: import("lit").CSSResultGroup; + render(): import("lit").TemplateResult<1>; + private getFile; + private getCode; + private getLang; + private getTheme; + private isDark; + setValue(value: string): void; + getValue(): string; + setReadOnly(value: boolean): void; + setOptions(value: monaco.editor.IStandaloneEditorConstructionOptions): void; + firstUpdated(): void; +} +declare global { + interface HTMLElementTagNameMap { + "code-editor": CodeEditor; + } +} diff --git a/lit-code-editor/src/code-editor.ts b/lit-code-editor/src/code-editor.ts new file mode 100644 index 0000000..c52e91a --- /dev/null +++ b/lit-code-editor/src/code-editor.ts @@ -0,0 +1,136 @@ +import { css, html, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { createRef, Ref, ref } from "lit/directives/ref.js"; + +// -- Monaco Editor Imports -- +import * as monaco from "monaco-editor"; +import styles from "monaco-editor/min/vs/editor/editor.main.css"; +import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker"; +import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker"; +import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker"; +import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker"; +import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker"; + +// @ts-ignore +self.MonacoEnvironment = { + getWorker(_: any, label: string) { + if (label === "json") { + return new jsonWorker(); + } + if (label === "css" || label === "scss" || label === "less") { + return new cssWorker(); + } + if (label === "html" || label === "handlebars" || label === "razor") { + return new htmlWorker(); + } + if (label === "typescript" || label === "javascript") { + return new tsWorker(); + } + return new editorWorker(); + }, +}; + +@customElement("code-editor") +export class CodeEditor extends LitElement { + private container: Ref = createRef(); + editor?: monaco.editor.IStandaloneCodeEditor; + @property({ type: Boolean, attribute: "readonly" }) readOnly?: boolean; + @property() theme?: string; + @property() language?: string; + @property() code?: string; + + static styles = css` + :host { + --editor-width: 100%; + --editor-height: 100vh; + } + main { + width: var(--editor-width); + height: var(--editor-height); + } + `; + + render() { + return html` + +
+ `; + } + + private getFile() { + if (this.children.length > 0) return this.children[0]; + return null; + } + + private getCode() { + if (this.code) return this.code; + const file = this.getFile(); + if (!file) return; + return file.innerHTML.trim(); + } + + private getLang() { + if (this.language) return this.language; + const file = this.getFile(); + if (!file) return; + const type = file.getAttribute("type")!; + return type.split("/").pop()!; + } + + private getTheme() { + if (this.theme) return this.theme; + if (this.isDark()) return "vs-dark"; + return "vs-light"; + } + + private isDark() { + return ( + window.matchMedia && + window.matchMedia("(prefers-color-scheme: dark)").matches + ); + } + + setValue(value: string) { + this.editor!.setValue(value); + } + + getValue() { + const value = this.editor!.getValue(); + return value; + } + + setReadOnly(value: boolean) { + this.readOnly = value; + this.setOptions({ readOnly: value }); + } + + setOptions(value: monaco.editor.IStandaloneEditorConstructionOptions) { + this.editor!.updateOptions(value); + } + + firstUpdated() { + this.editor = monaco.editor.create(this.container.value!, { + value: this.getCode(), + language: this.getLang(), + theme: this.getTheme(), + automaticLayout: true, + readOnly: this.readOnly ?? false, + }); + this.editor.getModel()!.onDidChangeContent(() => { + this.dispatchEvent(new CustomEvent("change", { detail: {} })); + }); + window + .matchMedia("(prefers-color-scheme: dark)") + .addEventListener("change", () => { + monaco.editor.setTheme(this.getTheme()); + }); + } +} + +declare global { + interface HTMLElementTagNameMap { + "code-editor": CodeEditor; + } +} diff --git a/lit-code-editor/src/favicon.svg b/lit-code-editor/src/favicon.svg new file mode 100644 index 0000000..de4aedd --- /dev/null +++ b/lit-code-editor/src/favicon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/lit-code-editor/src/vite-env.d.ts b/lit-code-editor/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/lit-code-editor/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/lit-code-editor/tsconfig.json b/lit-code-editor/tsconfig.json new file mode 100644 index 0000000..d17e916 --- /dev/null +++ b/lit-code-editor/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": ["es2017", "dom", "dom.iterable"], + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "./types", + "rootDir": "./src", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"], + "exclude": [] +} diff --git a/lit-code-editor/vite.config.ts b/lit-code-editor/vite.config.ts new file mode 100644 index 0000000..ee7b8ec --- /dev/null +++ b/lit-code-editor/vite.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; + +export default defineConfig({ + base: "/lit-code-editor/", + build: { + rollupOptions: { + input: { + main: resolve(__dirname, "index.html"), + }, + }, + }, +}); diff --git a/lit-draggable-dom b/lit-draggable-dom deleted file mode 160000 index 553b353..0000000 --- a/lit-draggable-dom +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 553b353ba4951ae0e73c7190272fa9a3969d05d0 diff --git a/lit-draggable-dom/.github/workflows/ci.yml b/lit-draggable-dom/.github/workflows/ci.yml new file mode 100644 index 0000000..dbcaaa5 --- /dev/null +++ b/lit-draggable-dom/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Demo + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist diff --git a/lit-draggable-dom/.gitignore b/lit-draggable-dom/.gitignore new file mode 100644 index 0000000..759ef53 --- /dev/null +++ b/lit-draggable-dom/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +types +*.local diff --git a/lit-draggable-dom/.vscode/settings.json b/lit-draggable-dom/.vscode/settings.json new file mode 100644 index 0000000..1a5e011 --- /dev/null +++ b/lit-draggable-dom/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "vite" + ] +} \ No newline at end of file diff --git a/lit-draggable-dom/LICENSE b/lit-draggable-dom/LICENSE new file mode 100644 index 0000000..396a87f --- /dev/null +++ b/lit-draggable-dom/LICENSE @@ -0,0 +1,43 @@ +Apache License, Version 2.0 +SPDX short identifier: Apache-2.0 +Further resources on the Apache License, Version 2.0 + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +1. Definitions. +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. +6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +END OF TERMS AND CONDITIONS +APPENDIX: How to apply the Apache License to your work +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. \ No newline at end of file diff --git a/lit-draggable-dom/README.md b/lit-draggable-dom/README.md new file mode 100644 index 0000000..2ad57aa --- /dev/null +++ b/lit-draggable-dom/README.md @@ -0,0 +1,13 @@ +# Lit Draggable DOM + +[Lit](https://lit.dev) Example of how to take HTML Elements or SVG Elements as slots and render them on a canvas that can be dragged as a whole or individual items. + +You can try the demo [here](https://rodydavis.github.io/lit-draggable-dom/)! + +Here is the related [blog post](https://rodydavis.com/posts/lit-draggable-dom/). + +This uses [CSS 2D transforms and pointer capture events](https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture) to efficiently render and move the elements. + +![](/screenshot.png) + +There is also an example on the Lit playground [here](https://lit.dev/playground/#project=W3sibmFtZSI6ImxpdC1jc3MtY2FudmFzLnRzIiwiY29udGVudCI6ImltcG9ydCB7IGh0bWwsIGNzcywgTGl0RWxlbWVudCB9IGZyb20gXCJsaXRcIjtcbmltcG9ydCB7IGN1c3RvbUVsZW1lbnQsIHF1ZXJ5IH0gZnJvbSBcImxpdC9kZWNvcmF0b3JzLmpzXCI7XG5cbnR5cGUgRHJhZ1R5cGUgPSBcIm5vbmVcIiB8IFwiY2FudmFzXCIgfCBcImVsZW1lbnRcIjtcbnR5cGUgU3VwcG9ydGVkTm9kZSA9IEhUTUxFbGVtZW50IHwgU1ZHRWxlbWVudDtcblxuQGN1c3RvbUVsZW1lbnQoXCJjc3MtY2FudmFzXCIpXG5leHBvcnQgY2xhc3MgQ1NTQ2FudmFzIGV4dGVuZHMgTGl0RWxlbWVudCB7XG4gIEBxdWVyeShcIm1haW5cIikgcm9vdCE6IEhUTUxFbGVtZW50O1xuICBAcXVlcnkoXCIjY2hpbGRyZW5cIikgY29udGFpbmVyITogSFRNTEVsZW1lbnQ7XG4gIEBxdWVyeShcImNhbnZhc1wiKSBjYW52YXMhOiBIVE1MQ2FudmFzRWxlbWVudDtcbiAgZHJhZ1R5cGU6IERyYWdUeXBlID0gXCJub25lXCI7XG4gIG9mZnNldDogT2Zmc2V0ID0geyB4OiAwLCB5OiAwIH07XG4gIHBvaW50ZXJNYXA6IE1hcDxudW1iZXIsIFBvaW50ZXJEYXRhPiA9IG5ldyBNYXAoKTtcblxuICBzdGF0aWMgc3R5bGVzID0gY3NzYFxuICAgIDpob3N0IHtcbiAgICAgIC0tb2Zmc2V0LXg6IDA7XG4gICAgICAtLW9mZnNldC15OiAwO1xuICAgICAgLS1ncmlkLWJhY2tncm91bmQtY29sb3I6IHdoaXRlO1xuICAgICAgLS1ncmlkLWNvbG9yOiBibGFjaztcbiAgICAgIC0tZ3JpZC1zaXplOiA0MHB4O1xuICAgICAgLS1ncmlkLWRvdC1zaXplOiAxcHg7XG4gICAgfVxuICAgIG1haW4ge1xuICAgICAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgICB9XG4gICAgY2FudmFzIHtcbiAgICAgIGJhY2tncm91bmQtc2l6ZTogdmFyKC0tZ3JpZC1zaXplKSB2YXIoLS1ncmlkLXNpemUpO1xuICAgICAgYmFja2dyb3VuZC1pbWFnZTogcmFkaWFsLWdyYWRpZW50KFxuICAgICAgICBjaXJjbGUsXG4gICAgICAgIHZhcigtLWdyaWQtY29sb3IpIHZhcigtLWdyaWQtZG90LXNpemUpLFxuICAgICAgICB2YXIoLS1ncmlkLWJhY2tncm91bmQtY29sb3IpIHZhcigtLWdyaWQtZG90LXNpemUpXG4gICAgICApO1xuICAgICAgYmFja2dyb3VuZC1wb3NpdGlvbjogdmFyKC0tb2Zmc2V0LXgpIHZhcigtLW9mZnNldC15KTtcbiAgICAgIHotaW5kZXg6IDA7XG4gICAgfVxuICAgIC5mdWxsLXNpemUge1xuICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICBoZWlnaHQ6IDEwMCU7XG4gICAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgfVxuICAgIC5jaGlsZCB7XG4gICAgICAtLWR4OiAwcHg7XG4gICAgICAtLWR5OiAwcHg7XG4gICAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgICBmbGV4LXNocmluazogMTtcbiAgICAgIHotaW5kZXg6IHZhcigtLWxheWVyLCAwKTtcbiAgICAgIHRyYW5zZm9ybTogdHJhbnNsYXRlKHZhcigtLWR4KSwgdmFyKC0tZHkpKTtcbiAgICB9XG4gICAgQG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykge1xuICAgICAgbWFpbiB7XG4gICAgICAgIC0tZ3JpZC1iYWNrZ3JvdW5kLWNvbG9yOiBibGFjaztcbiAgICAgICAgLS1ncmlkLWNvbG9yOiBncmV5O1xuICAgICAgfVxuICAgIH1cbiAgYDtcblxuICByZW5kZXIoKSB7XG4gICAgY29uc29sZS5sb2coXCJyZW5kZXJcIik7XG4gICAgcmV0dXJuIGh0bWxgXG4gICAgICA8bWFpbiBjbGFzcz1cImZ1bGwtc2l6ZVwiPlxuICAgICAgICA8Y2FudmFzIGNsYXNzPVwiZnVsbC1zaXplXCI-PC9jYW52YXM-XG4gICAgICAgIDxkaXYgaWQ9XCJjaGlsZHJlblwiIGNsYXNzPVwiZnVsbC1zaXplXCI-PC9kaXY-XG4gICAgICA8L21haW4-XG4gICAgYDtcbiAgfVxuXG4gIGhhbmRsZURvd24oZXZlbnQ6IFBvaW50ZXJFdmVudCwgdHlwZTogRHJhZ1R5cGUpIHtcbiAgICBpZiAodGhpcy5kcmFnVHlwZSA9PT0gXCJub25lXCIpIHtcbiAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICB0aGlzLmRyYWdUeXBlID0gdHlwZTtcbiAgICAgIChldmVudC50YXJnZXQgYXMgRWxlbWVudCkuc2V0UG9pbnRlckNhcHR1cmUoZXZlbnQucG9pbnRlcklkKTtcbiAgICAgIHRoaXMucG9pbnRlck1hcC5zZXQoZXZlbnQucG9pbnRlcklkLCB7XG4gICAgICAgIGlkOiBldmVudC5wb2ludGVySWQsXG4gICAgICAgIHN0YXJ0UG9zOiB7IHg6IGV2ZW50LmNsaWVudFgsIHk6IGV2ZW50LmNsaWVudFkgfSxcbiAgICAgICAgY3VycmVudFBvczogeyB4OiBldmVudC5jbGllbnRYLCB5OiBldmVudC5jbGllbnRZIH0sXG4gICAgICB9KTtcbiAgICB9XG4gIH1cblxuICBoYW5kbGVNb3ZlKFxuICAgIGV2ZW50OiBQb2ludGVyRXZlbnQsXG4gICAgdHlwZTogRHJhZ1R5cGUsXG4gICAgb25Nb3ZlOiAoZGVsdGE6IE9mZnNldCkgPT4gdm9pZFxuICApIHtcbiAgICBpZiAodGhpcy5kcmFnVHlwZSA9PT0gdHlwZSkge1xuICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgIGNvbnN0IHNhdmVkID0gdGhpcy5wb2ludGVyTWFwLmdldChldmVudC5wb2ludGVySWQpITtcbiAgICAgIGNvbnN0IGN1cnJlbnQgPSB7IC4uLnNhdmVkLmN1cnJlbnRQb3MgfTtcbiAgICAgIHNhdmVkLmN1cnJlbnRQb3MgPSB7IHg6IGV2ZW50LmNsaWVudFgsIHk6IGV2ZW50LmNsaWVudFkgfTtcbiAgICAgIGNvbnN0IGRlbHRhID0ge1xuICAgICAgICB4OiBzYXZlZC5jdXJyZW50UG9zLnggLSBjdXJyZW50LngsXG4gICAgICAgIHk6IHNhdmVkLmN1cnJlbnRQb3MueSAtIGN1cnJlbnQueSxcbiAgICAgIH07XG4gICAgICBvbk1vdmUoZGVsdGEpO1xuICAgIH1cbiAgfVxuXG4gIGhhbmRsZVVwKGV2ZW50OiBQb2ludGVyRXZlbnQpIHtcbiAgICB0aGlzLmRyYWdUeXBlID0gXCJub25lXCI7XG4gICAgKGV2ZW50LnRhcmdldCBhcyBFbGVtZW50KS5yZWxlYXNlUG9pbnRlckNhcHR1cmUoZXZlbnQucG9pbnRlcklkKTtcbiAgfVxuXG4gIG1vdmVDYW52YXMoZGVsdGE6IE9mZnNldCkge1xuICAgIHRoaXMub2Zmc2V0LnggKz0gZGVsdGEueDtcbiAgICB0aGlzLm9mZnNldC55ICs9IGRlbHRhLnk7XG4gICAgdGhpcy5yb290LnN0eWxlLnNldFByb3BlcnR5KFwiLS1vZmZzZXQteFwiLCBgJHt0aGlzLm9mZnNldC54fXB4YCk7XG4gICAgdGhpcy5yb290LnN0eWxlLnNldFByb3BlcnR5KFwiLS1vZmZzZXQteVwiLCBgJHt0aGlzLm9mZnNldC55fXB4YCk7XG4gIH1cblxuICBtb3ZlRWxlbWVudChjaGlsZDogU3VwcG9ydGVkTm9kZSwgZGVsdGE6IE9mZnNldCkge1xuICAgIGNvbnN0IGdldE51bWJlciA9IChrZXk6IFwiLS1keFwiIHwgXCItLWR5XCIsIGZhbGxiYWNrOiBudW1iZXIpID0-IHtcbiAgICAgIGNvbnN0IHNhdmVkID0gY2hpbGQuc3R5bGUuZ2V0UHJvcGVydHlWYWx1ZShrZXkpO1xuICAgICAgaWYgKHNhdmVkLmxlbmd0aCA-IDApIHtcbiAgICAgICAgcmV0dXJuIHBhcnNlRmxvYXQoc2F2ZWQucmVwbGFjZShcInB4XCIsIFwiXCIpKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBmYWxsYmFjaztcbiAgICB9O1xuICAgIGNvbnN0IGR4ID0gZ2V0TnVtYmVyKFwiLS1keFwiLCAwKSArIGRlbHRhLng7XG4gICAgY29uc3QgZHkgPSBnZXROdW1iZXIoXCItLWR5XCIsIDApICsgZGVsdGEueTtcbiAgICBjaGlsZC5zdHlsZS50cmFuc2Zvcm0gPSBgdHJhbnNsYXRlKCR7ZHh9cHgsICR7ZHl9cHgpYDtcbiAgICBjaGlsZC5zdHlsZS5zZXRQcm9wZXJ0eShcIi0tZHhcIiwgYCR7ZHh9cHhgKTtcbiAgICBjaGlsZC5zdHlsZS5zZXRQcm9wZXJ0eShcIi0tZHlcIiwgYCR7ZHl9cHhgKTtcbiAgfVxuXG4gIGFzeW5jIGZpcnN0VXBkYXRlZCgpIHtcbiAgICBjb25zdCBpdGVtcyA9IEFycmF5LmZyb20odGhpcy5jaGlsZE5vZGVzKTtcbiAgICBsZXQgaSA9IDA7XG4gICAgZm9yIChjb25zdCBub2RlIG9mIGl0ZW1zKSB7XG4gICAgICBpZiAobm9kZSBpbnN0YW5jZW9mIFNWR0VsZW1lbnQgfHwgbm9kZSBpbnN0YW5jZW9mIEhUTUxFbGVtZW50KSB7XG4gICAgICAgIGNvbnN0IGNoaWxkID0gbm9kZSBhcyBTdXBwb3J0ZWROb2RlO1xuICAgICAgICBjaGlsZC5jbGFzc0xpc3QuYWRkKFwiY2hpbGRcIik7XG4gICAgICAgIGNoaWxkLnN0eWxlLnNldFByb3BlcnR5KFwiLS1sYXllclwiLCBgJHtpfWApO1xuICAgICAgICB0aGlzLmNvbnRhaW5lci5hcHBlbmQoY2hpbGQpO1xuICAgICAgICBjaGlsZC5hZGRFdmVudExpc3RlbmVyKFwicG9pbnRlcmRvd25cIiwgKGU6IGFueSkgPT4ge1xuICAgICAgICAgIHRoaXMuaGFuZGxlRG93bihlLCBcImVsZW1lbnRcIik7XG4gICAgICAgIH0pO1xuICAgICAgICBjaGlsZC5hZGRFdmVudExpc3RlbmVyKFwicG9pbnRlcm1vdmVcIiwgKGU6IGFueSkgPT4ge1xuICAgICAgICAgIHRoaXMuaGFuZGxlTW92ZShlLCBcImVsZW1lbnRcIiwgKGRlbHRhKSA9PiB7XG4gICAgICAgICAgICB0aGlzLm1vdmVFbGVtZW50KGNoaWxkLCBkZWx0YSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpKys7XG4gICAgICB9XG4gICAgfVxuICAgIHRoaXMucmVxdWVzdFVwZGF0ZSgpO1xuICAgIHRoaXMucm9vdC5hZGRFdmVudExpc3RlbmVyKFwicG9pbnRlcmRvd25cIiwgKGU6IGFueSkgPT4ge1xuICAgICAgdGhpcy5oYW5kbGVEb3duKGUsIFwiY2FudmFzXCIpO1xuICAgIH0pO1xuICAgIHRoaXMucm9vdC5hZGRFdmVudExpc3RlbmVyKFwicG9pbnRlcm1vdmVcIiwgKGU6IGFueSkgPT4ge1xuICAgICAgdGhpcy5oYW5kbGVNb3ZlKGUsIFwiY2FudmFzXCIsIChkZWx0YSkgPT4ge1xuICAgICAgICB0aGlzLm1vdmVDYW52YXMoZGVsdGEpO1xuICAgICAgICBmb3IgKGNvbnN0IG5vZGUgb2YgQXJyYXkuZnJvbSh0aGlzLmNvbnRhaW5lci5jaGlsZHJlbikpIHtcbiAgICAgICAgICBpZiAobm9kZSBpbnN0YW5jZW9mIFNWR0VsZW1lbnQgfHwgbm9kZSBpbnN0YW5jZW9mIEhUTUxFbGVtZW50KSB7XG4gICAgICAgICAgICB0aGlzLm1vdmVFbGVtZW50KG5vZGUsIGRlbHRhKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH0pO1xuICAgIHRoaXMucm9vdC5hZGRFdmVudExpc3RlbmVyKFwicG9pbnRlcnVwXCIsIChlOiBhbnkpID0-IHtcbiAgICAgIHRoaXMuaGFuZGxlVXAoZSk7XG4gICAgfSk7XG4gIH1cbn1cblxuaW50ZXJmYWNlIE9mZnNldCB7XG4gIHg6IG51bWJlcjtcbiAgeTogbnVtYmVyO1xufVxuXG5pbnRlcmZhY2UgUG9pbnRlckRhdGEge1xuICBpZDogbnVtYmVyO1xuICBzdGFydFBvczogT2Zmc2V0O1xuICBjdXJyZW50UG9zOiBPZmZzZXQ7XG59XG4ifSx7Im5hbWUiOiJpbmRleC5odG1sIiwiY29udGVudCI6IjwhRE9DVFlQRSBodG1sPlxuPGh0bWwgbGFuZz1cImVuXCI-XG4gIDxoZWFkPlxuICAgIDxtZXRhIGNoYXJzZXQ9XCJVVEYtOFwiIC8-XG4gICAgPGxpbmsgcmVsPVwiaWNvblwiIHR5cGU9XCJpbWFnZS9zdmcreG1sXCIgaHJlZj1cIi9zcmMvZmF2aWNvbi5zdmdcIiAvPlxuICAgIDxtZXRhIG5hbWU9XCJ2aWV3cG9ydFwiIGNvbnRlbnQ9XCJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MS4wXCIgLz5cbiAgICA8dGl0bGU-TGl0IENTUyBDYW52YXM8L3RpdGxlPlxuICAgIDxzdHlsZT5cbiAgICAgIGJvZHkge1xuICAgICAgICBtYXJnaW46IDA7XG4gICAgICAgIHBhZGRpbmc6IDA7XG4gICAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgICBoZWlnaHQ6IDEwMHZoO1xuICAgICAgfVxuICAgIDwvc3R5bGU-XG4gICAgPHNjcmlwdCB0eXBlPVwibW9kdWxlXCIgc3JjPVwiLi9saXQtY3NzLWNhbnZhcy5qc1wiPjwvc2NyaXB0PlxuICA8L2hlYWQ-XG4gIDxib2R5PlxuICAgIDxjc3MtY2FudmFzPlxuICAgICAgPGltZ1xuICAgICAgICBzcmM9XCJodHRwczovL2xpdC5kZXYvaW1hZ2VzL2xvZ28uc3ZnXCJcbiAgICAgICAgYWx0PVwiTGl0IExvZ29cIlxuICAgICAgICB3aWR0aD1cIjUwMFwiXG4gICAgICAgIGhlaWdodD1cIjMzM1wiXG4gICAgICAgIHN0eWxlPVwiLS1keDogNTkuNDkwOXB4OyAtLWR5OiAzMi44NDI5cHhcIlxuICAgICAgLz5cbiAgICAgIDxzdmcgd2lkdGg9XCI0MDBcIiBoZWlnaHQ9XCIxMTBcIiBzdHlsZT1cIi0tZHg6IDIzMC4wNTdweDsgLS1keTogMzMuNjI1N3B4XCI-XG4gICAgICAgIDxyZWN0XG4gICAgICAgICAgd2lkdGg9XCI0MDBcIlxuICAgICAgICAgIGhlaWdodD1cIjEwMFwiXG4gICAgICAgICAgc3R5bGU9XCJmaWxsOiByZ2IoMCwgMCwgMjU1KTsgc3Ryb2tlLXdpZHRoOiAzOyBzdHJva2U6IHJnYigwLCAwLCAwKVwiXG4gICAgICAgIC8-XG4gICAgICA8L3N2Zz5cbiAgICAgIDxzdmcgaGVpZ2h0PVwiMTAwXCIgd2lkdGg9XCIxMDBcIj5cbiAgICAgICAgPGNpcmNsZVxuICAgICAgICAgIGN4PVwiNTBcIlxuICAgICAgICAgIGN5PVwiNTBcIlxuICAgICAgICAgIHI9XCI0MFwiXG4gICAgICAgICAgc3Ryb2tlPVwiYmxhY2tcIlxuICAgICAgICAgIHN0cm9rZS13aWR0aD1cIjNcIlxuICAgICAgICAgIGZpbGw9XCJyZWRcIlxuICAgICAgICAvPlxuICAgICAgPC9zdmc-XG4gICAgPC9jc3MtY2FudmFzPlxuICA8L2JvZHk-XG48L2h0bWw-XG4ifV0). diff --git a/lit-draggable-dom/index.html b/lit-draggable-dom/index.html new file mode 100644 index 0000000..85e9861 --- /dev/null +++ b/lit-draggable-dom/index.html @@ -0,0 +1,46 @@ + + + + + + + Lit Draggable DOM + + + + + + Lit Logo + + + + + + + + + diff --git a/lit-draggable-dom/package-lock.json b/lit-draggable-dom/package-lock.json new file mode 100644 index 0000000..881a9e0 --- /dev/null +++ b/lit-draggable-dom/package-lock.json @@ -0,0 +1,163 @@ +{ + "name": "lit-css-canvas", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@lit/reactive-element": { + "version": "1.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.0.0-rc.2.tgz", + "integrity": "sha512-cujeIl5Ei8FC7UHf4/4Q3bRJOtdTe1vpJV/JEBYCggedmQ+2P8A2oz7eE+Vxi6OJ4nc0X+KZxXnBoH4QrEbmEQ==" + }, + "@types/node": { + "version": "15.12.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz", + "integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==", + "dev": true + }, + "@types/trusted-types": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz", + "integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==" + }, + "colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "dev": true + }, + "esbuild": { + "version": "0.12.9", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.9.tgz", + "integrity": "sha512-MWRhAbMOJ9RJygCrt778rz/qNYgA4ZVj6aXnNPxFjs7PmIpb0fuB9Gmg5uWrr6n++XKwwm/RmSz6RR5JL2Ocsw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "lit": { + "version": "2.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.0.0-rc.2.tgz", + "integrity": "sha512-BOCuoJR04WaTV8UqTKk09cNcQA10Aq2LCcBOiHuF7TzWH5RNDsbCBP5QM9sLBSotGTXbDug/gFO08jq6TbyEtw==", + "requires": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-element": "^3.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + }, + "dependencies": { + "lit-element": { + "version": "3.0.0-rc.2", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.0.0-rc.2.tgz", + "integrity": "sha512-2Z7DabJ3b5K+p5073vFjMODoaWqy5PIaI4y6ADKm+fCGc8OnX9fU9dMoUEBZjFpd/bEFR9PBp050tUtBnT9XTQ==", + "requires": { + "@lit/reactive-element": "^1.0.0-rc.2", + "lit-html": "^2.0.0-rc.3" + } + }, + "lit-html": { + "version": "2.0.0-rc.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0-rc.3.tgz", + "integrity": "sha512-Y6P8LlAyQuqvzq6l/Nc4z5/P5M/rVLYKQIRxcNwSuGajK0g4kbcBFQqZmgvqKG+ak+dHZjfm2HUw9TF5N/pkCw==", + "requires": { + "@types/trusted-types": "^1.0.1" + } + } + } + }, + "nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "postcss": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz", + "integrity": "sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA==", + "dev": true, + "requires": { + "colorette": "^1.2.2", + "nanoid": "^3.1.23", + "source-map-js": "^0.6.2" + } + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.52.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.52.2.tgz", + "integrity": "sha512-4RlFC3k2BIHlUsJ9mGd8OO+9Lm2eDF5P7+6DNQOp5sx+7N/1tFM01kELfbxlMX3MxT6owvLB1ln4S3QvvQlbUA==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "dev": true + }, + "typescript": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz", + "integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==", + "dev": true + }, + "vite": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.3.8.tgz", + "integrity": "sha512-QiEx+iqNnJntSgSF2fWRQvRey9pORIrtNJzNyBJXwc+BdzWs83FQolX84cTBo393cfhObrtWa6180dAa4NLDiQ==", + "dev": true, + "requires": { + "esbuild": "^0.12.8", + "fsevents": "~2.3.2", + "postcss": "^8.3.4", + "resolve": "^1.20.0", + "rollup": "^2.38.5" + } + } + } +} diff --git a/lit-draggable-dom/package.json b/lit-draggable-dom/package.json new file mode 100644 index 0000000..361b1f1 --- /dev/null +++ b/lit-draggable-dom/package.json @@ -0,0 +1,16 @@ +{ + "name": "lit-css-canvas", + "version": "0.0.0", + "scripts": { + "dev": "vite --host", + "build": "tsc && vite build" + }, + "dependencies": { + "lit": "*" + }, + "devDependencies": { + "@types/node": "^15.12.4", + "typescript": "^4.3.2", + "vite": "^2.3.8" + } +} diff --git a/lit-draggable-dom/screenshot.png b/lit-draggable-dom/screenshot.png new file mode 100644 index 0000000..e9c3ebc Binary files /dev/null and b/lit-draggable-dom/screenshot.png differ diff --git a/lit-draggable-dom/src/draggable-dom.ts b/lit-draggable-dom/src/draggable-dom.ts new file mode 100644 index 0000000..60ec9ce --- /dev/null +++ b/lit-draggable-dom/src/draggable-dom.ts @@ -0,0 +1,173 @@ +import { html, css, LitElement } from "lit"; +import { customElement, query } from "lit/decorators.js"; + +type DragType = "none" | "canvas" | "element"; +type SupportedNode = HTMLElement | SVGElement; + +@customElement("draggable-dom") +export class DraggableDOM extends LitElement { + @query("main") root!: HTMLElement; + @query("#children") container!: HTMLElement; + @query("canvas") canvas!: HTMLCanvasElement; + dragType: DragType = "none"; + offset: Offset = { x: 0, y: 0 }; + pointerMap: Map = new Map(); + + static styles = css` + :host { + --offset-x: 0; + --offset-y: 0; + --grid-background-color: white; + --grid-color: black; + --grid-size: 40px; + --grid-dot-size: 1px; + } + main { + overflow: hidden; + } + canvas { + background-size: var(--grid-size) var(--grid-size); + background-image: radial-gradient( + circle, + var(--grid-color) var(--grid-dot-size), + var(--grid-background-color) var(--grid-dot-size) + ); + background-position: var(--offset-x) var(--offset-y); + z-index: 0; + } + .full-size { + width: 100%; + height: 100%; + position: fixed; + transform: translate(var(--dx), var(--dy)); + } + .child { + --dx: 0px; + --dy: 0px; + position: fixed; + flex-shrink: 1; + z-index: var(--layer, 0); + transform: translate(var(--dx), var(--dy)); + } + @media (prefers-color-scheme: dark) { + main { + --grid-background-color: black; + --grid-color: grey; + } + } + `; + + render() { + return html` +
this.handleDown(e, "canvas")} + @pointermove=${(e: any) => + this.handleMove(e, "canvas", (delta) => this.moveCanvas(delta))} + @touchstart=${(e: any) => this.handleDown(e, "canvas")} + @touchmove=${(e: any) => + this.handleMove(e, "canvas", (delta) => this.moveCanvas(delta))} + @pointerup=${(e: any) => this.handleUp(e)} + > + +
+ this.handleDown(e, "element")} + @pointermove=${(e: any) => + this.handleMove(e, "element", (delta) => { + this.moveElement( + e.target.parentElement === this + ? e.target + : e.target.parentElement, + delta + ); + })} + @touchstart=${(e: any) => this.handleDown(e, "element")} + @touchmove=${(e: any) => + this.handleMove(e, "element", (delta) => + this.moveElement( + e.target.parentElement === this + ? e.target + : e.target.parentElement, + delta + ) + )} + > +
+
+ `; + } + + handleDown(event: PointerEvent, type: DragType) { + if (this.dragType === "none") { + event.preventDefault(); + this.dragType = type; + (event.target as Element).setPointerCapture(event.pointerId); + this.pointerMap.set(event.pointerId, { + id: event.pointerId, + startPos: { x: event.clientX, y: event.clientY }, + currentPos: { x: event.clientX, y: event.clientY }, + }); + } + } + + handleMove( + event: PointerEvent, + type: DragType, + onMove: (delta: Offset) => void + ) { + if (this.dragType === type) { + event.preventDefault(); + const saved = this.pointerMap.get(event.pointerId)!; + const current = { ...saved.currentPos }; + saved.currentPos = { x: event.clientX, y: event.clientY }; + const delta = { + x: saved.currentPos.x - current.x, + y: saved.currentPos.y - current.y, + }; + onMove(delta); + } + } + + handleUp(event: PointerEvent) { + this.dragType = "none"; + (event.target as Element).releasePointerCapture(event.pointerId); + } + + moveCanvas(delta: Offset) { + this.offset.x += delta.x; + this.offset.y += delta.y; + this.root.style.setProperty("--offset-x", `${this.offset.x}px`); + this.root.style.setProperty("--offset-y", `${this.offset.y}px`); + this.container.style.setProperty("--dx", `${this.offset.x}px`); + this.container.style.setProperty("--dy", `${this.offset.y}px`); + } + + moveElement(child: SupportedNode, delta: Offset) { + const getNumber = (key: "--dx" | "--dy", fallback: number) => { + const saved = child.style.getPropertyValue(key); + if (saved.length > 0) { + return parseFloat(saved.replace("px", "")); + } + return fallback; + }; + const dx = getNumber("--dx", 0) + delta.x; + const dy = getNumber("--dy", 0) + delta.y; + child.style.transform = `translate(${dx}px, ${dy}px)`; + child.style.setProperty("--dx", `${dx}px`); + child.style.setProperty("--dy", `${dy}px`); + } +} + +interface Offset { + x: number; + y: number; +} + +interface PointerData { + id: number; + startPos: Offset; + currentPos: Offset; +} diff --git a/lit-draggable-dom/src/favicon.svg b/lit-draggable-dom/src/favicon.svg new file mode 100644 index 0000000..2c3a23d --- /dev/null +++ b/lit-draggable-dom/src/favicon.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lit-draggable-dom/src/vite-env.d.ts b/lit-draggable-dom/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/lit-draggable-dom/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/lit-draggable-dom/tsconfig.json b/lit-draggable-dom/tsconfig.json new file mode 100644 index 0000000..d17e916 --- /dev/null +++ b/lit-draggable-dom/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": ["es2017", "dom", "dom.iterable"], + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "./types", + "rootDir": "./src", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"], + "exclude": [] +} diff --git a/lit-draggable-dom/vite.config.ts b/lit-draggable-dom/vite.config.ts new file mode 100644 index 0000000..e926a60 --- /dev/null +++ b/lit-draggable-dom/vite.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; + +export default defineConfig({ + base: "/lit-draggable-dom/", + build: { + rollupOptions: { + input: { + main: resolve(__dirname, "index.html"), + }, + }, + }, +}); diff --git a/lit-file-based-routing/.github/workflows/ci.yml b/lit-file-based-routing/.github/workflows/ci.yml new file mode 100644 index 0000000..06937b7 --- /dev/null +++ b/lit-file-based-routing/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Demo + +on: + push: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist \ No newline at end of file diff --git a/lit-file-based-routing/.gitignore b/lit-file-based-routing/.gitignore new file mode 100644 index 0000000..759ef53 --- /dev/null +++ b/lit-file-based-routing/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +types +*.local diff --git a/lit-file-based-routing/LICENSE b/lit-file-based-routing/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/lit-file-based-routing/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/lit-file-based-routing/README.md b/lit-file-based-routing/README.md new file mode 100644 index 0000000..756d185 --- /dev/null +++ b/lit-file-based-routing/README.md @@ -0,0 +1,243 @@ +[![Demo](https://github.com/rodydavis/lit-file-based-routing/actions/workflows/ci.yml/badge.svg)](https://github.com/rodydavis/lit-file-based-routing/actions/workflows/ci.yml) + +# Lit File Based Routing + +Lit router for nested layouts and file based routing. Similar to https://remix.run/ but at client side. + +[Demo](https://rodydavis.github.io/lit-file-based-routing/#/dashboard/) + +[Package](/lit-file-router/) + +Archived in favor of: https://github.com/rodydavis/vscode-router-generator + +## Features + +- File based routing +- Nested layout + +## Defining a root layout + +To layout navigation once you will want to define a root layout that all pages can inherit from. + +```js +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("root-module") +export class RootModule extends LitElement { + static styles = css` + main { + display: flex; + flex-direction: row; + height: 100vh; + width: 100%; + } + aside { + display: flex; + flex-direction: column; + background-color: whitesmoke; + padding: 8px; + } + section { + flex: 1; + } + `; + + render() { + return html` +
+ +
+
+ `; + } +} + +``` + +## Defining a base layout + +You can define a base layout with the root name. For example: `dashboard.ts` + +```ts +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("dashboard-module") +export class DashboardModule extends LitElement { + static styles = css` + header { + height: 40px; + background-color: orange; + color: white; + display: flex; + flex-direction: row; + align-items: center; + padding-left: 10px; + padding-right: 10px; + justify-content: space-between; + } + `; + + render() { + return html`
+
+ Dashboard + +
+
+
`; + } +} + +``` + +If you notice the `` is used for the nested layout. + +## Defining the index route + +You can define the index route for when there are no args needed. For example: `dashboard/index.ts` + +```ts +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("dashboard-default") +export class DashboardDefault extends LitElement { + static styles = css``; + + render() { + return html`
Default Dashboard
`; + } +} + +``` + +Since this is a nested layout all you need to do is provide the component and it will inherit from the parent layout (dashboard.ts). + +## Defining a named arg + +You can define a named arg for a route if there is something that does not need data fetched for. For example: `/dashboard/overview.ts` + +```ts +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("overview-module") +export class OverviewModule extends LitElement { + static styles = css``; + + render() { + return html`
Overview
`; + } +} + +``` + +This is also just a component. + +## Defining a dynamic arg + +Sometimes the arg is generated at runtime or needs to be pulled from a database. For example: `dashboard/account/:id.ts` + +```ts +import { html, css, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +@customElement("account-details") +export class AccountDetails extends LitElement { + static styles = css``; + + @property({ type: String }) id = ""; + + render() { + return html`
User ID: ${this.id}
`; + } +} + +``` + +You can see we set the file name with a prefix of `:` to define an arg to look for and match against. This will be provided in a map. + +## Usage + +If you install the package locally you can run `node lit-file-router` to have `src/generated-app.ts` added as a file when it analyzes the `src/pages/` directory. + +```html + + + + +``` + +### Dynamic Imports + +You can have the components load async with dynamic imports using the following command: + +`node lit-file-router --dynamic-imports=true` + +By default it will use static imports and have everything loaded at runtime. + +### Data caching and loader function + +You can export a loader function that will be used to set data on the component: + +```js +import { html, css, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +export async function loader( + route: string, + args: { [key: string]: any } +): Promise { + await new Promise((resolve) => setTimeout(resolve, 1000)); + const id = args["id"]!; + return { + id, + name: "Name: " + id, + email: route, + }; +} + +@customElement("account-details") +export class AccountDetails extends LitElement { + static styles = css``; + + @property({ type: String }) id = ""; + @property({ type: Object }) data!: AccountData; + + render() { + return html`
User ID: ${this.data.id}
`; + } +} + +interface AccountData { + id: string; + name: string; + email: string; +} + +``` + +This will call the function to load the data before rendering starts. + +If you want to enable caching you can add the following command: + +`node lit-file-router --cache-all` + +It is off by default but it will cache the data from the loader function for the component and route and will pass the cached data from memory to the component. + +## Loading state + +You can pass show a progress indicator at the bottom by passing a loading arg: + +`node lit-file-router --show-loading=true` + +It is off by default, but this is useful for heavy requests that would hang the UI. diff --git a/lit-file-based-routing/index.html b/lit-file-based-routing/index.html new file mode 100644 index 0000000..b108728 --- /dev/null +++ b/lit-file-based-routing/index.html @@ -0,0 +1,19 @@ + + + + + + + Vite + Lit App + + + + + + + diff --git a/lit-file-based-routing/lit-file-router/.gitignore b/lit-file-based-routing/lit-file-router/.gitignore new file mode 100644 index 0000000..759ef53 --- /dev/null +++ b/lit-file-based-routing/lit-file-router/.gitignore @@ -0,0 +1,5 @@ +node_modules +.DS_Store +dist +types +*.local diff --git a/lit-file-based-routing/lit-file-router/package-lock.json b/lit-file-based-routing/lit-file-router/package-lock.json new file mode 100644 index 0000000..da22849 --- /dev/null +++ b/lit-file-based-routing/lit-file-router/package-lock.json @@ -0,0 +1,269 @@ +{ + "name": "lit-file-router", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==", + "dev": true + }, + "esbuild": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", + "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", + "dev": true, + "requires": { + "esbuild-android-arm64": "0.13.15", + "esbuild-darwin-64": "0.13.15", + "esbuild-darwin-arm64": "0.13.15", + "esbuild-freebsd-64": "0.13.15", + "esbuild-freebsd-arm64": "0.13.15", + "esbuild-linux-32": "0.13.15", + "esbuild-linux-64": "0.13.15", + "esbuild-linux-arm": "0.13.15", + "esbuild-linux-arm64": "0.13.15", + "esbuild-linux-mips64le": "0.13.15", + "esbuild-linux-ppc64le": "0.13.15", + "esbuild-netbsd-64": "0.13.15", + "esbuild-openbsd-64": "0.13.15", + "esbuild-sunos-64": "0.13.15", + "esbuild-windows-32": "0.13.15", + "esbuild-windows-64": "0.13.15", + "esbuild-windows-arm64": "0.13.15" + } + }, + "esbuild-android-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", + "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", + "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", + "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", + "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", + "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", + "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", + "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", + "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", + "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", + "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", + "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", + "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", + "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", + "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", + "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", + "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", + "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", + "dev": true, + "optional": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "nanoid": { + "version": "3.1.30", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", + "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "postcss": { + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", + "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", + "dev": true, + "requires": { + "nanoid": "^3.1.30", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.1" + } + }, + "resolve": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", + "dev": true, + "requires": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "rollup": { + "version": "2.63.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.63.0.tgz", + "integrity": "sha512-nps0idjmD+NXl6OREfyYXMn/dar3WGcyKn+KBzPdaLecub3x/LrId0wUcthcr8oZUAcZAR8NKcfGGFlNgGL1kQ==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "source-map-js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", + "dev": true + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, + "vite": { + "version": "2.7.10", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.7.10.tgz", + "integrity": "sha512-KEY96ntXUid1/xJihJbgmLZx7QSC2D4Tui0FdS0Old5OokYzFclcofhtxtjDdGOk/fFpPbHv9yw88+rB93Tb8w==", + "dev": true, + "requires": { + "esbuild": "^0.13.12", + "fsevents": "~2.3.2", + "postcss": "^8.4.5", + "resolve": "^1.20.0", + "rollup": "^2.59.0" + } + } + } +} diff --git a/lit-file-based-routing/lit-file-router/package.json b/lit-file-based-routing/lit-file-router/package.json new file mode 100644 index 0000000..97569b5 --- /dev/null +++ b/lit-file-based-routing/lit-file-router/package.json @@ -0,0 +1,20 @@ +{ + "type": "module", + "name": "lit-file-router", + "version": "0.0.0", + "main": "dist/index.js", + "types": "types/index.d.ts", + "files": [ + "dist", + "types" + ], + "scripts": { + "preinstall": "npm run build", + "build": "tsc" + }, + "dependencies": {}, + "devDependencies": { + "@types/node": "^17.0.8", + "typescript": "^4.4.4" + } +} \ No newline at end of file diff --git a/lit-file-based-routing/lit-file-router/src/analyze-page.ts b/lit-file-based-routing/lit-file-router/src/analyze-page.ts new file mode 100644 index 0000000..855274a --- /dev/null +++ b/lit-file-based-routing/lit-file-router/src/analyze-page.ts @@ -0,0 +1,56 @@ +export function analyzePage(path: string, content: string): WebComponent[] { + const components: WebComponent[] = []; + // Check for export function loader( or export async function loader( + let hasLoader = false; + const lines = content.split("\n"); + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + if ( + line.includes("export function loader(") || + line.includes("export async function loader(") + ) { + hasLoader = true; + break; + } + } + // Look for @customElement decorator and get the value + const regex = /@customElement\("([^"]+)"\)/g; + const matches = content.match(regex); + if (matches) { + for (const match of matches) { + const result = match.match(/@customElement\("([^"]+)"\)/); + if (result) { + const name = result[1]; + components.push({ + name, + path, + hasLoader, + }); + } + } + } + // Look for customElements.define() and get the value + const regex2 = /customElements\.define\("([^"]+)"/g; + const matches2 = content.match(regex2); + if (matches2) { + for (const match of matches2) { + const result = match.match(/customElements\.define\("([^"]+)"/); + if (result) { + const name = result[1]; + components.push({ + name, + path, + hasLoader, + }); + } + } + } + return components; +} + +export interface WebComponent { + name: string; + path: string; + alias?: string; + hasLoader: boolean; +} diff --git a/lit-file-based-routing/lit-file-router/src/generate-app.ts b/lit-file-based-routing/lit-file-router/src/generate-app.ts new file mode 100644 index 0000000..1e8a475 --- /dev/null +++ b/lit-file-based-routing/lit-file-router/src/generate-app.ts @@ -0,0 +1,264 @@ +import { WebComponent } from "./analyze-page"; +import { StringBuilder } from "./string-builder"; + +export function generateApp( + sb: StringBuilder, + components: WebComponent[], + options: { staticImports: boolean; cacheAll: boolean; showLoading: boolean } +) { + sb.writeln(`import { html, css, LitElement } from "lit";`); + sb.writeln( + `import { customElement, property, state } from "lit/decorators.js";` + ); + sb.writeln(); + sb.writeAll([ + '@customElement("generated-app")', + "export class GeneratedApp extends LitElement {", + " static styles = css`", + " main {", + " width: 100%;", + " height: 100%;", + " }", + ...(options.showLoading + ? [ + " progress {", + " position: absolute;", + " bottom: 0;", + " width: calc(100% - 1rem);", + " z-index: 1;", + " left: 0.5rem;", + " right: 0.5rem;", + " }", + ] + : []), + " `;", + "", + " @property() hash = 'true';", + " @property() base = '/';", + ...(options.showLoading ? [" @state() loading = false;"] : []), + " @property() route = this.getCurrentRoute();", + " @state() child = document.createElement('main');", + "", + ]); + if (options.cacheAll) { + sb.writeln(" dataCache = new Map();"); + } + sb.writeln(" components: Map = new Map(["); + for (const component of components) { + let path = component.path.replace("./src/pages/", "/"); + path = path.replace(".ts", ""); + path = path.replace(".js", ""); + path = path.replace("/index", "/"); + // Check if path contains . and convert to / + if (path.indexOf(".") > -1) { + path = path.split(".").join("/"); + } + if (path == "/root") path = ""; + // sb.writeln(` ["${path}", "${component.name}"],`);] + sb.writeln(` ["${path}", { + component: "${component.name}",`); + const componentImportPath = component.path + .replace("./src/", "./") + .replace(".ts", ".js"); + if (component.hasLoader) { + if (options.staticImports) { + sb.writeln(` loadData: async () => { + return ${component.alias}.loader; + },`); + } else { + sb.writeln(` loadData: async () => { + const {loader} = await import("${componentImportPath}"); + return loader; + },`); + } + } else { + sb.writeln(` loadData: async () => null,`); + } + if (options.staticImports) { + sb.writeln(` loadImport: async () => ${component.alias}, + }],`); + } else { + sb.writeln(` loadImport: () => import("${componentImportPath}"), + }],`); + } + } + sb.writeAll([ + " ]);", + "", + " firstUpdated() {", + ' window.addEventListener("hashchange", () => {', + " const oldRoute = this.route;", + " this.route = this.getCurrentRoute();", + " this.updateTree(oldRoute);", + " });", + " this.updateTree();", + " }", + "", + " render() {", + " return html` ${this.child} `;", + " }", + "", + " refresh() {", + " return this.updateTree();", + " }", + "", + " private async updateTree(oldRoute?:string) {", + " this.checkForIndex();", + " if (oldRoute) {", + " // TODO: Get delta between old and new route", + " }", + ...(options.showLoading + ? [ + ' const loadingElem = document.createElement("progress");', + " this.child.appendChild(loadingElem);", + ] + : []), + " const tree = await this.renderTree();", + " // Remove children", + " while (this.child.firstChild) {", + " this.child.removeChild(this.child.firstChild);", + " }", + " // Add new children", + " if (tree) this.child.appendChild(tree);", + " this.requestUpdate();", + " }", + "", + " private async renderTree() {", + " let _route = this.route;", + " const args = this.getArgsForRoute(_route);", + " const elements: Element[] = [];", + ' if (_route !== "/") {', + " while (_route.length > 0) {", + " const newChild = await this.getComponent(_route, args);", + " if (!newChild && _route === this.route) {", + ' const noChild = await this.getComponent("/404", args);', + " if (noChild) elements.push(noChild);", + " break;", + " }", + " if (newChild) elements.push(newChild);", + ' const parts = _route.split("/");', + " parts.pop();", + ' _route = parts.join("/");', + ' if (_route === "/") break;', + " }", + ' } else if (_route === "/") {', + ' const indexChild = await this.getComponent("/", args);', + " if (indexChild) elements.push(indexChild);", + " } else {", + ' const noChild = await this.getComponent("/404", args);', + " if (noChild) elements.push(noChild);", + " }", + ' const rootChild = await this.getComponent("", args);', + " if (rootChild) elements.push(rootChild);", + " let idx = elements.length - 1;", + " while (idx >= 1) {", + " const parent = elements[idx];", + " const child = elements[idx - 1];", + " if (child && parent) {", + " parent.appendChild(child);", + " }", + " idx--;", + " }", + " return elements.pop();", + " }", + "", + " private async getComponent(", + " path: string,", + " args: RegExpMatchArray | null", + " ) {", + " const applyArgs = (value: string, apply: boolean, data?: any) => {", + " const elem = document.createElement(value);", + " if (apply && args?.groups) {", + " for (const [key, value] of Object.entries(args.groups)) {", + " elem.setAttribute(key, value);", + " }", + " }", + " if (data) (elem as any).data = data;", + " return elem;", + " };", + " for (const [key, value] of Array.from(this.components.entries())) {", + " const hasArgs = path.match(fixRegex(key)) !== null;", + " if (key === path || path.match(fixRegex(key)) !== null) {", + ...(options.cacheAll + ? [ + " const cacheKey = `${path}:${value.component}`;", + " if (this.dataCache.has(cacheKey)) {", + " const data = this.dataCache.get(cacheKey)!;", + ...(options.staticImports + ? [] + : [" await value.loadImport();"]), + " return applyArgs(value.component, hasArgs, data);", + " }", + ] + : []), + " const getLoader = await value.loadData();", + " if (getLoader) {", + " const componentData = await getLoader(this.route, args ? Object(args)['groups'] : {});", + ...(options.cacheAll + ? [" this.dataCache.set(cacheKey, componentData);"] + : []), + ...(options.staticImports ? [] : [" await value.loadImport();"]), + " return applyArgs(value.component, hasArgs, componentData);", + " }", + ...(options.staticImports ? [] : [" await value.loadImport();"]), + " return applyArgs(value.component, hasArgs);", + " }", + " }", + " return null;", + " }", + "", + " private getArgsForRoute(route: string): RegExpMatchArray | null {", + " for (const key of Array.from(this.components.keys())) {", + " const regMatch = route.match(fixRegex(key));", + " if (regMatch !== null) return regMatch;", + " }", + " return null;", + " }", + "", + " private checkForIndex() {", + ' if (this.route === "" || this.route === "/") location.hash = "#/";', + ' if (this.route.endsWith("/")) return;', + " const indexArgs = this.getArgsForRoute(`${this.route}/`);", + " if (indexArgs !== null) {", + " location.hash = `#${this.route}/`;", + " }", + " }", + "", + " private getCurrentRoute() {", + ' let route = "/";', + ' if (this.hash === "true" && window.location.hash.length > 0) {', + " route = window.location.hash.slice(1);", + ' } else if (this.hash === "false") {', + ' const baseUrl = this.getAttribute("base") ?? "";', + " route = window.location.pathname.slice(baseUrl.length);", + " }", + " console.debug(`current route: ${route}`);", + " return route;", + " }", + "}", + "", + "function fixRegex(route: string): RegExp {", + ' const variableRegex = "[a-zA-Z0-9_-]+";', + " const nameWithParameters = route.replace(", + " new RegExp(`:(${variableRegex})`),", + " (match) => {", + " const groupName = match.slice(1);", + " return `(?<${groupName}>[a-zA-Z0-9_\\\\-.,:;+*^%$@!]+)`;", + " }", + " );", + " return new RegExp(`^${nameWithParameters}$`);", + "}", + "", + "interface Route {", + " component: string;", + " loadImport: () => Promise;", + " loadData: () => Promise;", + "}", + "", + "type RouteLoader = (", + " route: string,", + " args: { [key: string]: any }", + ") => Promise;", + ]); + sb.writeln(); +} diff --git a/lit-file-based-routing/lit-file-router/src/index.ts b/lit-file-based-routing/lit-file-router/src/index.ts new file mode 100644 index 0000000..ee3c439 --- /dev/null +++ b/lit-file-based-routing/lit-file-router/src/index.ts @@ -0,0 +1,91 @@ +import * as fs from "fs"; +import { analyzePage, WebComponent } from "./analyze-page.js"; +import { generateApp } from "./generate-app.js"; +import { StringBuilder } from "./string-builder.js"; + +let inputDir = "./src/pages"; +let outputFile = "./src/generated-app.ts"; +let staticImports = true; +let cacheAll = false; +let showLoading = false; + +const args = process.argv.slice(2); +if (args.length == 0) { + analyzePages(); +} else { + // Check for -dynamic-imports=false + const noDynamicImports = args.indexOf("--dynamic-imports=false") !== -1; + staticImports = noDynamicImports; + // Check for --input-dir= + const inputDirArg = args.find((arg) => arg.startsWith("--input-dir=")); + if (inputDirArg) { + inputDir = inputDirArg.replace("--input-dir=", ""); + } + // Check for --output-file= + const outputFileArg = args.find((arg) => arg.startsWith("--output-file=")); + if (outputFileArg) { + outputFile = outputFileArg.replace("--output-file=", ""); + } + // Check for --cache-all + const cacheAllArg = args.find((arg) => arg.startsWith("--cache-all")); + if (cacheAllArg) { + cacheAll = true; + } + // Check for --show-loading=false + const showLoadingArg = args.find((arg) => + arg.startsWith("--show-loading=true") + ); + showLoading = showLoadingArg ? true : false; + analyzePages(); +} + +function readPagesDirectory( + dir: string, + pages: { path: string; content: string }[] +) { + const files = fs.readdirSync(dir); + for (const file of files) { + if (fs.statSync(`${dir}/${file}`).isDirectory()) { + readPagesDirectory(`${dir}/${file}`, pages); + } else { + const path = `${dir}/${file}`; + const content = fs.readFileSync(path, "utf8"); + pages.push({ path, content }); + } + } +} + +async function analyzePages() { + const sb = new StringBuilder(); + // sb.writeln("// @ts-nocheck"); + // sb.writeln(); + let i = 0; + if (staticImports) { + sb.writeln(`// Page Routes`); + } + const components: WebComponent[] = []; + const pages: { path: string; content: string }[] = []; + readPagesDirectory(inputDir, pages); + for (const { path, content } of pages) { + // Add import + const results = analyzePage(path, content); + if (results.length > 0) { + const c = results[0]; + if (staticImports) { + const filePath = path.replace("./src/", "./"); + const jsPath = filePath.replace(".ts", ".js"); + c.alias = `route${i}`; + sb.writeln(`import * as ${c.alias} from "${jsPath}";`); + // if (c.hasLoader) { + // sb.writeln(`import {loader as ${c.alias}Loader} from "${jsPath}";`); + // } + } + components.push(c); + } + i++; + } + sb.writeln(); + generateApp(sb, components, { staticImports, cacheAll, showLoading }); + const output = sb.toString(); + fs.writeFileSync(outputFile, output); +} diff --git a/lit-file-based-routing/lit-file-router/src/string-builder.ts b/lit-file-based-routing/lit-file-router/src/string-builder.ts new file mode 100644 index 0000000..f67f7c9 --- /dev/null +++ b/lit-file-based-routing/lit-file-router/src/string-builder.ts @@ -0,0 +1,20 @@ +export class StringBuilder { + private _lines: string[] = []; + + write(line: string = ""): void { + this._lines.push(line); + } + + writeln(line: string = ""): void { + this._lines.push(line); + this._lines.push("\n"); + } + + writeAll(lines: string[]): void { + this._lines.push(lines.join("\n")); + } + + toString(): string { + return this._lines.join(""); + } +} diff --git a/lit-file-based-routing/lit-file-router/tsconfig.json b/lit-file-based-routing/lit-file-router/tsconfig.json new file mode 100644 index 0000000..d99140e --- /dev/null +++ b/lit-file-based-routing/lit-file-router/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": ["es2017", "dom", "dom.iterable"], + "declaration": true, + "emitDeclarationOnly": false, + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "useDefineForClassFields": false + }, + "include": ["src/**/*.ts"], + "exclude": [] +} diff --git a/lit-file-based-routing/package-lock.json b/lit-file-based-routing/package-lock.json new file mode 100644 index 0000000..b0606a9 --- /dev/null +++ b/lit-file-based-routing/package-lock.json @@ -0,0 +1,855 @@ +{ + "name": "lit-file-based-router", + "version": "0.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lit-file-based-router", + "version": "0.0.0", + "dependencies": { + "lit": "^2.0.2", + "lit-file-router": "file:lit-file-router" + }, + "devDependencies": { + "@types/node": "^17.0.8", + "typescript": "^4.4.4", + "vite": "^2.7.2" + } + }, + "lit-file-router": { + "version": "0.0.0", + "hasInstallScript": true, + "devDependencies": { + "@types/node": "^17.0.8", + "typescript": "^4.4.4" + } + }, + "lit-file-router/node_modules/@types/node": { + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==", + "dev": true + }, + "lit-file-router/node_modules/typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@lit/reactive-element": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.1.0.tgz", + "integrity": "sha512-CoJHyc/us1i/dn55PqqKRtVsq6osrGp6YfnSF0OBxT81Wu2razjgTSCn4HnaHn+dy5YE9CeX4BcuS45IaJ0+8A==" + }, + "node_modules/@types/node": { + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==", + "dev": true + }, + "node_modules/@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "node_modules/esbuild": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", + "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "optionalDependencies": { + "esbuild-android-arm64": "0.13.15", + "esbuild-darwin-64": "0.13.15", + "esbuild-darwin-arm64": "0.13.15", + "esbuild-freebsd-64": "0.13.15", + "esbuild-freebsd-arm64": "0.13.15", + "esbuild-linux-32": "0.13.15", + "esbuild-linux-64": "0.13.15", + "esbuild-linux-arm": "0.13.15", + "esbuild-linux-arm64": "0.13.15", + "esbuild-linux-mips64le": "0.13.15", + "esbuild-linux-ppc64le": "0.13.15", + "esbuild-netbsd-64": "0.13.15", + "esbuild-openbsd-64": "0.13.15", + "esbuild-sunos-64": "0.13.15", + "esbuild-windows-32": "0.13.15", + "esbuild-windows-64": "0.13.15", + "esbuild-windows-arm64": "0.13.15" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", + "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/esbuild-darwin-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", + "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", + "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", + "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", + "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-linux-32": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", + "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", + "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", + "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", + "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", + "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", + "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", + "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ] + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", + "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/esbuild-sunos-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", + "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ] + }, + "node_modules/esbuild-windows-32": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", + "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", + "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", + "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/lit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.1.0.tgz", + "integrity": "sha512-C0YoUUzxHA1S8gR7AmgD+k9GZlw3QD2ECgARo/jMx76RfVEAmEubF9t5sON9frMEZ++YvuokR5o8FgIUF7nnag==", + "dependencies": { + "@lit/reactive-element": "^1.1.0", + "lit-element": "^3.1.0", + "lit-html": "^2.1.0" + } + }, + "node_modules/lit-element": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.1.0.tgz", + "integrity": "sha512-4o5QiFwGSS1ViWWBV3nszQWTV0yAGY64zNrhQdwD+MNxRekIZpST7XqyzMQIJyKq+i9RFSTIdSURxPN1LsXGGA==", + "dependencies": { + "@lit/reactive-element": "^1.1.0", + "lit-html": "^2.1.0" + } + }, + "node_modules/lit-file-router": { + "resolved": "lit-file-router", + "link": true + }, + "node_modules/lit-html": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.1.0.tgz", + "integrity": "sha512-ptvlnfMBmLrs9yd8cCMOm85gc9YgICSJhOh53YEUGgEd6IGZBiEKMHgTjcoGxDvrVE7SG4alTa21aydLTWg3IA==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/nanoid": { + "version": "3.1.30", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", + "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", + "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", + "dev": true, + "dependencies": { + "nanoid": "^3.1.30", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + } + }, + "node_modules/resolve": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", + "dev": true, + "dependencies": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.63.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.63.0.tgz", + "integrity": "sha512-nps0idjmD+NXl6OREfyYXMn/dar3WGcyKn+KBzPdaLecub3x/LrId0wUcthcr8oZUAcZAR8NKcfGGFlNgGL1kQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/vite": { + "version": "2.7.10", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.7.10.tgz", + "integrity": "sha512-KEY96ntXUid1/xJihJbgmLZx7QSC2D4Tui0FdS0Old5OokYzFclcofhtxtjDdGOk/fFpPbHv9yw88+rB93Tb8w==", + "dev": true, + "dependencies": { + "esbuild": "^0.13.12", + "postcss": "^8.4.5", + "resolve": "^1.20.0", + "rollup": "^2.59.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": ">=12.2.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "less": "*", + "sass": "*", + "stylus": "*" + }, + "peerDependenciesMeta": { + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + } + } + } + }, + "dependencies": { + "@lit/reactive-element": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.1.0.tgz", + "integrity": "sha512-CoJHyc/us1i/dn55PqqKRtVsq6osrGp6YfnSF0OBxT81Wu2razjgTSCn4HnaHn+dy5YE9CeX4BcuS45IaJ0+8A==" + }, + "@types/node": { + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==", + "dev": true + }, + "@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "esbuild": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", + "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", + "dev": true, + "requires": { + "esbuild-android-arm64": "0.13.15", + "esbuild-darwin-64": "0.13.15", + "esbuild-darwin-arm64": "0.13.15", + "esbuild-freebsd-64": "0.13.15", + "esbuild-freebsd-arm64": "0.13.15", + "esbuild-linux-32": "0.13.15", + "esbuild-linux-64": "0.13.15", + "esbuild-linux-arm": "0.13.15", + "esbuild-linux-arm64": "0.13.15", + "esbuild-linux-mips64le": "0.13.15", + "esbuild-linux-ppc64le": "0.13.15", + "esbuild-netbsd-64": "0.13.15", + "esbuild-openbsd-64": "0.13.15", + "esbuild-sunos-64": "0.13.15", + "esbuild-windows-32": "0.13.15", + "esbuild-windows-64": "0.13.15", + "esbuild-windows-arm64": "0.13.15" + } + }, + "esbuild-android-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", + "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", + "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", + "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", + "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", + "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", + "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", + "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", + "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", + "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", + "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", + "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", + "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", + "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", + "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", + "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", + "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.13.15", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", + "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", + "dev": true, + "optional": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "lit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.1.0.tgz", + "integrity": "sha512-C0YoUUzxHA1S8gR7AmgD+k9GZlw3QD2ECgARo/jMx76RfVEAmEubF9t5sON9frMEZ++YvuokR5o8FgIUF7nnag==", + "requires": { + "@lit/reactive-element": "^1.1.0", + "lit-element": "^3.1.0", + "lit-html": "^2.1.0" + } + }, + "lit-element": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.1.0.tgz", + "integrity": "sha512-4o5QiFwGSS1ViWWBV3nszQWTV0yAGY64zNrhQdwD+MNxRekIZpST7XqyzMQIJyKq+i9RFSTIdSURxPN1LsXGGA==", + "requires": { + "@lit/reactive-element": "^1.1.0", + "lit-html": "^2.1.0" + } + }, + "lit-file-router": { + "version": "file:lit-file-router", + "requires": { + "@types/node": "^17.0.8", + "typescript": "^4.4.4" + }, + "dependencies": { + "@types/node": { + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==", + "dev": true + }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + } + } + }, + "lit-html": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.1.0.tgz", + "integrity": "sha512-ptvlnfMBmLrs9yd8cCMOm85gc9YgICSJhOh53YEUGgEd6IGZBiEKMHgTjcoGxDvrVE7SG4alTa21aydLTWg3IA==", + "requires": { + "@types/trusted-types": "^2.0.2" + } + }, + "nanoid": { + "version": "3.1.30", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", + "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "postcss": { + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", + "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", + "dev": true, + "requires": { + "nanoid": "^3.1.30", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.1" + } + }, + "resolve": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", + "dev": true, + "requires": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "rollup": { + "version": "2.63.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.63.0.tgz", + "integrity": "sha512-nps0idjmD+NXl6OREfyYXMn/dar3WGcyKn+KBzPdaLecub3x/LrId0wUcthcr8oZUAcZAR8NKcfGGFlNgGL1kQ==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "source-map-js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", + "dev": true + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, + "vite": { + "version": "2.7.10", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.7.10.tgz", + "integrity": "sha512-KEY96ntXUid1/xJihJbgmLZx7QSC2D4Tui0FdS0Old5OokYzFclcofhtxtjDdGOk/fFpPbHv9yw88+rB93Tb8w==", + "dev": true, + "requires": { + "esbuild": "^0.13.12", + "fsevents": "~2.3.2", + "postcss": "^8.4.5", + "resolve": "^1.20.0", + "rollup": "^2.59.0" + } + } + } +} diff --git a/lit-file-based-routing/package.json b/lit-file-based-routing/package.json new file mode 100644 index 0000000..878f067 --- /dev/null +++ b/lit-file-based-routing/package.json @@ -0,0 +1,22 @@ +{ + "name": "lit-file-based-router", + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "serve": "vite serve", + "start": "npm run dev", + "prebuild": "tsc && npm run generate", + "generate": "node lit-file-router --dynamic-imports=true --cache-all --show-loading=true" + }, + "dependencies": { + "lit": "^2.0.2", + "lit-file-router": "file:lit-file-router" + }, + "devDependencies": { + "@types/node": "^17.0.8", + "typescript": "^4.4.4", + "vite": "^2.7.2" + } +} diff --git a/lit-file-based-routing/src/components/menu-button.ts b/lit-file-based-routing/src/components/menu-button.ts new file mode 100644 index 0000000..0652a23 --- /dev/null +++ b/lit-file-based-routing/src/components/menu-button.ts @@ -0,0 +1,11 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("menu-button") +export class MenuButton extends LitElement { + static styles = css``; + + render() { + return html` `; + } +} diff --git a/lit-file-based-routing/src/favicon.svg b/lit-file-based-routing/src/favicon.svg new file mode 100644 index 0000000..de4aedd --- /dev/null +++ b/lit-file-based-routing/src/favicon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/lit-file-based-routing/src/generated-app.ts b/lit-file-based-routing/src/generated-app.ts new file mode 100644 index 0000000..20df23f --- /dev/null +++ b/lit-file-based-routing/src/generated-app.ts @@ -0,0 +1,261 @@ + +import { html, css, LitElement } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; + +@customElement("generated-app") +export class GeneratedApp extends LitElement { + static styles = css` + main { + width: 100%; + height: 100%; + } + progress { + position: absolute; + bottom: 0; + width: calc(100% - 1rem); + z-index: 1; + left: 0.5rem; + right: 0.5rem; + } + `; + + @property() hash = 'true'; + @property() base = '/'; + @state() loading = false; + @property() route = this.getCurrentRoute(); + @state() child = document.createElement('main'); + dataCache = new Map(); + components: Map = new Map([ + ["/404", { + component: "unknown-route", + loadData: async () => null, + loadImport: () => import("./pages/404.js"), + }], + ["/custom/not/nested/route", { + component: "custom-route", + loadData: async () => null, + loadImport: () => import("./pages/custom.not.nested.route.js"), + }], + ["/dashboard/account/:id", { + component: "account-details", + loadData: async () => { + const {loader} = await import("./pages/dashboard/account/:id.js"); + return loader; + }, + loadImport: () => import("./pages/dashboard/account/:id.js"), + }], + ["/dashboard/account/", { + component: "account-info", + loadData: async () => null, + loadImport: () => import("./pages/dashboard/account/index.js"), + }], + ["/dashboard/account", { + component: "account-module", + loadData: async () => null, + loadImport: () => import("./pages/dashboard/account.js"), + }], + ["/dashboard/", { + component: "dashboard-default", + loadData: async () => null, + loadImport: () => import("./pages/dashboard/index.js"), + }], + ["/dashboard/overview", { + component: "overview-module", + loadData: async () => null, + loadImport: () => import("./pages/dashboard/overview.js"), + }], + ["/dashboard", { + component: "dashboard-module", + loadData: async () => null, + loadImport: () => import("./pages/dashboard.js"), + }], + ["/", { + component: "app-module", + loadData: async () => null, + loadImport: () => import("./pages/index.js"), + }], + ["", { + component: "root-module", + loadData: async () => null, + loadImport: () => import("./pages/root.js"), + }], + ["/settings/admin", { + component: "admin-settings", + loadData: async () => null, + loadImport: () => import("./pages/settings/admin.js"), + }], + ["/settings/", { + component: "settings-default", + loadData: async () => null, + loadImport: () => import("./pages/settings/index.js"), + }], + ["/settings", { + component: "settings-module", + loadData: async () => null, + loadImport: () => import("./pages/settings.js"), + }], + ]); + + firstUpdated() { + window.addEventListener("hashchange", () => { + const oldRoute = this.route; + this.route = this.getCurrentRoute(); + this.updateTree(oldRoute); + }); + this.updateTree(); + } + + render() { + return html` ${this.child} `; + } + + refresh() { + return this.updateTree(); + } + + private async updateTree(oldRoute?:string) { + this.checkForIndex(); + if (oldRoute) { + // TODO: Get delta between old and new route + } + const loadingElem = document.createElement("progress"); + this.child.appendChild(loadingElem); + const tree = await this.renderTree(); + // Remove children + while (this.child.firstChild) { + this.child.removeChild(this.child.firstChild); + } + // Add new children + if (tree) this.child.appendChild(tree); + this.requestUpdate(); + } + + private async renderTree() { + let _route = this.route; + const args = this.getArgsForRoute(_route); + const elements: Element[] = []; + if (_route !== "/") { + while (_route.length > 0) { + const newChild = await this.getComponent(_route, args); + if (!newChild && _route === this.route) { + const noChild = await this.getComponent("/404", args); + if (noChild) elements.push(noChild); + break; + } + elements.push(newChild!); + const parts = _route.split("/"); + parts.pop(); + _route = parts.join("/"); + if (_route === "/") break; + } + } else if (_route === "/") { + const indexChild = await this.getComponent("/", args); + if (indexChild) elements.push(indexChild); + } else { + const noChild = await this.getComponent("/404", args); + if (noChild) elements.push(noChild); + } + const rootChild = await this.getComponent("", args); + if (rootChild) elements.push(rootChild); + let idx = elements.length - 1; + while (idx >= 1) { + const parent = elements[idx]; + const child = elements[idx - 1]; + if (child && parent) { + parent.appendChild(child); + } + idx--; + } + return elements.pop(); + } + + private async getComponent( + path: string, + args: RegExpMatchArray | null + ) { + const applyArgs = (value: string, apply: boolean, data?: any) => { + const elem = document.createElement(value); + if (apply && args?.groups) { + for (const [key, value] of Object.entries(args.groups)) { + elem.setAttribute(key, value); + } + } + if (data) (elem as any).data = data; + return elem; + }; + for (const [key, value] of Array.from(this.components.entries())) { + const hasArgs = path.match(fixRegex(key)) !== null; + if (key === path || path.match(fixRegex(key)) !== null) { + const cacheKey = `${path}:${value.component}`; + if (this.dataCache.has(cacheKey)) { + const data = this.dataCache.get(cacheKey)!; + await value.loadImport(); + return applyArgs(value.component, hasArgs, data); + } + const getLoader = await value.loadData(); + if (getLoader) { + const componentData = await getLoader(this.route, args ? Object(args)['groups'] : {}); + this.dataCache.set(cacheKey, componentData); + await value.loadImport(); + return applyArgs(value.component, hasArgs, componentData); + } + await value.loadImport(); + return applyArgs(value.component, hasArgs); + } + } + return null; + } + + private getArgsForRoute(route: string): RegExpMatchArray | null { + for (const key of Array.from(this.components.keys())) { + const regMatch = route.match(fixRegex(key)); + if (regMatch !== null) return regMatch; + } + return null; + } + + private checkForIndex() { + if (this.route === "" || this.route === "/") location.hash = "#/"; + if (this.route.endsWith("/")) return; + const indexArgs = this.getArgsForRoute(`${this.route}/`); + if (indexArgs !== null) { + location.hash = `#${this.route}/`; + } + } + + private getCurrentRoute() { + let route = "/"; + if (this.hash === "true" && window.location.hash.length > 0) { + route = window.location.hash.slice(1); + } else if (this.hash === "false") { + const baseUrl = this.getAttribute("base") ?? ""; + route = window.location.pathname.slice(baseUrl.length); + } + console.debug(`current route: ${route}`); + return route; + } +} + +function fixRegex(route: string): RegExp { + const variableRegex = "[a-zA-Z0-9_-]+"; + const nameWithParameters = route.replace( + new RegExp(`:(${variableRegex})`), + (match) => { + const groupName = match.slice(1); + return `(?<${groupName}>[a-zA-Z0-9_\\-.,:;+*^%$@!]+)`; + } + ); + return new RegExp(`^${nameWithParameters}$`); +} + +interface Route { + component: string; + loadImport: () => Promise; + loadData: () => Promise; +} + +type RouteLoader = ( + route: string, + args: { [key: string]: any } +) => Promise; + diff --git a/lit-file-based-routing/src/pages/404.ts b/lit-file-based-routing/src/pages/404.ts new file mode 100644 index 0000000..898ec34 --- /dev/null +++ b/lit-file-based-routing/src/pages/404.ts @@ -0,0 +1,13 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("unknown-route") +export class UnknownRoute extends LitElement { + static styles = css``; + + render() { + return html`
+
404
+
`; + } +} diff --git a/lit-file-based-routing/src/pages/custom.not.nested.route.ts b/lit-file-based-routing/src/pages/custom.not.nested.route.ts new file mode 100644 index 0000000..3e051a0 --- /dev/null +++ b/lit-file-based-routing/src/pages/custom.not.nested.route.ts @@ -0,0 +1,13 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("custom-route") +export class CustomRoute extends LitElement { + static styles = css``; + + render() { + return html`
+
Custom
+
`; + } +} diff --git a/lit-file-based-routing/src/pages/dashboard.ts b/lit-file-based-routing/src/pages/dashboard.ts new file mode 100644 index 0000000..815bc66 --- /dev/null +++ b/lit-file-based-routing/src/pages/dashboard.ts @@ -0,0 +1,35 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +import '../components/menu-button.js'; + +@customElement("dashboard-module") +export class DashboardModule extends LitElement { + static styles = css` + header { + height: 40px; + background-color: orange; + color: white; + display: flex; + flex-direction: row; + align-items: center; + padding-left: 10px; + padding-right: 10px; + justify-content: space-between; + } + `; + + render() { + return html`
+
+ + Dashboard + +
+
+
`; + } +} diff --git a/lit-file-based-routing/src/pages/dashboard/account.ts b/lit-file-based-routing/src/pages/dashboard/account.ts new file mode 100644 index 0000000..c8e7099 --- /dev/null +++ b/lit-file-based-routing/src/pages/dashboard/account.ts @@ -0,0 +1,11 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("account-module") +export class AccountModule extends LitElement { + static styles = css``; + + render() { + return html`
`; + } +} diff --git a/lit-file-based-routing/src/pages/dashboard/account/:id.ts b/lit-file-based-routing/src/pages/dashboard/account/:id.ts new file mode 100644 index 0000000..ad89afd --- /dev/null +++ b/lit-file-based-routing/src/pages/dashboard/account/:id.ts @@ -0,0 +1,33 @@ +import { html, css, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +export async function loader( + route: string, + args: { [key: string]: any } +): Promise { + await new Promise((resolve) => setTimeout(resolve, 1000)); + const id = args["id"]!; + return { + id, + route, + name: "Name: " + id, + }; +} + +@customElement("account-details") +export class AccountDetails extends LitElement { + static styles = css``; + + @property({ type: String }) id = ""; + @property({ type: Object }) data!: AccountData; + + render() { + return html`
${this.data.name}
`; + } +} + +interface AccountData { + id: string; + route: string; + name: string; +} diff --git a/lit-file-based-routing/src/pages/dashboard/account/index.ts b/lit-file-based-routing/src/pages/dashboard/account/index.ts new file mode 100644 index 0000000..ec82072 --- /dev/null +++ b/lit-file-based-routing/src/pages/dashboard/account/index.ts @@ -0,0 +1,22 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("account-info") +export class AccountInfo extends LitElement { + static styles = css` + article { + padding: 16px; + } + `; + + render() { + return html``; + } +} diff --git a/lit-file-based-routing/src/pages/dashboard/index.ts b/lit-file-based-routing/src/pages/dashboard/index.ts new file mode 100644 index 0000000..4a5f8e4 --- /dev/null +++ b/lit-file-based-routing/src/pages/dashboard/index.ts @@ -0,0 +1,11 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("dashboard-default") +export class DashboardDefault extends LitElement { + static styles = css``; + + render() { + return html`
Default Dashboard
`; + } +} diff --git a/lit-file-based-routing/src/pages/dashboard/overview.ts b/lit-file-based-routing/src/pages/dashboard/overview.ts new file mode 100644 index 0000000..82556bf --- /dev/null +++ b/lit-file-based-routing/src/pages/dashboard/overview.ts @@ -0,0 +1,11 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("overview-module") +export class OverviewModule extends LitElement { + static styles = css``; + + render() { + return html`
Overview
`; + } +} diff --git a/lit-file-based-routing/src/pages/index.ts b/lit-file-based-routing/src/pages/index.ts new file mode 100644 index 0000000..42d15ef --- /dev/null +++ b/lit-file-based-routing/src/pages/index.ts @@ -0,0 +1,24 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("app-module") +export class AppModule extends LitElement { + static styles = css` + header { + height: 40px; + background-color: navy; + color: white; + display: flex; + flex-direction: row; + align-items: center; + padding-left: 10px; + } + `; + + render() { + return html`
+
App Base
+ +
`; + } +} diff --git a/lit-file-based-routing/src/pages/root.ts b/lit-file-based-routing/src/pages/root.ts new file mode 100644 index 0000000..85c6cad --- /dev/null +++ b/lit-file-based-routing/src/pages/root.ts @@ -0,0 +1,36 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("root-module") +export class RootModule extends LitElement { + static styles = css` + main { + display: flex; + flex-direction: row; + height: 100vh; + width: 100%; + } + aside { + display: flex; + flex-direction: column; + background-color: whitesmoke; + padding: 8px; + } + section { + flex: 1; + } + `; + + render() { + return html` +
+ +
+
+ `; + } +} diff --git a/lit-file-based-routing/src/pages/settings.ts b/lit-file-based-routing/src/pages/settings.ts new file mode 100644 index 0000000..6c84e0f --- /dev/null +++ b/lit-file-based-routing/src/pages/settings.ts @@ -0,0 +1,31 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +import "../components/menu-button.js"; + +@customElement("settings-module") +export class SettingsModule extends LitElement { + static styles = css` + header { + height: 40px; + background-color: black; + color: white; + display: flex; + flex-direction: row; + align-items: center; + padding-left: 10px; + justify-content: space-between; + } + `; + + render() { + return html`
+
+ + Settings +
+
+ +
`; + } +} diff --git a/lit-file-based-routing/src/pages/settings/admin.ts b/lit-file-based-routing/src/pages/settings/admin.ts new file mode 100644 index 0000000..383717e --- /dev/null +++ b/lit-file-based-routing/src/pages/settings/admin.ts @@ -0,0 +1,11 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("admin-settings") +export class AdminSettings extends LitElement { + static styles = css``; + + render() { + return html`Admin Settings`; + } +} diff --git a/lit-file-based-routing/src/pages/settings/index.ts b/lit-file-based-routing/src/pages/settings/index.ts new file mode 100644 index 0000000..52c87cf --- /dev/null +++ b/lit-file-based-routing/src/pages/settings/index.ts @@ -0,0 +1,11 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +@customElement("settings-default") +export class SettingsDefault extends LitElement { + static styles = css``; + + render() { + return html`
Default Settings
`; + } +} diff --git a/lit-file-based-routing/src/vite-env.d.ts b/lit-file-based-routing/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/lit-file-based-routing/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/lit-file-based-routing/tsconfig.json b/lit-file-based-routing/tsconfig.json new file mode 100644 index 0000000..2aac243 --- /dev/null +++ b/lit-file-based-routing/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": [ + "es2017", + "dom", + "dom.iterable" + ], + "declaration": true, + // "emitDeclarationOnly": true, + "esModuleInterop": true, + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "useDefineForClassFields": false + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [] +} \ No newline at end of file diff --git a/lit-file-based-routing/vite.config.ts b/lit-file-based-routing/vite.config.ts new file mode 100644 index 0000000..aad012f --- /dev/null +++ b/lit-file-based-routing/vite.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from "vite"; + +// https://vitejs.dev/config/ +export default defineConfig({ + base: "/lit-file-based-routing/", + build: { + rollupOptions: { + input: "index.html", + }, + }, +}); diff --git a/lit-force-graph/.github/workflows/ci.yml b/lit-force-graph/.github/workflows/ci.yml new file mode 100644 index 0000000..dbcaaa5 --- /dev/null +++ b/lit-force-graph/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Demo + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist diff --git a/lit-force-graph/.gitignore b/lit-force-graph/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/lit-force-graph/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/lit-force-graph/README.md b/lit-force-graph/README.md new file mode 100644 index 0000000..774b6a3 --- /dev/null +++ b/lit-force-graph/README.md @@ -0,0 +1,16 @@ +# Lit Force Graph + +[![Demo](https://github.com/rodydavis/lit-force-graph/actions/workflows/ci.yml/badge.svg)](https://github.com/rodydavis/lit-force-graph/actions/workflows/ci.yml) + +[Lit](https://lit.dev) Example of how to take a json graph file and render it in 2D or 3D. + +You can try the demo [here](https://rodydavis.github.io/lit-force-graph/)! + +Here is the related [blog post](https://rodydavis.com/posts/lit-force-graph/). + +## Screenshots + +![](/screenshots/2d-light.png) +![](/screenshots/2d-dark.png) +![](/screenshots/3d-light.png) +![](/screenshots/3d-dark.png) diff --git a/lit-force-graph/index.html b/lit-force-graph/index.html new file mode 100644 index 0000000..f04d3bf --- /dev/null +++ b/lit-force-graph/index.html @@ -0,0 +1,65 @@ + + + + + + + Lit Force Graph + + + + + + + + + diff --git a/lit-force-graph/package-lock.json b/lit-force-graph/package-lock.json new file mode 100644 index 0000000..338e5cb --- /dev/null +++ b/lit-force-graph/package-lock.json @@ -0,0 +1,2826 @@ +{ + "name": "lit-force-graph", + "version": "0.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lit-force-graph", + "version": "0.0.0", + "dependencies": { + "@ar-js-org/ar.js": "^3.4.0-alpha-rc2", + "3d-force-graph": "^1.70.9", + "3d-force-graph-ar": "^1.7.5", + "3d-force-graph-vr": "^2.0.12", + "aframe": "^1.3.0", + "force-graph": "^1.42.9", + "lit": "^2.0.2", + "three": "^0.139.2", + "three-spritetext": "^1.6.5" + }, + "devDependencies": { + "@types/node": "^17.0.23", + "@types/three": "^0.139.0", + "typescript": "^4.5.4", + "vite": "^2.9.0" + } + }, + "node_modules/@ar-js-org/ar.js": { + "version": "3.4.0-alpha-rc2", + "resolved": "https://registry.npmjs.org/@ar-js-org/ar.js/-/ar.js-3.4.0-alpha-rc2.tgz", + "integrity": "sha512-KCU932cTpr/Ubi6/cQS59bx1QIc8XroBA4mEtAGIE7pfmjPFFx2d6gMzSVTlljh8gZBSVQavRHdga6oQ6ADBJg==", + "dependencies": { + "@ar-js-org/artoolkit5-js": "^0.1.3", + "aframe": "^1.0.4", + "three": "^0.133.0" + } + }, + "node_modules/@ar-js-org/ar.js/node_modules/three": { + "version": "0.133.1", + "resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz", + "integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw==" + }, + "node_modules/@ar-js-org/artoolkit5-js": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@ar-js-org/artoolkit5-js/-/artoolkit5-js-0.1.3.tgz", + "integrity": "sha512-VMaWxlM5RTftZjXeZ6PRExhec1DFySHy6IprhBeGHPIg8lJO27FwxaHqwWvY050ANjFZEGRhgjvEjaXEmEi76Q==", + "dependencies": { + "@babel/runtime": "^7.17.2", + "axios": "^0.26.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.9.tgz", + "integrity": "sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg==", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@lit/reactive-element": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.3.1.tgz", + "integrity": "sha512-nOJARIr3pReqK3hfFCSW2Zg/kFcFsSAlIE7z4a0C9D2dPrgD/YSn3ZP2ET/rxKB65SXyG7jJbkynBRm+tGlacw==" + }, + "node_modules/@tweenjs/tween.js": { + "version": "18.6.4", + "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-18.6.4.tgz", + "integrity": "sha512-lB9lMjuqjtuJrx7/kOkqQBtllspPIN+96OvTCeJ2j5FEzinoAXTdAMFnDAQT1KVPRlnYfBrqxtqP66vDM40xxQ==" + }, + "node_modules/@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==", + "dev": true + }, + "node_modules/@types/three": { + "version": "0.139.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.139.0.tgz", + "integrity": "sha512-4V/jZhyq7Mv05coUzxL3bz8AuBOSi/1F0RY7ujisHTV0Amy/fnYJ+s7TSJ1/hXjZukSkpuFRgV+wvWUEMbsMbQ==", + "dev": true + }, + "node_modules/@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "node_modules/3d-force-graph": { + "version": "1.70.9", + "resolved": "https://registry.npmjs.org/3d-force-graph/-/3d-force-graph-1.70.9.tgz", + "integrity": "sha512-K6VJqqoRT/9W+t6VV+e3c43Iu2jS4VzLhhG/ODDkQLFSwdszMNYMyD7x1xoUB/wuFz7sWgXFMsa0L5O2LsKp+w==", + "dependencies": { + "accessor-fn": "1", + "kapsule": "^1.13", + "three": ">=0.118 <1", + "three-forcegraph": "^1.39", + "three-render-objects": "^1.26" + } + }, + "node_modules/3d-force-graph-ar": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/3d-force-graph-ar/-/3d-force-graph-ar-1.7.5.tgz", + "integrity": "sha512-4aZafpHHAqn04tbb54Qsi3weBnZJhpnZNfO3RWTNAG29O5VamXxWOGpEHzTtKFi8Svr9D8Ath0UeFAMsiXqL0Q==", + "dependencies": { + "aframe-forcegraph-component": "^3.0", + "kapsule": "^1.13" + } + }, + "node_modules/3d-force-graph-vr": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/3d-force-graph-vr/-/3d-force-graph-vr-2.0.12.tgz", + "integrity": "sha512-+TDfBVT4Eqrc7PpmBxtrIxuk7+OJ76QwYj5dM/u1LVq3femf3qLz7uwk2f7t1hBUWvhfF8ub4idUSo+dL6CRbw==", + "dependencies": { + "accessor-fn": "1", + "aframe": "^1.2", + "aframe-extras": "^6.1", + "aframe-forcegraph-component": "^3.0", + "kapsule": "^1.13" + } + }, + "node_modules/accessor-fn": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/accessor-fn/-/accessor-fn-1.3.2.tgz", + "integrity": "sha512-W4/Lj/gry8AHy+IC7Havr7fNbphHDzVAiZd5h10g8LRRz6ZKla3A1/lkFqoV1jh13R0eJLGWjDBlRGK36fcWiw==" + }, + "node_modules/aframe": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/aframe/-/aframe-1.3.0.tgz", + "integrity": "sha512-f6OQaDf49SzdSxVskJPvPWldOwHpYMsGttmQHhU6FRiASsnyULKG1nqZom9pDuS3fFYEzQVqRMakQ2AhXeLkFg==", + "dependencies": { + "custom-event-polyfill": "^1.0.6", + "debug": "github:ngokevin/debug#noTimestamp", + "deep-assign": "^2.0.0", + "document-register-element": "github:dmarcos/document-register-element#8ccc532b7f3744be954574caf3072a5fd260ca90", + "load-bmfont": "^1.2.3", + "object-assign": "^4.0.1", + "present": "0.0.6", + "promise-polyfill": "^3.1.0", + "super-animejs": "^3.1.0", + "super-three": "^0.137.0", + "three-bmfont-text": "github:dmarcos/three-bmfont-text#21d017046216e318362c48abd1a48bddfb6e0733", + "webvr-polyfill": "^0.10.12" + }, + "engines": { + "node": ">= 4.6.0", + "npm": ">= 2.15.9" + } + }, + "node_modules/aframe-extras": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/aframe-extras/-/aframe-extras-6.1.1.tgz", + "integrity": "sha512-w3o3sKfQG+cwe1ZoKUxvMLehh0D/MlvFZeg2XuyIto+Nrs/kGLPcb/fsI5DXM4jociZ3wVQfqcA1BVF+0Nq45A==", + "dependencies": { + "three-pathfinding": "^0.7.0" + }, + "peerDependencies": { + "aframe": "*" + } + }, + "node_modules/aframe-forcegraph-component": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/aframe-forcegraph-component/-/aframe-forcegraph-component-3.0.5.tgz", + "integrity": "sha512-kSGV+0byfNzKONBxczz6Ao1s2/ECVzEA24iteVIT/jMjBFix2kcVFZvkg0PZyRU3TreZRS0jABkJ5kWPPWjlGQ==", + "dependencies": { + "accessor-fn": "1", + "three-forcegraph": "^1.39" + } + }, + "node_modules/an-array": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/an-array/-/an-array-1.0.0.tgz", + "integrity": "sha1-wSWlu4JXd4419LT2qpx9D6nkJmU=" + }, + "node_modules/array-shuffle": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-shuffle/-/array-shuffle-1.0.1.tgz", + "integrity": "sha1-fqSIKjVrS8pfVF4LblLq9tlxVXo=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/as-number": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/as-number/-/as-number-1.0.0.tgz", + "integrity": "sha1-rLJ+NPj52KsNqeN287iVmGD4CmY=" + }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/bezier-js": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/bezier-js/-/bezier-js-6.1.0.tgz", + "integrity": "sha512-oc8fkHqG0R+dQuNiXVbPMB0cc8iDqkLAjbA2gq26QmV8tZqW9GGI7iNEX1ioRWlZperQS7v5BX03+9FLVWZbSw==", + "funding": { + "type": "individual", + "url": "https://github.com/Pomax/bezierjs/blob/master/FUNDING.md" + } + }, + "node_modules/buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "node_modules/canvas-color-tracker": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/canvas-color-tracker/-/canvas-color-tracker-1.1.5.tgz", + "integrity": "sha512-J0tDDrMU2PJfmIVWwuaU1/uPZ+d3ISmpaYZLrvd7s27ydvafl3HgNzg00DEQHLcqRZLoelBLIm8aVvNCmB582g==", + "dependencies": { + "tinycolor2": "^1.4.2" + } + }, + "node_modules/cardboard-vr-display": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/cardboard-vr-display/-/cardboard-vr-display-1.0.19.tgz", + "integrity": "sha512-+MjcnWKAkb95p68elqZLDPzoiF/dGncQilLGvPBM5ZorABp/ao3lCs7nnRcYBckmuNkg1V/5rdGDKoUaCVsHzQ==", + "dependencies": { + "gl-preserve-state": "^1.0.0", + "nosleep.js": "^0.7.0", + "webvr-polyfill-dpdb": "^1.0.17" + } + }, + "node_modules/custom-event-polyfill": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/custom-event-polyfill/-/custom-event-polyfill-1.0.7.tgz", + "integrity": "sha512-TDDkd5DkaZxZFM8p+1I3yAlvM3rSr1wbrOliG4yJiwinMZN8z/iGL7BTlDkrJcYTmgUSb4ywVCc3ZaUtOtC76w==" + }, + "node_modules/d3-array": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.1.4.tgz", + "integrity": "sha512-H8lM97Gr9+LAR4WVHETCMt6LlWtLJVMCKsz1ojors+/PvAs2QqdLa20BuYvU11/DU+nLF0GVWL5Rv3jSgo2KmA==", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-binarytree": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/d3-binarytree/-/d3-binarytree-0.2.2.tgz", + "integrity": "sha512-TmgSEKWO4lSjX26Rk77hbTdiF3TQ1v5LqL+cmSz6/5RiSxmq6+e6qHE6X/KwrsIESekhEReH63X5yM8dvXaT7A==" + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-force-3d": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/d3-force-3d/-/d3-force-3d-3.0.3.tgz", + "integrity": "sha512-8HGTbw6y35UYManGCPU4+b9/PGgnyjzRq80DRsp7zFsRl0leVz2pzwx18dwkPe4rDxTOEpM4BuWQ2krbVaGQQA==", + "dependencies": { + "d3-binarytree": "^0.2.0", + "d3-dispatch": "1 - 3", + "d3-octree": "^0.2.0", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-octree": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/d3-octree/-/d3-octree-0.2.2.tgz", + "integrity": "sha512-ysk9uSPAhZVb0Gq4GXzghl/Yqxu80dHrq55I53qaIMdGB65+0UfO84sr4Fci2JHumcgh6H4WE0r8LwxPagkE+g==" + }, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale-chromatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz", + "integrity": "sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==", + "dependencies": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ==", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, + "node_modules/d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/data-joint": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/data-joint/-/data-joint-1.2.5.tgz", + "integrity": "sha512-OcGbcTctTq7AdiWAzJdktyzi5wVzv7q6291BsKLdxVdyrsx9pZLb9QIpxavWHMd+OS5DgJgfhgoM4jjF//DRqg==", + "dependencies": { + "index-array-by": "^1.3.1" + } + }, + "node_modules/debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" + }, + "node_modules/debug": { + "version": "2.2.0", + "resolved": "git+ssh://git@github.com/ngokevin/debug.git#ef5f8e66d49ce8bc64c6f282c15f8b7164409e3a", + "integrity": "sha512-rUI9wkpSlmwV2QQcE+jDnEdUPyRG+alTguuGlIJHW1PRMycHzpGy24htiAOiBdg6jYFXduQw4JuA1lvKh3DwzA==", + "license": "MIT" + }, + "node_modules/decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/deep-assign": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-2.0.0.tgz", + "integrity": "sha1-6+BrHwfwja5ZdiDj3RYi83GhxXI=", + "dependencies": { + "is-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/document-register-element": { + "version": "0.5.4", + "resolved": "git+ssh://git@github.com/dmarcos/document-register-element.git#8ccc532b7f3744be954574caf3072a5fd260ca90", + "integrity": "sha512-dwvGei9I/m1pYQ/9aNODyVmvSWBtlncfIROn5Sbi4MVnIcZKre5QaWx+AGLI/j6VH9sp8jwLyeuWP1micANT0g==", + "license": "MIT" + }, + "node_modules/dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "node_modules/dtype": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dtype/-/dtype-2.0.0.tgz", + "integrity": "sha1-zQUjI84GFETs0uj1dI9popvihDQ=", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/esbuild": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.32.tgz", + "integrity": "sha512-RuzVUP/bkStmnVHK6Gh3gjaMjfXNLqBqvYVDiS9JKl5KdRdRLUeW5Wo8NrbL7cL6CW7Cyak7SvACqyPOBuA8vA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "esbuild-android-64": "0.14.32", + "esbuild-android-arm64": "0.14.32", + "esbuild-darwin-64": "0.14.32", + "esbuild-darwin-arm64": "0.14.32", + "esbuild-freebsd-64": "0.14.32", + "esbuild-freebsd-arm64": "0.14.32", + "esbuild-linux-32": "0.14.32", + "esbuild-linux-64": "0.14.32", + "esbuild-linux-arm": "0.14.32", + "esbuild-linux-arm64": "0.14.32", + "esbuild-linux-mips64le": "0.14.32", + "esbuild-linux-ppc64le": "0.14.32", + "esbuild-linux-riscv64": "0.14.32", + "esbuild-linux-s390x": "0.14.32", + "esbuild-netbsd-64": "0.14.32", + "esbuild-openbsd-64": "0.14.32", + "esbuild-sunos-64": "0.14.32", + "esbuild-windows-32": "0.14.32", + "esbuild-windows-64": "0.14.32", + "esbuild-windows-arm64": "0.14.32" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.32.tgz", + "integrity": "sha512-q1qjB2UcoWehR9Yp9dO2RdJUeLLrXAYsbOU4tkYa+GmJzxTwuvOrMdvaemsXYqb7F4STVTca9KpfqGicEChtUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.32.tgz", + "integrity": "sha512-bs1uu+RuM15f8yjFc0FhPDE/6NID4fKl7beDVsGCme6Q8ld2IzRXmp5QaHurlcH93PFyQnUgVvdahIWgtK2QZw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.32.tgz", + "integrity": "sha512-6MekflAld28wYtzanwZTxQlxMPeYw/yv1ToFG2hpo3LGxOIE2mBD5IJaMCcyy1//EYvGnGToO3p6XKdbS8E1QQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.32.tgz", + "integrity": "sha512-BHYIjiPDYQTD+4zwqdqRo+I2bbg3fn9mah/gZm4SCCy+7uwTTYOYobIunHT7wVCgxnFCr50PJUdaMrEoCImRbw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.32.tgz", + "integrity": "sha512-6BOBhtfAf9AlfjL1AvtfVOxwY82tHPfYrA0lskJpFjfiEMGTLU6e0vdOwb4+4x++gGz49azuGK0woYqdfL03uw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.32.tgz", + "integrity": "sha512-zIRR4gKQW56p/xLM8TlpxVBNiX0w3VoR9ZxfH4nrfJ7QiL0SYHRy8YPL5C7zMWRjSze2WxQRHfS9bHKdVrVXBw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.32.tgz", + "integrity": "sha512-kn0AkGtPvzA6xiv93/mavvZ7DVinu/ewh2F2S0/8mE8/PXi3D4+svZ6V3beV5DIH7vcHVuGhoooWav8HPF04tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.32.tgz", + "integrity": "sha512-Ie+PMvrPj/HCOmSc0QubKttDxP2iBtPzDu+b+V3HGDGwkGmVpDkyXx1NXp5LjkIphIay2QekMwy1dSw3KDqCew==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.32.tgz", + "integrity": "sha512-R/Bvn/YQNDyvfN0SERh/I7hKPqN+nSSruQdVeiYEJ+jc3fUi73jXYAscpTQgIBeER/yXnEsgJGU/UQ9+sscr7A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.32.tgz", + "integrity": "sha512-ykoqKaxX95nB+lk2K/+qxr0ke+BxkeVi0yKOnymCR5Ive7IZDHa4BJX53NEGSBKLfWPwKE6SXTz8qcEewSntoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.32.tgz", + "integrity": "sha512-IilnlBexpHpt/5po0cle/L/S6CYnwaq23UuAqWzxp+opHLOCNnyANpC1jOoP551aRx4JuZ7z3xZZ7bYQZB147w==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.32.tgz", + "integrity": "sha512-TR6l5nWZbfq7jSY+1vsiQjT4m67NWplNhbX6GBieZq6DBt0nTx1XgTZAdKROF7jTuaK7YrCYlPXtfO3w86Mysw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.32.tgz", + "integrity": "sha512-aSOcUzTeIAslfri8e+bMpyzQuxhcIiNhWyuCGGXum2PtxwYiUqR8/UCMYfwYtYkhr1yABOFOfs83mm9KBy5qCQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.32.tgz", + "integrity": "sha512-dNlip+EvexxKjRZitFCWCd7DVk64c7R5ySr8aFEMHCb/RriNiyDxYJGzYWm4EMJsMRMupMUHlMY64BAa3Op9FA==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.32.tgz", + "integrity": "sha512-Pa3QByYqxzlBFQQQhjYBPg3WUfSjwibqzh1hC6mPDRUHnCeUcrLoBuIiG4xqOYEpQM9/kDowIBsrGIQEVWWdQA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.32.tgz", + "integrity": "sha512-uWKKqpCjkMY8TCIobFvaSETonQY3OrmgnoTCC3tF+lvMoneYjppB6akx7L5Xv0kP+1tnSbrIof1ca8PfqGUyjw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.32.tgz", + "integrity": "sha512-Ar+u3mBk0oVV4Fwv/qlinJZNIPPtTBSG+1W42o8lOaVxJ+rJgecDoeUN+5uyd9at0BK1SVrQ1qZ4wjHKB0qFpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.32.tgz", + "integrity": "sha512-rLMsbflMY6Hjh3rmQnCDVZahJQ7n+XfT6o1+no5pHRpDlMh38MHthgGh35q+EcOMgrGP3ppnw70rhJq80SaYTQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.32.tgz", + "integrity": "sha512-OHnMMxYufVgLXIMnwLynLMKguHMrsVnWcehieSP9i6ZX31KEsOFYWrorcnTWOn4rbZVLSL10ofxLuVIgRW3SWw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.32.tgz", + "integrity": "sha512-ddavy6IPUBySMfqDfG243TgtuqwQBNJQJPVaA4DaavmMfpBsUxFrSV+HzBWXTKU3I9EcuoEvIATLuQ7NJKxjwg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/flatten-vertex-data": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten-vertex-data/-/flatten-vertex-data-1.0.2.tgz", + "integrity": "sha512-BvCBFK2NZqerFTdMDgqfHBwxYWnxeCkwONsw6PvBMcUXqo8U/KDWwmXhqx1x2kLIg7DqIsJfOaJFOmlua3Lxuw==", + "dependencies": { + "dtype": "^2.0.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/force-graph": { + "version": "1.42.9", + "resolved": "https://registry.npmjs.org/force-graph/-/force-graph-1.42.9.tgz", + "integrity": "sha512-FvzRlVDGj78CnaQBtTIoGg3d+kV5ei2TBOQ/xrUSKuv9gk2pAmTLJEK8cLYtKYFMMc/v1QTqcRhW9aQA1KTzsw==", + "dependencies": { + "@tweenjs/tween.js": "18", + "accessor-fn": "1", + "bezier-js": "3 - 6", + "canvas-color-tracker": "1", + "d3-array": "1 - 3", + "d3-drag": "2 - 3", + "d3-force-3d": "2 - 3", + "d3-scale": "1 - 4", + "d3-scale-chromatic": "1 - 3", + "d3-selection": "2 - 3", + "d3-zoom": "2 - 3", + "index-array-by": "1", + "kapsule": "^1.13", + "lodash.throttle": "4" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/gl-preserve-state": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gl-preserve-state/-/gl-preserve-state-1.0.0.tgz", + "integrity": "sha512-zQZ25l3haD4hvgJZ6C9+s0ebdkW9y+7U2qxvGu1uWOJh8a4RU+jURIKEQhf8elIlFpMH6CrAY2tH0mYrRjet3Q==" + }, + "node_modules/global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "dependencies": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/index-array-by": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/index-array-by/-/index-array-by-1.3.2.tgz", + "integrity": "sha512-OIiTTJ4bfAcHTcMUZp3nmSpxAES+nARZNADnGBhg7OjywT8caxm3FR8fdnSnZIF1LvKDk5wN05oBF6qkVk2ZFg==" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "node_modules/is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "node_modules/is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kapsule": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/kapsule/-/kapsule-1.13.7.tgz", + "integrity": "sha512-CKhyHyKyz5bYehAzz95U0ji5T9f4P0RXXPqQ2tGKjuTz3bJnHIUj8vCzGjnhFZ4XYtVT2wMvIq8D8Awb5rawcQ==", + "dependencies": { + "debounce": "^1.2.1" + } + }, + "node_modules/layout-bmfont-text": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/layout-bmfont-text/-/layout-bmfont-text-1.3.4.tgz", + "integrity": "sha1-8g8sVGR3T0jabOipl/vObUaUW4E=", + "dependencies": { + "as-number": "^1.0.0", + "word-wrapper": "^1.0.7", + "xtend": "^4.0.0" + } + }, + "node_modules/lit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.2.2.tgz", + "integrity": "sha512-eN3+2QRHn/erxYB88AXiiRgQA6RltE9MhzySCwX+ACOxA/MLWN3VdXvcbZD9PN09zmUwlgzDvW3T84YWj2Sa0A==", + "dependencies": { + "@lit/reactive-element": "^1.3.0", + "lit-element": "^3.2.0", + "lit-html": "^2.2.0" + } + }, + "node_modules/lit-element": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.0.tgz", + "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==", + "dependencies": { + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.2.0" + } + }, + "node_modules/lit-html": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.2.2.tgz", + "integrity": "sha512-cJofCRXuizwyaiGt9pJjJOcauezUlSB6t87VBXsPwRhbzF29MgD8GH6fZ0BuZdXAAC02IRONZBd//VPUuU8QbQ==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/load-bmfont": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", + "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", + "dependencies": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^2.9.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "node_modules/lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" + }, + "node_modules/map-limit": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/map-limit/-/map-limit-0.0.1.tgz", + "integrity": "sha1-63lhAxwPDo0AG/LVb6toXViCLzg=", + "dependencies": { + "once": "~1.3.0" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "dependencies": { + "dom-walk": "^0.1.0" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "node_modules/nanoid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.2.tgz", + "integrity": "sha512-CuHBogktKwpm5g2sRgv83jEy2ijFzBwMoYA60orPDR7ynsLijJDqgsi4RDGj3OJpy3Ieb+LYwiRmIOGyytgITA==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/new-array": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/new-array/-/new-array-1.0.0.tgz", + "integrity": "sha1-XbxjnZYerH8an7wacUbsEvKST78=" + }, + "node_modules/ngraph.events": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ngraph.events/-/ngraph.events-1.2.1.tgz", + "integrity": "sha512-D4C+nXH/RFxioGXQdHu8ELDtC6EaCiNsZtih0IvyGN81OZSUby4jXoJ5+RNWasfsd0FnKxxpAROyUMzw64QNsw==" + }, + "node_modules/ngraph.forcelayout": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ngraph.forcelayout/-/ngraph.forcelayout-3.3.0.tgz", + "integrity": "sha512-EWqG8oSEueByuisyFl/c77M0+ts8g+dpNseafXFO71f0PvvZgzQ1zac1yO9CJVK6e94kbkvztgjDX3oQZ/4lVA==", + "dependencies": { + "ngraph.events": "^1.0.0", + "ngraph.merge": "^1.0.0", + "ngraph.random": "^1.0.0" + } + }, + "node_modules/ngraph.graph": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/ngraph.graph/-/ngraph.graph-20.0.0.tgz", + "integrity": "sha512-tJqmik6U5geNDSbmTSwm4R6coTMDbkfFFHD8wdeSJtKU/cxIWFsKtXuwMva/wTk6tQQl1C2//lrzmwfPJXAXHw==", + "dependencies": { + "ngraph.events": "^1.2.1" + } + }, + "node_modules/ngraph.merge": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ngraph.merge/-/ngraph.merge-1.0.0.tgz", + "integrity": "sha512-5J8YjGITUJeapsomtTALYsw7rFveYkM+lBj3QiYZ79EymQcuri65Nw3knQtFxQBU1r5iOaVRXrSwMENUPK62Vg==" + }, + "node_modules/ngraph.random": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ngraph.random/-/ngraph.random-1.1.0.tgz", + "integrity": "sha512-h25UdUN/g8U7y29TzQtRm/GvGr70lK37yQPvPKXXuVfs7gCm82WipYFZcksQfeKumtOemAzBIcT7lzzyK/edLw==" + }, + "node_modules/nice-color-palettes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nice-color-palettes/-/nice-color-palettes-1.0.1.tgz", + "integrity": "sha1-h16gHchu+uf1leBmqLJmDnIGBT4=", + "dependencies": { + "map-limit": "0.0.1", + "minimist": "^1.2.0", + "new-array": "^1.0.0", + "xhr-request": "^1.0.1" + }, + "bin": { + "nice-color-palettes": "bin/index.js" + } + }, + "node_modules/nosleep.js": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.7.0.tgz", + "integrity": "sha1-z9kZwlUjyg0PSmn7MwXAg62u4ok=" + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha1-Eaw8P/WPfCAgqyJ2kHkQjU36AoU=" + }, + "node_modules/parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha1-0Di0dtPp3Z2x4RoLDlOiJ5K2kAY=" + }, + "node_modules/parse-bmfont-xml": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", + "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", + "dependencies": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.4.5" + } + }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/polished": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/polished/-/polished-4.2.2.tgz", + "integrity": "sha512-Sz2Lkdxz6F2Pgnpi9U5Ng/WdWAUZxmHrNPoVlm3aAemxoy2Qy7LGjQg4uf8qKelDAUW94F4np3iH2YPf2qefcQ==", + "dependencies": { + "@babel/runtime": "^7.17.8" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/postcss": { + "version": "8.4.12", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz", + "integrity": "sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "dependencies": { + "nanoid": "^3.3.1", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/present": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/present/-/present-0.0.6.tgz", + "integrity": "sha1-nu/3ANqp6ZhhM1Lkf3rCMk1PrwI=" + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/promise-polyfill": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-3.1.0.tgz", + "integrity": "sha1-YpUrAdBZsRW0MnY7fvRhuA9t9H0=" + }, + "node_modules/quad-indices": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/quad-indices/-/quad-indices-2.0.1.tgz", + "integrity": "sha1-ppQdiaE9Y+7WwdSlpiGgRjYXqBQ=", + "dependencies": { + "an-array": "^1.0.0", + "dtype": "^2.0.0", + "is-buffer": "^1.0.2" + } + }, + "node_modules/query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "dependencies": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + }, + "node_modules/resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.70.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.70.1.tgz", + "integrity": "sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", + "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "dependencies": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/super-animejs": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/super-animejs/-/super-animejs-3.1.0.tgz", + "integrity": "sha512-6MFAFJDRuvwkovxQZPruuyHinTa4rgj4hNLOndjcYYhZLckoXtVRY9rJPuq8p6c/tgZJrFYEAYAfJ2/hhNtUCA==" + }, + "node_modules/super-three": { + "version": "0.137.0", + "resolved": "https://registry.npmjs.org/super-three/-/super-three-0.137.0.tgz", + "integrity": "sha512-8jM8DiYiXQoalUoeFRxKWbW6KFQo3GFwgw+3vE2y6SJU/einw+JvuvgK+WhbIYRfz4LQV68nyOQ2eEZqAuouGw==" + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/three": { + "version": "0.139.2", + "resolved": "https://registry.npmjs.org/three/-/three-0.139.2.tgz", + "integrity": "sha512-gV7q7QY8rogu7HLFZR9cWnOQAUedUhu2WXAnpr2kdXZP9YDKsG/0ychwQvWkZN5PlNw9mv5MoCTin6zNTXoONg==" + }, + "node_modules/three-bmfont-text": { + "version": "2.4.0", + "resolved": "git+ssh://git@github.com/dmarcos/three-bmfont-text.git#21d017046216e318362c48abd1a48bddfb6e0733", + "integrity": "sha512-lIMa1n+QKNU1f/LZgtS1oUGpoop3MuVXrUr5ybZOUR3+Jk//zjqScnQpHml6MWyvZzL8A5/1Hd8Tsqd3M1kudA==", + "license": "MIT", + "dependencies": { + "array-shuffle": "^1.0.1", + "inherits": "^2.0.1", + "layout-bmfont-text": "^1.2.0", + "nice-color-palettes": "^1.0.1", + "object-assign": "^4.0.1", + "quad-indices": "^2.0.1", + "three-buffer-vertex-data": "dmarcos/three-buffer-vertex-data#69378fc58daf27d3b1d930df9f233473e4a4818c" + } + }, + "node_modules/three-buffer-vertex-data": { + "version": "1.1.0", + "resolved": "git+ssh://git@github.com/dmarcos/three-buffer-vertex-data.git#69378fc58daf27d3b1d930df9f233473e4a4818c", + "integrity": "sha512-ZPCCbGfueRzd2/YwH136UnVN+N11Mvxu7uPaEzIdtuk0m5HPs1LGXOM5hOkpxamjvqSC6MDJ3nd11grGi7sMKw==", + "license": "MIT", + "dependencies": { + "flatten-vertex-data": "^1.0.0" + } + }, + "node_modules/three-forcegraph": { + "version": "1.39.4", + "resolved": "https://registry.npmjs.org/three-forcegraph/-/three-forcegraph-1.39.4.tgz", + "integrity": "sha512-kbycJcG98q/mwMJ5YIHIDz0nH2Fd8smpudc3QM2eoQPlf2cT7o1dzmrHWggUNnako4sWn7OybWypDSGf/S5/wg==", + "dependencies": { + "accessor-fn": "1", + "d3-array": "1 - 3", + "d3-force-3d": "2 - 3", + "d3-scale": "1 - 4", + "d3-scale-chromatic": "1 - 3", + "data-joint": "^1.2", + "kapsule": "^1.13", + "ngraph.forcelayout": "^3.3", + "ngraph.graph": "^20.0", + "tinycolor2": "^1.4" + }, + "peerDependencies": { + "three": ">=0.118.3" + } + }, + "node_modules/three-pathfinding": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/three-pathfinding/-/three-pathfinding-0.7.0.tgz", + "integrity": "sha512-UwWvzgio1UFe81n5jKHNzB4B+AG3wfZ54OKp7bTb1MHuC3cy6RTtr0dbbiPQQoqxzr+DRArR2DUwQSEknw5+nw==" + }, + "node_modules/three-render-objects": { + "version": "1.26.8", + "resolved": "https://registry.npmjs.org/three-render-objects/-/three-render-objects-1.26.8.tgz", + "integrity": "sha512-pCu439/SM2OOnDB71a52b005TGP7Hk1e0h7kBoCHaiQK9lmxXIpatDy9RdcQjz5Vx1Ug1Hsywcasq0pSlvxjCQ==", + "dependencies": { + "@tweenjs/tween.js": "18", + "accessor-fn": "1", + "kapsule": "^1.13", + "polished": "4" + }, + "peerDependencies": { + "three": "*" + } + }, + "node_modules/three-spritetext": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/three-spritetext/-/three-spritetext-1.6.5.tgz", + "integrity": "sha512-ttA1ce3tJz6OFojLGY3VjtqF9johetq50TztYcPFWqdEUrwPmej5XXcHahVyQGd88FHRDzJmW2rW3zSifUsdYA==", + "peerDependencies": { + "three": ">=0.86.0" + } + }, + "node_modules/timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinycolor2": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==", + "engines": { + "node": "*" + } + }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "node_modules/vite": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.1.tgz", + "integrity": "sha512-vSlsSdOYGcYEJfkQ/NeLXgnRv5zZfpAsdztkIrs7AZHV8RCMZQkwjo4DS5BnrYTqoWqLoUe1Cah4aVO4oNNqCQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.14.27", + "postcss": "^8.4.12", + "resolve": "^1.22.0", + "rollup": "^2.59.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": ">=12.2.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "less": "*", + "sass": "*", + "stylus": "*" + }, + "peerDependenciesMeta": { + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + } + } + }, + "node_modules/webvr-polyfill": { + "version": "0.10.12", + "resolved": "https://registry.npmjs.org/webvr-polyfill/-/webvr-polyfill-0.10.12.tgz", + "integrity": "sha512-trDJEVUQnRIVAnmImjEQ0BlL1NfuWl8+eaEdu+bs4g59c7OtETi/5tFkgEFDRaWEYwHntXs/uFF3OXZuutNGGA==", + "dependencies": { + "cardboard-vr-display": "^1.0.19" + } + }, + "node_modules/webvr-polyfill-dpdb": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/webvr-polyfill-dpdb/-/webvr-polyfill-dpdb-1.0.18.tgz", + "integrity": "sha512-O0S1ZGEWyPvyZEkS2VbyV7mtir/NM9MNK3EuhbHPoJ8EHTky2pTXehjIl+IiDPr+Lldgx129QGt3NGly7rwRPw==" + }, + "node_modules/word-wrapper": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/word-wrapper/-/word-wrapper-1.0.7.tgz", + "integrity": "sha1-HxSv6/Zt/fD+9V79NxhO+9CMKLY=" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "dependencies": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "node_modules/xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "dependencies": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "node_modules/xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig=" + }, + "node_modules/xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + } + }, + "dependencies": { + "@ar-js-org/ar.js": { + "version": "3.4.0-alpha-rc2", + "resolved": "https://registry.npmjs.org/@ar-js-org/ar.js/-/ar.js-3.4.0-alpha-rc2.tgz", + "integrity": "sha512-KCU932cTpr/Ubi6/cQS59bx1QIc8XroBA4mEtAGIE7pfmjPFFx2d6gMzSVTlljh8gZBSVQavRHdga6oQ6ADBJg==", + "requires": { + "@ar-js-org/artoolkit5-js": "^0.1.3", + "aframe": "^1.0.4", + "three": "^0.133.0" + }, + "dependencies": { + "three": { + "version": "0.133.1", + "resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz", + "integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw==" + } + } + }, + "@ar-js-org/artoolkit5-js": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@ar-js-org/artoolkit5-js/-/artoolkit5-js-0.1.3.tgz", + "integrity": "sha512-VMaWxlM5RTftZjXeZ6PRExhec1DFySHy6IprhBeGHPIg8lJO27FwxaHqwWvY050ANjFZEGRhgjvEjaXEmEi76Q==", + "requires": { + "@babel/runtime": "^7.17.2", + "axios": "^0.26.0" + } + }, + "@babel/runtime": { + "version": "7.17.9", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.9.tgz", + "integrity": "sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@lit/reactive-element": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.3.1.tgz", + "integrity": "sha512-nOJARIr3pReqK3hfFCSW2Zg/kFcFsSAlIE7z4a0C9D2dPrgD/YSn3ZP2ET/rxKB65SXyG7jJbkynBRm+tGlacw==" + }, + "@tweenjs/tween.js": { + "version": "18.6.4", + "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-18.6.4.tgz", + "integrity": "sha512-lB9lMjuqjtuJrx7/kOkqQBtllspPIN+96OvTCeJ2j5FEzinoAXTdAMFnDAQT1KVPRlnYfBrqxtqP66vDM40xxQ==" + }, + "@types/node": { + "version": "17.0.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", + "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==", + "dev": true + }, + "@types/three": { + "version": "0.139.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.139.0.tgz", + "integrity": "sha512-4V/jZhyq7Mv05coUzxL3bz8AuBOSi/1F0RY7ujisHTV0Amy/fnYJ+s7TSJ1/hXjZukSkpuFRgV+wvWUEMbsMbQ==", + "dev": true + }, + "@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "3d-force-graph": { + "version": "1.70.9", + "resolved": "https://registry.npmjs.org/3d-force-graph/-/3d-force-graph-1.70.9.tgz", + "integrity": "sha512-K6VJqqoRT/9W+t6VV+e3c43Iu2jS4VzLhhG/ODDkQLFSwdszMNYMyD7x1xoUB/wuFz7sWgXFMsa0L5O2LsKp+w==", + "requires": { + "accessor-fn": "1", + "kapsule": "^1.13", + "three": ">=0.118 <1", + "three-forcegraph": "^1.39", + "three-render-objects": "^1.26" + } + }, + "3d-force-graph-ar": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/3d-force-graph-ar/-/3d-force-graph-ar-1.7.5.tgz", + "integrity": "sha512-4aZafpHHAqn04tbb54Qsi3weBnZJhpnZNfO3RWTNAG29O5VamXxWOGpEHzTtKFi8Svr9D8Ath0UeFAMsiXqL0Q==", + "requires": { + "aframe-forcegraph-component": "^3.0", + "kapsule": "^1.13" + } + }, + "3d-force-graph-vr": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/3d-force-graph-vr/-/3d-force-graph-vr-2.0.12.tgz", + "integrity": "sha512-+TDfBVT4Eqrc7PpmBxtrIxuk7+OJ76QwYj5dM/u1LVq3femf3qLz7uwk2f7t1hBUWvhfF8ub4idUSo+dL6CRbw==", + "requires": { + "accessor-fn": "1", + "aframe": "^1.2", + "aframe-extras": "^6.1", + "aframe-forcegraph-component": "^3.0", + "kapsule": "^1.13" + } + }, + "accessor-fn": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/accessor-fn/-/accessor-fn-1.3.2.tgz", + "integrity": "sha512-W4/Lj/gry8AHy+IC7Havr7fNbphHDzVAiZd5h10g8LRRz6ZKla3A1/lkFqoV1jh13R0eJLGWjDBlRGK36fcWiw==" + }, + "aframe": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/aframe/-/aframe-1.3.0.tgz", + "integrity": "sha512-f6OQaDf49SzdSxVskJPvPWldOwHpYMsGttmQHhU6FRiASsnyULKG1nqZom9pDuS3fFYEzQVqRMakQ2AhXeLkFg==", + "requires": { + "custom-event-polyfill": "^1.0.6", + "debug": "github:ngokevin/debug#noTimestamp", + "deep-assign": "^2.0.0", + "document-register-element": "github:dmarcos/document-register-element#8ccc532b7f3744be954574caf3072a5fd260ca90", + "load-bmfont": "^1.2.3", + "object-assign": "^4.0.1", + "present": "0.0.6", + "promise-polyfill": "^3.1.0", + "super-animejs": "^3.1.0", + "super-three": "^0.137.0", + "three-bmfont-text": "github:dmarcos/three-bmfont-text#21d017046216e318362c48abd1a48bddfb6e0733", + "webvr-polyfill": "^0.10.12" + } + }, + "aframe-extras": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/aframe-extras/-/aframe-extras-6.1.1.tgz", + "integrity": "sha512-w3o3sKfQG+cwe1ZoKUxvMLehh0D/MlvFZeg2XuyIto+Nrs/kGLPcb/fsI5DXM4jociZ3wVQfqcA1BVF+0Nq45A==", + "requires": { + "three-pathfinding": "^0.7.0" + } + }, + "aframe-forcegraph-component": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/aframe-forcegraph-component/-/aframe-forcegraph-component-3.0.5.tgz", + "integrity": "sha512-kSGV+0byfNzKONBxczz6Ao1s2/ECVzEA24iteVIT/jMjBFix2kcVFZvkg0PZyRU3TreZRS0jABkJ5kWPPWjlGQ==", + "requires": { + "accessor-fn": "1", + "three-forcegraph": "^1.39" + } + }, + "an-array": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/an-array/-/an-array-1.0.0.tgz", + "integrity": "sha1-wSWlu4JXd4419LT2qpx9D6nkJmU=" + }, + "array-shuffle": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-shuffle/-/array-shuffle-1.0.1.tgz", + "integrity": "sha1-fqSIKjVrS8pfVF4LblLq9tlxVXo=" + }, + "as-number": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/as-number/-/as-number-1.0.0.tgz", + "integrity": "sha1-rLJ+NPj52KsNqeN287iVmGD4CmY=" + }, + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + }, + "bezier-js": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/bezier-js/-/bezier-js-6.1.0.tgz", + "integrity": "sha512-oc8fkHqG0R+dQuNiXVbPMB0cc8iDqkLAjbA2gq26QmV8tZqW9GGI7iNEX1ioRWlZperQS7v5BX03+9FLVWZbSw==" + }, + "buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=" + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo=" + }, + "canvas-color-tracker": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/canvas-color-tracker/-/canvas-color-tracker-1.1.5.tgz", + "integrity": "sha512-J0tDDrMU2PJfmIVWwuaU1/uPZ+d3ISmpaYZLrvd7s27ydvafl3HgNzg00DEQHLcqRZLoelBLIm8aVvNCmB582g==", + "requires": { + "tinycolor2": "^1.4.2" + } + }, + "cardboard-vr-display": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/cardboard-vr-display/-/cardboard-vr-display-1.0.19.tgz", + "integrity": "sha512-+MjcnWKAkb95p68elqZLDPzoiF/dGncQilLGvPBM5ZorABp/ao3lCs7nnRcYBckmuNkg1V/5rdGDKoUaCVsHzQ==", + "requires": { + "gl-preserve-state": "^1.0.0", + "nosleep.js": "^0.7.0", + "webvr-polyfill-dpdb": "^1.0.17" + } + }, + "custom-event-polyfill": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/custom-event-polyfill/-/custom-event-polyfill-1.0.7.tgz", + "integrity": "sha512-TDDkd5DkaZxZFM8p+1I3yAlvM3rSr1wbrOliG4yJiwinMZN8z/iGL7BTlDkrJcYTmgUSb4ywVCc3ZaUtOtC76w==" + }, + "d3-array": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.1.4.tgz", + "integrity": "sha512-H8lM97Gr9+LAR4WVHETCMt6LlWtLJVMCKsz1ojors+/PvAs2QqdLa20BuYvU11/DU+nLF0GVWL5Rv3jSgo2KmA==", + "requires": { + "internmap": "1 - 2" + } + }, + "d3-binarytree": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/d3-binarytree/-/d3-binarytree-0.2.2.tgz", + "integrity": "sha512-TmgSEKWO4lSjX26Rk77hbTdiF3TQ1v5LqL+cmSz6/5RiSxmq6+e6qHE6X/KwrsIESekhEReH63X5yM8dvXaT7A==" + }, + "d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==" + }, + "d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==" + }, + "d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "requires": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + } + }, + "d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==" + }, + "d3-force-3d": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/d3-force-3d/-/d3-force-3d-3.0.3.tgz", + "integrity": "sha512-8HGTbw6y35UYManGCPU4+b9/PGgnyjzRq80DRsp7zFsRl0leVz2pzwx18dwkPe4rDxTOEpM4BuWQ2krbVaGQQA==", + "requires": { + "d3-binarytree": "^0.2.0", + "d3-dispatch": "1 - 3", + "d3-octree": "^0.2.0", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + } + }, + "d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==" + }, + "d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "requires": { + "d3-color": "1 - 3" + } + }, + "d3-octree": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/d3-octree/-/d3-octree-0.2.2.tgz", + "integrity": "sha512-ysk9uSPAhZVb0Gq4GXzghl/Yqxu80dHrq55I53qaIMdGB65+0UfO84sr4Fci2JHumcgh6H4WE0r8LwxPagkE+g==" + }, + "d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==" + }, + "d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "requires": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + } + }, + "d3-scale-chromatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz", + "integrity": "sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==", + "requires": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + } + }, + "d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==" + }, + "d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ==", + "requires": { + "d3-array": "2 - 3" + } + }, + "d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "requires": { + "d3-time": "1 - 3" + } + }, + "d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==" + }, + "d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "requires": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + } + }, + "d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "requires": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + } + }, + "data-joint": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/data-joint/-/data-joint-1.2.5.tgz", + "integrity": "sha512-OcGbcTctTq7AdiWAzJdktyzi5wVzv7q6291BsKLdxVdyrsx9pZLb9QIpxavWHMd+OS5DgJgfhgoM4jjF//DRqg==", + "requires": { + "index-array-by": "^1.3.1" + } + }, + "debounce": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", + "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" + }, + "debug": { + "version": "git+ssh://git@github.com/ngokevin/debug.git#ef5f8e66d49ce8bc64c6f282c15f8b7164409e3a", + "from": "debug@github:ngokevin/debug#noTimestamp" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-assign": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/deep-assign/-/deep-assign-2.0.0.tgz", + "integrity": "sha1-6+BrHwfwja5ZdiDj3RYi83GhxXI=", + "requires": { + "is-obj": "^1.0.0" + } + }, + "document-register-element": { + "version": "git+ssh://git@github.com/dmarcos/document-register-element.git#8ccc532b7f3744be954574caf3072a5fd260ca90", + "from": "document-register-element@github:dmarcos/document-register-element#8ccc532b7f3744be954574caf3072a5fd260ca90" + }, + "dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "dtype": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dtype/-/dtype-2.0.0.tgz", + "integrity": "sha1-zQUjI84GFETs0uj1dI9popvihDQ=" + }, + "esbuild": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.32.tgz", + "integrity": "sha512-RuzVUP/bkStmnVHK6Gh3gjaMjfXNLqBqvYVDiS9JKl5KdRdRLUeW5Wo8NrbL7cL6CW7Cyak7SvACqyPOBuA8vA==", + "dev": true, + "requires": { + "esbuild-android-64": "0.14.32", + "esbuild-android-arm64": "0.14.32", + "esbuild-darwin-64": "0.14.32", + "esbuild-darwin-arm64": "0.14.32", + "esbuild-freebsd-64": "0.14.32", + "esbuild-freebsd-arm64": "0.14.32", + "esbuild-linux-32": "0.14.32", + "esbuild-linux-64": "0.14.32", + "esbuild-linux-arm": "0.14.32", + "esbuild-linux-arm64": "0.14.32", + "esbuild-linux-mips64le": "0.14.32", + "esbuild-linux-ppc64le": "0.14.32", + "esbuild-linux-riscv64": "0.14.32", + "esbuild-linux-s390x": "0.14.32", + "esbuild-netbsd-64": "0.14.32", + "esbuild-openbsd-64": "0.14.32", + "esbuild-sunos-64": "0.14.32", + "esbuild-windows-32": "0.14.32", + "esbuild-windows-64": "0.14.32", + "esbuild-windows-arm64": "0.14.32" + } + }, + "esbuild-android-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.32.tgz", + "integrity": "sha512-q1qjB2UcoWehR9Yp9dO2RdJUeLLrXAYsbOU4tkYa+GmJzxTwuvOrMdvaemsXYqb7F4STVTca9KpfqGicEChtUg==", + "dev": true, + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.32.tgz", + "integrity": "sha512-bs1uu+RuM15f8yjFc0FhPDE/6NID4fKl7beDVsGCme6Q8ld2IzRXmp5QaHurlcH93PFyQnUgVvdahIWgtK2QZw==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.32.tgz", + "integrity": "sha512-6MekflAld28wYtzanwZTxQlxMPeYw/yv1ToFG2hpo3LGxOIE2mBD5IJaMCcyy1//EYvGnGToO3p6XKdbS8E1QQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.32.tgz", + "integrity": "sha512-BHYIjiPDYQTD+4zwqdqRo+I2bbg3fn9mah/gZm4SCCy+7uwTTYOYobIunHT7wVCgxnFCr50PJUdaMrEoCImRbw==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.32.tgz", + "integrity": "sha512-6BOBhtfAf9AlfjL1AvtfVOxwY82tHPfYrA0lskJpFjfiEMGTLU6e0vdOwb4+4x++gGz49azuGK0woYqdfL03uw==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.32.tgz", + "integrity": "sha512-zIRR4gKQW56p/xLM8TlpxVBNiX0w3VoR9ZxfH4nrfJ7QiL0SYHRy8YPL5C7zMWRjSze2WxQRHfS9bHKdVrVXBw==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.32.tgz", + "integrity": "sha512-kn0AkGtPvzA6xiv93/mavvZ7DVinu/ewh2F2S0/8mE8/PXi3D4+svZ6V3beV5DIH7vcHVuGhoooWav8HPF04tg==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.32.tgz", + "integrity": "sha512-Ie+PMvrPj/HCOmSc0QubKttDxP2iBtPzDu+b+V3HGDGwkGmVpDkyXx1NXp5LjkIphIay2QekMwy1dSw3KDqCew==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.32.tgz", + "integrity": "sha512-R/Bvn/YQNDyvfN0SERh/I7hKPqN+nSSruQdVeiYEJ+jc3fUi73jXYAscpTQgIBeER/yXnEsgJGU/UQ9+sscr7A==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.32.tgz", + "integrity": "sha512-ykoqKaxX95nB+lk2K/+qxr0ke+BxkeVi0yKOnymCR5Ive7IZDHa4BJX53NEGSBKLfWPwKE6SXTz8qcEewSntoA==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.32.tgz", + "integrity": "sha512-IilnlBexpHpt/5po0cle/L/S6CYnwaq23UuAqWzxp+opHLOCNnyANpC1jOoP551aRx4JuZ7z3xZZ7bYQZB147w==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.32.tgz", + "integrity": "sha512-TR6l5nWZbfq7jSY+1vsiQjT4m67NWplNhbX6GBieZq6DBt0nTx1XgTZAdKROF7jTuaK7YrCYlPXtfO3w86Mysw==", + "dev": true, + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.32.tgz", + "integrity": "sha512-aSOcUzTeIAslfri8e+bMpyzQuxhcIiNhWyuCGGXum2PtxwYiUqR8/UCMYfwYtYkhr1yABOFOfs83mm9KBy5qCQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.32.tgz", + "integrity": "sha512-dNlip+EvexxKjRZitFCWCd7DVk64c7R5ySr8aFEMHCb/RriNiyDxYJGzYWm4EMJsMRMupMUHlMY64BAa3Op9FA==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.32.tgz", + "integrity": "sha512-Pa3QByYqxzlBFQQQhjYBPg3WUfSjwibqzh1hC6mPDRUHnCeUcrLoBuIiG4xqOYEpQM9/kDowIBsrGIQEVWWdQA==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.32.tgz", + "integrity": "sha512-uWKKqpCjkMY8TCIobFvaSETonQY3OrmgnoTCC3tF+lvMoneYjppB6akx7L5Xv0kP+1tnSbrIof1ca8PfqGUyjw==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.32.tgz", + "integrity": "sha512-Ar+u3mBk0oVV4Fwv/qlinJZNIPPtTBSG+1W42o8lOaVxJ+rJgecDoeUN+5uyd9at0BK1SVrQ1qZ4wjHKB0qFpQ==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.32.tgz", + "integrity": "sha512-rLMsbflMY6Hjh3rmQnCDVZahJQ7n+XfT6o1+no5pHRpDlMh38MHthgGh35q+EcOMgrGP3ppnw70rhJq80SaYTQ==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.32.tgz", + "integrity": "sha512-OHnMMxYufVgLXIMnwLynLMKguHMrsVnWcehieSP9i6ZX31KEsOFYWrorcnTWOn4rbZVLSL10ofxLuVIgRW3SWw==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.14.32", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.32.tgz", + "integrity": "sha512-ddavy6IPUBySMfqDfG243TgtuqwQBNJQJPVaA4DaavmMfpBsUxFrSV+HzBWXTKU3I9EcuoEvIATLuQ7NJKxjwg==", + "dev": true, + "optional": true + }, + "flatten-vertex-data": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten-vertex-data/-/flatten-vertex-data-1.0.2.tgz", + "integrity": "sha512-BvCBFK2NZqerFTdMDgqfHBwxYWnxeCkwONsw6PvBMcUXqo8U/KDWwmXhqx1x2kLIg7DqIsJfOaJFOmlua3Lxuw==", + "requires": { + "dtype": "^2.0.0" + } + }, + "follow-redirects": { + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==" + }, + "force-graph": { + "version": "1.42.9", + "resolved": "https://registry.npmjs.org/force-graph/-/force-graph-1.42.9.tgz", + "integrity": "sha512-FvzRlVDGj78CnaQBtTIoGg3d+kV5ei2TBOQ/xrUSKuv9gk2pAmTLJEK8cLYtKYFMMc/v1QTqcRhW9aQA1KTzsw==", + "requires": { + "@tweenjs/tween.js": "18", + "accessor-fn": "1", + "bezier-js": "3 - 6", + "canvas-color-tracker": "1", + "d3-array": "1 - 3", + "d3-drag": "2 - 3", + "d3-force-3d": "2 - 3", + "d3-scale": "1 - 4", + "d3-scale-chromatic": "1 - 3", + "d3-selection": "2 - 3", + "d3-zoom": "2 - 3", + "index-array-by": "1", + "kapsule": "^1.13", + "lodash.throttle": "4" + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gl-preserve-state": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gl-preserve-state/-/gl-preserve-state-1.0.0.tgz", + "integrity": "sha512-zQZ25l3haD4hvgJZ6C9+s0ebdkW9y+7U2qxvGu1uWOJh8a4RU+jURIKEQhf8elIlFpMH6CrAY2tH0mYrRjet3Q==" + }, + "global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "requires": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "index-array-by": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/index-array-by/-/index-array-by-1.3.2.tgz", + "integrity": "sha512-OIiTTJ4bfAcHTcMUZp3nmSpxAES+nARZNADnGBhg7OjywT8caxm3FR8fdnSnZIF1LvKDk5wN05oBF6qkVk2ZFg==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==" + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" + }, + "kapsule": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/kapsule/-/kapsule-1.13.7.tgz", + "integrity": "sha512-CKhyHyKyz5bYehAzz95U0ji5T9f4P0RXXPqQ2tGKjuTz3bJnHIUj8vCzGjnhFZ4XYtVT2wMvIq8D8Awb5rawcQ==", + "requires": { + "debounce": "^1.2.1" + } + }, + "layout-bmfont-text": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/layout-bmfont-text/-/layout-bmfont-text-1.3.4.tgz", + "integrity": "sha1-8g8sVGR3T0jabOipl/vObUaUW4E=", + "requires": { + "as-number": "^1.0.0", + "word-wrapper": "^1.0.7", + "xtend": "^4.0.0" + } + }, + "lit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.2.2.tgz", + "integrity": "sha512-eN3+2QRHn/erxYB88AXiiRgQA6RltE9MhzySCwX+ACOxA/MLWN3VdXvcbZD9PN09zmUwlgzDvW3T84YWj2Sa0A==", + "requires": { + "@lit/reactive-element": "^1.3.0", + "lit-element": "^3.2.0", + "lit-html": "^2.2.0" + } + }, + "lit-element": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.0.tgz", + "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==", + "requires": { + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.2.0" + } + }, + "lit-html": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.2.2.tgz", + "integrity": "sha512-cJofCRXuizwyaiGt9pJjJOcauezUlSB6t87VBXsPwRhbzF29MgD8GH6fZ0BuZdXAAC02IRONZBd//VPUuU8QbQ==", + "requires": { + "@types/trusted-types": "^2.0.2" + } + }, + "load-bmfont": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz", + "integrity": "sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA==", + "requires": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^2.9.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=" + }, + "map-limit": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/map-limit/-/map-limit-0.0.1.tgz", + "integrity": "sha1-63lhAxwPDo0AG/LVb6toXViCLzg=", + "requires": { + "once": "~1.3.0" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "nanoid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.2.tgz", + "integrity": "sha512-CuHBogktKwpm5g2sRgv83jEy2ijFzBwMoYA60orPDR7ynsLijJDqgsi4RDGj3OJpy3Ieb+LYwiRmIOGyytgITA==", + "dev": true + }, + "new-array": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/new-array/-/new-array-1.0.0.tgz", + "integrity": "sha1-XbxjnZYerH8an7wacUbsEvKST78=" + }, + "ngraph.events": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ngraph.events/-/ngraph.events-1.2.1.tgz", + "integrity": "sha512-D4C+nXH/RFxioGXQdHu8ELDtC6EaCiNsZtih0IvyGN81OZSUby4jXoJ5+RNWasfsd0FnKxxpAROyUMzw64QNsw==" + }, + "ngraph.forcelayout": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ngraph.forcelayout/-/ngraph.forcelayout-3.3.0.tgz", + "integrity": "sha512-EWqG8oSEueByuisyFl/c77M0+ts8g+dpNseafXFO71f0PvvZgzQ1zac1yO9CJVK6e94kbkvztgjDX3oQZ/4lVA==", + "requires": { + "ngraph.events": "^1.0.0", + "ngraph.merge": "^1.0.0", + "ngraph.random": "^1.0.0" + } + }, + "ngraph.graph": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/ngraph.graph/-/ngraph.graph-20.0.0.tgz", + "integrity": "sha512-tJqmik6U5geNDSbmTSwm4R6coTMDbkfFFHD8wdeSJtKU/cxIWFsKtXuwMva/wTk6tQQl1C2//lrzmwfPJXAXHw==", + "requires": { + "ngraph.events": "^1.2.1" + } + }, + "ngraph.merge": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ngraph.merge/-/ngraph.merge-1.0.0.tgz", + "integrity": "sha512-5J8YjGITUJeapsomtTALYsw7rFveYkM+lBj3QiYZ79EymQcuri65Nw3knQtFxQBU1r5iOaVRXrSwMENUPK62Vg==" + }, + "ngraph.random": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ngraph.random/-/ngraph.random-1.1.0.tgz", + "integrity": "sha512-h25UdUN/g8U7y29TzQtRm/GvGr70lK37yQPvPKXXuVfs7gCm82WipYFZcksQfeKumtOemAzBIcT7lzzyK/edLw==" + }, + "nice-color-palettes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nice-color-palettes/-/nice-color-palettes-1.0.1.tgz", + "integrity": "sha1-h16gHchu+uf1leBmqLJmDnIGBT4=", + "requires": { + "map-limit": "0.0.1", + "minimist": "^1.2.0", + "new-array": "^1.0.0", + "xhr-request": "^1.0.1" + } + }, + "nosleep.js": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.7.0.tgz", + "integrity": "sha1-z9kZwlUjyg0PSmn7MwXAg62u4ok=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "requires": { + "wrappy": "1" + } + }, + "parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha1-Eaw8P/WPfCAgqyJ2kHkQjU36AoU=" + }, + "parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha1-0Di0dtPp3Z2x4RoLDlOiJ5K2kAY=" + }, + "parse-bmfont-xml": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", + "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", + "requires": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.4.5" + } + }, + "parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "polished": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/polished/-/polished-4.2.2.tgz", + "integrity": "sha512-Sz2Lkdxz6F2Pgnpi9U5Ng/WdWAUZxmHrNPoVlm3aAemxoy2Qy7LGjQg4uf8qKelDAUW94F4np3iH2YPf2qefcQ==", + "requires": { + "@babel/runtime": "^7.17.8" + } + }, + "postcss": { + "version": "8.4.12", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.12.tgz", + "integrity": "sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg==", + "dev": true, + "requires": { + "nanoid": "^3.3.1", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "present": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/present/-/present-0.0.6.tgz", + "integrity": "sha1-nu/3ANqp6ZhhM1Lkf3rCMk1PrwI=" + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" + }, + "promise-polyfill": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-3.1.0.tgz", + "integrity": "sha1-YpUrAdBZsRW0MnY7fvRhuA9t9H0=" + }, + "quad-indices": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/quad-indices/-/quad-indices-2.0.1.tgz", + "integrity": "sha1-ppQdiaE9Y+7WwdSlpiGgRjYXqBQ=", + "requires": { + "an-array": "^1.0.0", + "dtype": "^2.0.0", + "is-buffer": "^1.0.2" + } + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + }, + "resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "rollup": { + "version": "2.70.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.70.1.tgz", + "integrity": "sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + }, + "simple-get": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-2.8.2.tgz", + "integrity": "sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "super-animejs": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/super-animejs/-/super-animejs-3.1.0.tgz", + "integrity": "sha512-6MFAFJDRuvwkovxQZPruuyHinTa4rgj4hNLOndjcYYhZLckoXtVRY9rJPuq8p6c/tgZJrFYEAYAfJ2/hhNtUCA==" + }, + "super-three": { + "version": "0.137.0", + "resolved": "https://registry.npmjs.org/super-three/-/super-three-0.137.0.tgz", + "integrity": "sha512-8jM8DiYiXQoalUoeFRxKWbW6KFQo3GFwgw+3vE2y6SJU/einw+JvuvgK+WhbIYRfz4LQV68nyOQ2eEZqAuouGw==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "three": { + "version": "0.139.2", + "resolved": "https://registry.npmjs.org/three/-/three-0.139.2.tgz", + "integrity": "sha512-gV7q7QY8rogu7HLFZR9cWnOQAUedUhu2WXAnpr2kdXZP9YDKsG/0ychwQvWkZN5PlNw9mv5MoCTin6zNTXoONg==" + }, + "three-bmfont-text": { + "version": "git+ssh://git@github.com/dmarcos/three-bmfont-text.git#21d017046216e318362c48abd1a48bddfb6e0733", + "from": "three-bmfont-text@github:dmarcos/three-bmfont-text#21d017046216e318362c48abd1a48bddfb6e0733", + "requires": { + "array-shuffle": "^1.0.1", + "inherits": "^2.0.1", + "layout-bmfont-text": "^1.2.0", + "nice-color-palettes": "^1.0.1", + "object-assign": "^4.0.1", + "quad-indices": "^2.0.1", + "three-buffer-vertex-data": "dmarcos/three-buffer-vertex-data#69378fc58daf27d3b1d930df9f233473e4a4818c" + } + }, + "three-buffer-vertex-data": { + "version": "git+ssh://git@github.com/dmarcos/three-buffer-vertex-data.git#69378fc58daf27d3b1d930df9f233473e4a4818c", + "from": "three-buffer-vertex-data@dmarcos/three-buffer-vertex-data#69378fc58daf27d3b1d930df9f233473e4a4818c", + "requires": { + "flatten-vertex-data": "^1.0.0" + } + }, + "three-forcegraph": { + "version": "1.39.4", + "resolved": "https://registry.npmjs.org/three-forcegraph/-/three-forcegraph-1.39.4.tgz", + "integrity": "sha512-kbycJcG98q/mwMJ5YIHIDz0nH2Fd8smpudc3QM2eoQPlf2cT7o1dzmrHWggUNnako4sWn7OybWypDSGf/S5/wg==", + "requires": { + "accessor-fn": "1", + "d3-array": "1 - 3", + "d3-force-3d": "2 - 3", + "d3-scale": "1 - 4", + "d3-scale-chromatic": "1 - 3", + "data-joint": "^1.2", + "kapsule": "^1.13", + "ngraph.forcelayout": "^3.3", + "ngraph.graph": "^20.0", + "tinycolor2": "^1.4" + } + }, + "three-pathfinding": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/three-pathfinding/-/three-pathfinding-0.7.0.tgz", + "integrity": "sha512-UwWvzgio1UFe81n5jKHNzB4B+AG3wfZ54OKp7bTb1MHuC3cy6RTtr0dbbiPQQoqxzr+DRArR2DUwQSEknw5+nw==" + }, + "three-render-objects": { + "version": "1.26.8", + "resolved": "https://registry.npmjs.org/three-render-objects/-/three-render-objects-1.26.8.tgz", + "integrity": "sha512-pCu439/SM2OOnDB71a52b005TGP7Hk1e0h7kBoCHaiQK9lmxXIpatDy9RdcQjz5Vx1Ug1Hsywcasq0pSlvxjCQ==", + "requires": { + "@tweenjs/tween.js": "18", + "accessor-fn": "1", + "kapsule": "^1.13", + "polished": "4" + } + }, + "three-spritetext": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/three-spritetext/-/three-spritetext-1.6.5.tgz", + "integrity": "sha512-ttA1ce3tJz6OFojLGY3VjtqF9johetq50TztYcPFWqdEUrwPmej5XXcHahVyQGd88FHRDzJmW2rW3zSifUsdYA==", + "requires": {} + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tinycolor2": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz", + "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==" + }, + "typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "vite": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.1.tgz", + "integrity": "sha512-vSlsSdOYGcYEJfkQ/NeLXgnRv5zZfpAsdztkIrs7AZHV8RCMZQkwjo4DS5BnrYTqoWqLoUe1Cah4aVO4oNNqCQ==", + "dev": true, + "requires": { + "esbuild": "^0.14.27", + "fsevents": "~2.3.2", + "postcss": "^8.4.12", + "resolve": "^1.22.0", + "rollup": "^2.59.0" + } + }, + "webvr-polyfill": { + "version": "0.10.12", + "resolved": "https://registry.npmjs.org/webvr-polyfill/-/webvr-polyfill-0.10.12.tgz", + "integrity": "sha512-trDJEVUQnRIVAnmImjEQ0BlL1NfuWl8+eaEdu+bs4g59c7OtETi/5tFkgEFDRaWEYwHntXs/uFF3OXZuutNGGA==", + "requires": { + "cardboard-vr-display": "^1.0.19" + } + }, + "webvr-polyfill-dpdb": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/webvr-polyfill-dpdb/-/webvr-polyfill-dpdb-1.0.18.tgz", + "integrity": "sha512-O0S1ZGEWyPvyZEkS2VbyV7mtir/NM9MNK3EuhbHPoJ8EHTky2pTXehjIl+IiDPr+Lldgx129QGt3NGly7rwRPw==" + }, + "word-wrapper": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/word-wrapper/-/word-wrapper-1.0.7.tgz", + "integrity": "sha1-HxSv6/Zt/fD+9V79NxhO+9CMKLY=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "requires": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + } + }, + "xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha1-qQKekp09vN7RafPG4oI42VpdWig=" + }, + "xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + } + }, + "xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } +} diff --git a/lit-force-graph/package.json b/lit-force-graph/package.json new file mode 100644 index 0000000..edf01d7 --- /dev/null +++ b/lit-force-graph/package.json @@ -0,0 +1,35 @@ +{ + "name": "lit-force-graph", + "private": true, + "version": "0.0.0", + "main": "dist/my-element.es.js", + "exports": { + ".": "./dist/my-element.es.js" + }, + "types": "types/my-element.d.ts", + "files": [ + "dist", + "types" + ], + "scripts": { + "dev": "vite", + "build": "tsc && vite build" + }, + "dependencies": { + "@ar-js-org/ar.js": "^3.4.0-alpha-rc2", + "3d-force-graph": "^1.70.9", + "3d-force-graph-ar": "^1.7.5", + "3d-force-graph-vr": "^2.0.12", + "aframe": "^1.3.0", + "force-graph": "^1.42.9", + "lit": "^2.0.2", + "three": "^0.139.2", + "three-spritetext": "^1.6.5" + }, + "devDependencies": { + "@types/node": "^17.0.23", + "@types/three": "^0.139.0", + "typescript": "^4.5.4", + "vite": "^2.9.0" + } +} diff --git a/lit-force-graph/public/style.css b/lit-force-graph/public/style.css new file mode 100644 index 0000000..911c507 --- /dev/null +++ b/lit-force-graph/public/style.css @@ -0,0 +1,31 @@ +body { + margin: 0; + padding: 0; + overflow: hidden; + font-size: 12px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + position: relative; + width: 100%; + height: 100%; +} + +lit-force-graph { + width: 100%; + height: 100vh; +} + +:root { + --graph-background-color: #eee; + --graph-foreground-color: #000; + --graph-line-color: rgb(90, 90, 90); + --graph-node-color: rgb(218, 14, 14); +} + +@media (prefers-color-scheme: dark) { + :root { + --graph-background-color: #000; + --graph-foreground-color: #fafafa; + --graph-line-color: rgb(214, 214, 214); + --graph-node-color: rgb(228, 8, 8); + } +} diff --git a/lit-force-graph/screenshots/2d-dark.png b/lit-force-graph/screenshots/2d-dark.png new file mode 100644 index 0000000..2f1a0d1 Binary files /dev/null and b/lit-force-graph/screenshots/2d-dark.png differ diff --git a/lit-force-graph/screenshots/2d-light.png b/lit-force-graph/screenshots/2d-light.png new file mode 100644 index 0000000..8cd08c9 Binary files /dev/null and b/lit-force-graph/screenshots/2d-light.png differ diff --git a/lit-force-graph/screenshots/3d-dark.png b/lit-force-graph/screenshots/3d-dark.png new file mode 100644 index 0000000..849e527 Binary files /dev/null and b/lit-force-graph/screenshots/3d-dark.png differ diff --git a/lit-force-graph/screenshots/3d-light.png b/lit-force-graph/screenshots/3d-light.png new file mode 100644 index 0000000..613cfce Binary files /dev/null and b/lit-force-graph/screenshots/3d-light.png differ diff --git a/lit-force-graph/src/classes/context.ts b/lit-force-graph/src/classes/context.ts new file mode 100644 index 0000000..c427ed9 --- /dev/null +++ b/lit-force-graph/src/classes/context.ts @@ -0,0 +1,9 @@ +import { GraphData, GraphNode } from "./graph"; + +export interface RenderContext { + data: GraphData; + element: HTMLElement; + onHover: (node?: GraphNode) => void; +} + +export type Renderer = (context: RenderContext) => void; diff --git a/lit-force-graph/src/classes/graph.ts b/lit-force-graph/src/classes/graph.ts new file mode 100644 index 0000000..ace4678 --- /dev/null +++ b/lit-force-graph/src/classes/graph.ts @@ -0,0 +1,46 @@ +export class Graph { + private ids = new Set(); + private graph: GraphData = { + nodes: [], + links: [], + }; + + addNode(node: GraphNode) { + if (this.ids.has(node.id)) { + return this.graph.nodes.find((n) => n.id === node.id)!; + } + this.ids.add(node.id); + this.graph.nodes.push(node); + return node; + } + + addLink(link: GraphLink) { + this.graph.links.push(link); + return link; + } + + toJSON() { + return this.graph; + } +} + +export interface GraphNode { + id: string; + name?: string; + group?: string; + value?: T; +} + +export interface GraphLink { + source: string; + target: string; + name?: string; + value?: T; +} + +export interface GraphData { + name?: string; + description?: string; + nodes: GraphNode[]; + links: GraphLink[]; +} diff --git a/lit-force-graph/src/favicon.svg b/lit-force-graph/src/favicon.svg new file mode 100644 index 0000000..de4aedd --- /dev/null +++ b/lit-force-graph/src/favicon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/lit-force-graph/src/lit-force-graph.ts b/lit-force-graph/src/lit-force-graph.ts new file mode 100644 index 0000000..80ae0d0 --- /dev/null +++ b/lit-force-graph/src/lit-force-graph.ts @@ -0,0 +1,217 @@ +import { html, css, LitElement } from "lit"; +import { customElement, property, query, state } from "lit/decorators.js"; +import { Renderer } from "./classes/context"; +import { GraphData, GraphNode } from "./classes/graph"; +import { render as render2D } from "./modes/mode-2d"; +import { render as render3D } from "./modes/mode-3d"; + +export const tagName = "lit-force-graph"; + +@customElement(tagName) +export class LitForceGraph extends LitElement { + static styles = css` + :host { + background-color: var(--graph-background-color, #000011); + color: var(--graph-foreground-color, #ffffff); + width: var(--graph-width, 100%); + height: var(--graph-height, 100vh); + } + + #graph { + width: 100%; + height: 100%; + width: var(--graph-width, 100%); + height: var(--graph-height, 100vh); + } + + #controls { + position: absolute; + top: 20px; + right: 20px; + z-index: 100 !important; + display: flex; + flex-direction: column; + align-items: flex-end; + } + #controls div { + padding: 5px; + } + + #info { + position: absolute; + top: 10px; + left: 10px; + z-index: 100 !important; + display: flex; + flex-direction: column; + align-items: flex-start; + } + + #tooltips { + position: absolute; + bottom: 10px; + left: 10px; + right: 10px; + display: flex; + flex-direction: row; + align-items: center; + text-align: center; + justify-content: center; + } + + .node-tooltip { + background-color: var(--graph-foreground-color, #ffffff); + color: var(--graph-background-color, #000011); + border-radius: 5px; + font-size: 12px; + padding: 5px; + opacity: 0.67; + } + + #graph-description { + opacity: 0.67; + } + + .scene-tooltip { + color: var(--graph-foreground-color, #ffffff); + background-color: transparent; + display: none; + } + `; + + @query("#graph") graph!: HTMLElement; + @property() src = ""; + @property() mode = "2D"; + @property({ type: Object }) data?: GraphData; + @state() hovered?: GraphNode; + + renderers = new Map([ + ["2D", render2D], + ["3D", render3D], + ]); + + render() { + return html`
+
+
+
+ + +
+
+
+

${this.data?.name}

+
${this?.data?.description}
+
+
+ ${this.hovered + ? html`
+ ${this.hovered?.name ?? this.hovered?.id} +
` + : html``} +
+
`; + } + + async firstUpdated() { + await this.refresh(); + const prefersDark = window.matchMedia("(prefers-color-scheme: dark)"); + prefersDark.addEventListener("change", () => { + this.refresh(); + }); + } + + /** + * Set the graph data and update the renderer + * + * @param data Graph JSON + */ + setData(data: GraphData) { + this.data = data; + const renderer = this.renderers.get(this.mode); + renderer?.({ + element: this.graph, + data, + onHover: (node) => (this.hovered = node), + }); + } + + private async refresh() { + // Get json from script tag + const children = Array.from(this.children); + const elem = children.find((child) => child.tagName === "SCRIPT"); + if (elem) { + // Render from script tag contents + if (elem.textContent) { + const data = JSON.parse(elem.textContent); + if (data) this.setData(data); + // Render from script tag src + } else if (elem.hasAttribute("src")) { + const url = elem.getAttribute("src")!; + const data = await fetch(url).then((res) => res.json()); + if (data) this.setData(data); + } + } else if (this.src.length > 0) { + // Render from src attribute + const data = await fetch(this.src).then((res) => res.json()); + if (data) this.setData(data); + } + } + + private onChangeMode(e: Event) { + const mode = (e.target as HTMLSelectElement).value; + this.mode = mode; + if (!this.data) return; + this.setData({ ...this.data! }); + } + + private onDrop(e: DragEvent) { + e.preventDefault(); + const files = e.dataTransfer?.files; + if (files && files.length > 0) { + const file = files[0]; + const reader = new FileReader(); + reader.onload = () => { + const json = JSON.parse(reader.result as string); + this.data = json; + this.setData(json); + }; + reader.readAsText(file); + } + return false; + } + + attributeChangedCallback( + name: string, + _old: string | null, + value: string | null + ): void { + if (name === "src" && value) { + this.refresh(); + } + if (name === "data" && value) { + this.setData(JSON.parse(value)); + } + if (name === "mode" && value) { + this.mode = value; + if (this.data) { + this.setData({ ...this.data! }); + } + } + super.attributeChangedCallback(name, _old, value); + } +} + +declare global { + interface HTMLElementTagNameMap { + "lit-force-graph": LitForceGraph; + } +} diff --git a/lit-force-graph/src/modes/mode-2d.ts b/lit-force-graph/src/modes/mode-2d.ts new file mode 100644 index 0000000..d99b7ac --- /dev/null +++ b/lit-force-graph/src/modes/mode-2d.ts @@ -0,0 +1,58 @@ +import ForceGraph from "force-graph"; +import { RenderContext } from "../classes/context"; + +export function render(context: RenderContext) { + const graph = ForceGraph(); + const style = getComputedStyle(context.element); + const lineColor = style.getPropertyValue("--graph-line-color").trim(); + const bgColor = style.getPropertyValue("--graph-background-color").trim(); + const fgColor = style.getPropertyValue("--graph-foreground-color").trim(); + const nodeColor = style.getPropertyValue("--graph-node-color").trim(); + graph(context.element) + .graphData(context.data) + .width(Number(style.width.slice(0, -2))) + .height(Number(style.height.slice(0, -2))) + .cooldownTicks(100) + .backgroundColor(bgColor) + .linkColor(() => lineColor) + .linkWidth(0.2) + .nodeCanvasObject((node: any, ctx, globalScale) => { + // Draw a circle + ctx.beginPath(); + const size = 5 / globalScale; + ctx.arc(node.x, node.y, size, 0, 2 * Math.PI); + // ctx.fillStyle = nodeColor(node, groupColors); + ctx.fillStyle = nodeColor; + ctx.fill(); + ctx.lineWidth = 1 / globalScale; + ctx.strokeStyle = lineColor; + ctx.stroke(); + + if (globalScale >= 4) { + const label = node.name ?? node.id; + const fontSize = 12 / globalScale; + ctx.font = `${fontSize}px Sans-Serif`; + const textWidth = ctx.measureText(label).width; + const bckgDimensions = [textWidth, fontSize].map( + (n) => n + fontSize * 0.2 + ); // some padding + + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; + ctx.fillStyle = fgColor; + // Measure text + ctx.fillText(label, node.x + size * 2 + textWidth / 2, node.y); + + node.__bckgDimensions = bckgDimensions; + } + }) + .onNodeHover((node: any, prev: any) => { + if (node) { + const graphNode = context.data.nodes.find((n) => n.id === node.id); + context.onHover(graphNode); + } + if (prev) { + context.onHover(undefined); + } + }); +} diff --git a/lit-force-graph/src/modes/mode-3d.ts b/lit-force-graph/src/modes/mode-3d.ts new file mode 100644 index 0000000..0b6adfd --- /dev/null +++ b/lit-force-graph/src/modes/mode-3d.ts @@ -0,0 +1,36 @@ +import ForceGraph from "3d-force-graph"; +import { RenderContext } from "../classes/context.js"; + +export function render(context: RenderContext) { + const graph = ForceGraph({ + controlType: "trackball", + rendererConfig: { antialias: true, alpha: true }, + }); + const style = getComputedStyle(context.element); + const lineColor = style.getPropertyValue("--graph-line-color").trim(); + const bgColor = style.getPropertyValue("--graph-background-color").trim(); + const nodeColor = style.getPropertyValue("--graph-node-color").trim(); + graph(context.element) + .graphData(context.data) + .width(Number(style.width.slice(0, -2))) + .height(Number(style.height.slice(0, -2))) + .showNavInfo(false) + .linkColor(() => lineColor) + .backgroundColor(bgColor) + .nodeThreeObject((node: any) => { + const color = node.color ?? nodeColor; + node.color = color; + return false as any; + }) + .nodeThreeObjectExtend(true) + .onNodeHover((node: any, prev: any) => { + if (node) { + const graphNode = context.data.nodes.find((n) => n.id === node.id); + context.onHover(graphNode); + } + if (prev) { + context.onHover(undefined); + } + }) + .cooldownTicks(100); +} diff --git a/lit-force-graph/src/modes/mode-ar.ts b/lit-force-graph/src/modes/mode-ar.ts new file mode 100644 index 0000000..fc0ece0 --- /dev/null +++ b/lit-force-graph/src/modes/mode-ar.ts @@ -0,0 +1,16 @@ +import "aframe"; +import "@ar-js-org/ar.js"; +import ForceGraph from "3d-force-graph-ar"; +import { RenderContext } from "../classes/context.js"; + +export function renderAR(context: RenderContext) { + const graph = ForceGraph(); + const style = getComputedStyle(context.element); + // const lineColor = style.getPropertyValue("--graph-line-color").trim(); + // const bgColor = style.getPropertyValue("--graph-background-color").trim(); + graph(context.element) + .graphData(context.data) + .width(Number(style.width.slice(0, -2))) + .height(Number(style.height.slice(0, -2))) + .cooldownTicks(100); +} diff --git a/lit-force-graph/src/modes/mode-vr.ts b/lit-force-graph/src/modes/mode-vr.ts new file mode 100644 index 0000000..5274a2b --- /dev/null +++ b/lit-force-graph/src/modes/mode-vr.ts @@ -0,0 +1,15 @@ +import ForceGraph from "3d-force-graph-vr"; +import { RenderContext } from "../classes/context.js"; + +export function renderVR(context: RenderContext) { + const graph = ForceGraph(); + const style = getComputedStyle(context.element); + // const lineColor = style.getPropertyValue("--graph-line-color").trim(); + // const bgColor = style.getPropertyValue("--graph-background-color").trim(); + graph(context.element) + .graphData(context.data) + .width(Number(style.width.slice(0, -2))) + .height(Number(style.height.slice(0, -2))) + .showNavInfo(false) + .cooldownTicks(100); +} diff --git a/lit-force-graph/src/vite-env.d.ts b/lit-force-graph/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/lit-force-graph/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/lit-force-graph/tsconfig.json b/lit-force-graph/tsconfig.json new file mode 100644 index 0000000..03ecaf4 --- /dev/null +++ b/lit-force-graph/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": ["es2017", "dom", "dom.iterable"], + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "./types", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "useDefineForClassFields": false + }, + "include": ["src/**/*.ts"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/lit-force-graph/tsconfig.node.json b/lit-force-graph/tsconfig.node.json new file mode 100644 index 0000000..e993792 --- /dev/null +++ b/lit-force-graph/tsconfig.node.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "composite": true, + "module": "esnext", + "moduleResolution": "node" + }, + "include": ["vite.config.ts"] +} diff --git a/lit-force-graph/vite.config.ts b/lit-force-graph/vite.config.ts new file mode 100644 index 0000000..339dabd --- /dev/null +++ b/lit-force-graph/vite.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; + +export default defineConfig({ + base: "/lit-force-graph/", + build: { + lib: { + entry: "src/lit-force-graph.ts", + formats: ["es"], + }, + rollupOptions: { + input: { + main: resolve(__dirname, "index.html"), + }, + }, + }, +}); diff --git a/lit-html-editor b/lit-html-editor deleted file mode 160000 index 221d171..0000000 --- a/lit-html-editor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 221d1716ed0a9304394434be240c988a5ac63a7f diff --git a/lit-html-editor/.github/workflows/ci.yml b/lit-html-editor/.github/workflows/ci.yml new file mode 100644 index 0000000..d71d029 --- /dev/null +++ b/lit-html-editor/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Demo + +on: + push: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist diff --git a/lit-html-editor/.gitignore b/lit-html-editor/.gitignore new file mode 100644 index 0000000..6afafb3 --- /dev/null +++ b/lit-html-editor/.gitignore @@ -0,0 +1,6 @@ +node_modules +.DS_Store +dist +types +*.local +test.html \ No newline at end of file diff --git a/lit-html-editor/.vscode/settings.json b/lit-html-editor/.vscode/settings.json new file mode 100644 index 0000000..88a6999 --- /dev/null +++ b/lit-html-editor/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "contenteditable" + ] +} \ No newline at end of file diff --git a/lit-html-editor/LICENSE b/lit-html-editor/LICENSE new file mode 100644 index 0000000..396a87f --- /dev/null +++ b/lit-html-editor/LICENSE @@ -0,0 +1,43 @@ +Apache License, Version 2.0 +SPDX short identifier: Apache-2.0 +Further resources on the Apache License, Version 2.0 + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +1. Definitions. +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. +6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +END OF TERMS AND CONDITIONS +APPENDIX: How to apply the Apache License to your work +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. \ No newline at end of file diff --git a/lit-html-editor/README.md b/lit-html-editor/README.md new file mode 100644 index 0000000..e7bb4e9 --- /dev/null +++ b/lit-html-editor/README.md @@ -0,0 +1,11 @@ +# Lit Html Editor + +Rich text editor built with [Lit](https://lit.dev) based on [this](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content#example_a_simple_but_complete_rich_text_editor) example. + +You can try the demo [here](https://rodydavis.github.io/lit-html-editor/)! + +This used the contenteditable property that browsers support for full document editing and text formatting. + +![](/screenshot.png) + +There is also an example on the Lit playground [here](https://lit.dev/playground/#project=W3sibmFtZSI6InJpY2gtdGV4dC1lZGl0b3IudHMiLCJjb250ZW50IjoiaW1wb3J0IHsgTGl0RWxlbWVudCwgaHRtbCwgY3VzdG9tRWxlbWVudCwgY3NzLCBzdGF0ZSB9IGZyb20gXCJsaXQtZWxlbWVudFwiO1xuXG5pbXBvcnQgXCJAbWF0ZXJpYWwvbXdjLWljb24tYnV0dG9uXCI7XG5cbkBjdXN0b21FbGVtZW50KFwicmljaC10ZXh0LWVkaXRvclwiKVxuZXhwb3J0IGNsYXNzIFJpY2hUZXh0RWRpdG9yIGV4dGVuZHMgTGl0RWxlbWVudCB7XG4gIEBzdGF0ZSgpIGNvbnRlbnQ6IHN0cmluZyA9IFwiXCI7XG4gIEBzdGF0ZSgpIHJvb3Q6IEVsZW1lbnQgfCBudWxsID0gbnVsbDtcblxuICBzdGF0aWMgc3R5bGVzID0gY3NzYFxuICAgIDpob3N0IHtcbiAgICAgIC0tZWRpdG9yLXdpZHRoOiA2MDBweDtcbiAgICAgIC0tZWRpdG9yLWhlaWdodDogNjAwcHg7XG4gICAgICAtLWVkaXRvci1iYWNrZ3JvdW5kOiAjZjFmMWYxO1xuICAgICAgLS1lZGl0b3ItdG9vbGJhci1oZWlnaHQ6IDMzcHg7XG4gICAgICAtLWVkaXRvci10b29sYmFyLWJhY2tncm91bmQ6IGJsYWNrO1xuICAgICAgLS1lZGl0b3ItdG9vbGJhci1vbi1iYWNrZ3JvdW5kOiB3aGl0ZTtcbiAgICAgIC0tZWRpdG9yLXRvb2xiYXItb24tYWN0aXZlLWJhY2tncm91bmQ6ICNhNGE0YTQ7XG4gICAgfVxuICAgIG1haW4ge1xuICAgICAgd2lkdGg6IHZhcigtLWVkaXRvci13aWR0aCk7XG4gICAgICBoZWlnaHQ6IHZhcigtLWVkaXRvci1oZWlnaHQpO1xuICAgICAgZGlzcGxheTogZ3JpZDtcbiAgICAgIGdyaWQtdGVtcGxhdGUtYXJlYXM6XG4gICAgICAgIFwidG9vbGJhciB0b29sYmFyXCJcbiAgICAgICAgXCJlZGl0b3IgZWRpdG9yXCI7XG4gICAgICBncmlkLXRlbXBsYXRlLXJvd3M6IHZhcigtLWVkaXRvci10b29sYmFyLWhlaWdodCkgYXV0bztcbiAgICAgIGdyaWQtdGVtcGxhdGUtY29sdW1uczogYXV0byBhdXRvO1xuICAgIH1cbiAgICAjZWRpdG9yLWFjdGlvbnMge1xuICAgICAgZ3JpZC1hcmVhOiB0b29sYmFyO1xuICAgICAgd2lkdGg6IHZhcigtLWVkaXRvci13aWR0aCk7XG4gICAgICBoZWlnaHQ6IHZhcigtLWVkaXRvci10b29sYmFyLWhlaWdodCk7XG4gICAgICBiYWNrZ3JvdW5kLWNvbG9yOiB2YXIoLS1lZGl0b3ItdG9vbGJhci1iYWNrZ3JvdW5kKTtcbiAgICAgIGNvbG9yOiB2YXIoLS1lZGl0b3ItdG9vbGJhci1vbi1iYWNrZ3JvdW5kKTtcbiAgICAgIG92ZXJzY3JvbGwtYmVoYXZpb3I6IGNvbnRhaW47XG4gICAgICBvdmVyZmxvdy15OiBhdXRvO1xuICAgICAgLW1zLW92ZXJmbG93LXN0eWxlOiBub25lO1xuICAgICAgc2Nyb2xsYmFyLXdpZHRoOiBub25lO1xuICAgIH1cbiAgICAjZWRpdG9yLWFjdGlvbnM6Oi13ZWJraXQtc2Nyb2xsYmFyIHtcbiAgICAgIGRpc3BsYXk6IG5vbmU7XG4gICAgfVxuICAgICNlZGl0b3Ige1xuICAgICAgd2lkdGg6IHZhcigtLWVkaXRvci13aWR0aCk7XG4gICAgICBncmlkLWFyZWE6IGVkaXRvcjtcbiAgICAgIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWVkaXRvci1iYWNrZ3JvdW5kKTtcbiAgICB9XG4gICAgI3Rvb2xiYXIge1xuICAgICAgd2lkdGg6IDEwODBweDtcbiAgICAgIGhlaWdodDogdmFyKC0tZWRpdG9yLXRvb2xiYXItaGVpZ2h0KTtcbiAgICB9XG4gICAgW2NvbnRlbnRlZGl0YWJsZV0ge1xuICAgICAgb3V0bGluZTogMHB4IHNvbGlkIHRyYW5zcGFyZW50O1xuICAgIH1cbiAgICAjdG9vbGJhciA-IG13Yy1pY29uLWJ1dHRvbiB7XG4gICAgICBjb2xvcjogdmFyKC0tZWRpdG9yLXRvb2xiYXItb24tYmFja2dyb3VuZCk7XG4gICAgICAtLW1kYy1pY29uLXNpemU6IDIwcHg7XG4gICAgICAtLW1kYy1pY29uLWJ1dHRvbi1zaXplOiAzMHB4O1xuICAgICAgY3Vyc29yOiBwb2ludGVyO1xuICAgIH1cbiAgICAjdG9vbGJhciA-IC5hY3RpdmUge1xuICAgICAgY29sb3I6IHZhcigtLWVkaXRvci10b29sYmFyLW9uLWFjdGl2ZS1iYWNrZ3JvdW5kKTtcbiAgICB9XG4gICAgc2VsZWN0IHtcbiAgICAgIG1hcmdpbi10b3A6IDVweDtcbiAgICAgIGhlaWdodDogY2FsYyh2YXIoLS1lZGl0b3ItdG9vbGJhci1oZWlnaHQpIC0gMTBweCk7XG4gICAgfVxuICAgIGlucHV0W3R5cGU9XCJjb2xvclwiXSB7XG4gICAgICBoZWlnaHQ6IGNhbGModmFyKC0tZWRpdG9yLXRvb2xiYXItaGVpZ2h0KSAtIDE1cHgpO1xuICAgICAgLXdlYmtpdC1hcHBlYXJhbmNlOiBub25lO1xuICAgICAgYm9yZGVyOiBub25lO1xuICAgICAgd2lkdGg6IDIycHg7XG4gICAgfVxuICAgIGlucHV0W3R5cGU9XCJjb2xvclwiXTo6LXdlYmtpdC1jb2xvci1zd2F0Y2gtd3JhcHBlciB7XG4gICAgICBwYWRkaW5nOiAwO1xuICAgIH1cbiAgICBpbnB1dFt0eXBlPVwiY29sb3JcIl06Oi13ZWJraXQtY29sb3Itc3dhdGNoIHtcbiAgICAgIGJvcmRlcjogbm9uZTtcbiAgICB9XG4gIGA7XG5cbiAgcmVuZGVyKCkge1xuICAgIHJldHVybiBodG1sYDxtYWluPlxuICAgICAgPGlucHV0IGlkPVwiYmdcIiB0eXBlPVwiY29sb3JcIiBzdHlsZT0nZGlzcGxheTpub25lJyAvPlxuICAgICAgPGlucHV0IGlkPVwiZmdcIiB0eXBlPVwiY29sb3JcIiBzdHlsZT0nZGlzcGxheTpub25lJyAvPlxuICAgICAgPGRpdiBpZD1cImVkaXRvci1hY3Rpb25zXCI-XG4gICAgICAgIDxkaXYgaWQ9XCJ0b29sYmFyXCI-XG4gICAgICAgICAgJHt0b29sYmFyKHRoaXMuc2hhZG93Um9vdCEsIHRoaXMuZ2V0U2VsZWN0aW9uKCksIChjb21tYW5kLCB2YWwpID0-IHtcbiAgICAgICAgICAgIGRvY3VtZW50LmV4ZWNDb21tYW5kKGNvbW1hbmQsIGZhbHNlLCB2YWwpO1xuICAgICAgICAgICAgY29uc29sZS5sb2coXCJjb21tYW5kXCIsIGNvbW1hbmQsIHZhbCk7XG4gICAgICAgICAgfSl9XG4gICAgICAgIDwvZGl2PlxuICAgICAgPC9kaXY-XG4gICAgICA8ZGl2IGlkPVwiZWRpdG9yXCI-JHt0aGlzLnJvb3R9PC9kaXY-XG4gICAgPC9tYWluPiBgO1xuICB9XG5cbiAgYXN5bmMgZmlyc3RVcGRhdGVkKCkge1xuICAgIGNvbnN0IGVsZW0gPSB0aGlzLnBhcmVudEVsZW1lbnQhLnF1ZXJ5U2VsZWN0b3IoXCJyaWNoLXRleHQtZWRpdG9yIHRlbXBsYXRlXCIpO1xuICAgIHRoaXMuY29udGVudCA9IGVsZW0_LmlubmVySFRNTCA_PyBcIlwiO1xuICAgIHRoaXMucmVzZXQoKTtcbiAgfVxuXG4gIHJlc2V0KCkge1xuICAgIGNvbnN0IHBhcnNlciA9IG5ldyBET01QYXJzZXIoKTtcbiAgICBjb25zdCBkb2MgPSBwYXJzZXIucGFyc2VGcm9tU3RyaW5nKHRoaXMuY29udGVudCwgXCJ0ZXh0L2h0bWxcIik7XG4gICAgZG9jdW1lbnQuZXhlY0NvbW1hbmQoXCJkZWZhdWx0UGFyYWdyYXBoU2VwYXJhdG9yXCIsIGZhbHNlLCBcImJyXCIpO1xuICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoXCJzZWxlY3Rpb25jaGFuZ2VcIiwgKCkgPT4ge1xuICAgICAgdGhpcy5yZXF1ZXN0VXBkYXRlKCk7XG4gICAgfSk7XG4gICAgY29uc3Qgcm9vdCA9IGRvYy5xdWVyeVNlbGVjdG9yKFwiYm9keVwiKTtcbiAgICByb290IS5zZXRBdHRyaWJ1dGUoXCJjb250ZW50ZWRpdGFibGVcIiwgXCJ0cnVlXCIpO1xuICAgIHRoaXMucm9vdCA9IHJvb3Q7XG4gIH1cblxuICBnZXRTZWxlY3Rpb24oKTogU2VsZWN0aW9uIHwgbnVsbCB7XG4gICAgaWYgKHRoaXMuc2hhZG93Um9vdD8uZ2V0U2VsZWN0aW9uKSByZXR1cm4gdGhpcy5zaGFkb3dSb290Py5nZXRTZWxlY3Rpb24oKTtcbiAgICByZXR1cm4gbnVsbDtcbiAgfVxufVxuXG5mdW5jdGlvbiB0b29sYmFyKFxuICBzaGFkb3dSb290OiBTaGFkb3dSb290LFxuICBzZWxlY3Rpb246IFNlbGVjdGlvbiB8IG51bGwsXG4gIGNvbW1hbmQ6IChjOiBzdHJpbmcsIHZhbDogc3RyaW5nIHwgdW5kZWZpbmVkKSA9PiB2b2lkXG4pIHtcbiAgY29uc3QgdGFnczogc3RyaW5nW10gPSBbXTtcbiAgaWYgKHNlbGVjdGlvbj8udHlwZSA9PT0gXCJSYW5nZVwiKSB7XG4gICAgLy8gQHRzLWlnbm9yZVxuICAgIGxldCBwYXJlbnROb2RlID0gc2VsZWN0aW9uPy5iYXNlTm9kZTtcbiAgICBpZiAocGFyZW50Tm9kZSkge1xuICAgICAgY29uc3QgY2hlY2tOb2RlID0gKCkgPT4ge1xuICAgICAgICBjb25zdCBwYXJlbnRUYWdOYW1lID0gcGFyZW50Tm9kZT8udGFnTmFtZT8udG9Mb3dlckNhc2UoKT8udHJpbSgpO1xuICAgICAgICBpZiAocGFyZW50VGFnTmFtZSkgdGFncy5wdXNoKHBhcmVudFRhZ05hbWUpO1xuICAgICAgfTtcbiAgICAgIHdoaWxlIChwYXJlbnROb2RlICE9IG51bGwpIHtcbiAgICAgICAgY2hlY2tOb2RlKCk7XG4gICAgICAgIHBhcmVudE5vZGUgPSBwYXJlbnROb2RlPy5wYXJlbnROb2RlO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIGNvbnN0IGNvbW1hbmRzOiB7XG4gICAgaWNvbjogc3RyaW5nO1xuICAgIGNvbW1hbmQ6IHN0cmluZyB8ICgoKSA9PiB2b2lkKTtcbiAgICBhY3RpdmU_OiBib29sZWFuO1xuICAgIHR5cGU_OiBzdHJpbmc7XG4gICAgdmFsdWVzPzogeyB2YWx1ZTogc3RyaW5nOyBuYW1lOiBzdHJpbmc7IGZvbnQ_OiBib29sZWFuIH1bXTtcbiAgICBjb21tYW5kX3ZhbHVlPzogc3RyaW5nO1xuICB9W10gPSBbXG4gICAge1xuICAgICAgaWNvbjogXCJmb3JtYXRfY2xlYXJcIixcbiAgICAgIGNvbW1hbmQ6IFwicmVtb3ZlRm9ybWF0XCIsXG4gICAgfSxcblxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2JvbGRcIixcbiAgICAgIGNvbW1hbmQ6IFwiYm9sZFwiLFxuICAgICAgYWN0aXZlOiB0YWdzLmluY2x1ZGVzKFwiYlwiKSxcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2l0YWxpY1wiLFxuICAgICAgY29tbWFuZDogXCJpdGFsaWNcIixcbiAgICAgIGFjdGl2ZTogdGFncy5pbmNsdWRlcyhcImlcIiksXG4gICAgfSxcbiAgICB7XG4gICAgICBpY29uOiBcImZvcm1hdF91bmRlcmxpbmVkXCIsXG4gICAgICBjb21tYW5kOiBcInVuZGVybGluZVwiLFxuICAgICAgYWN0aXZlOiB0YWdzLmluY2x1ZGVzKFwidVwiKSxcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2FsaWduX2xlZnRcIixcbiAgICAgIGNvbW1hbmQ6IFwianVzdGlmeWxlZnRcIixcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2FsaWduX2NlbnRlclwiLFxuICAgICAgY29tbWFuZDogXCJqdXN0aWZ5Y2VudGVyXCIsXG4gICAgfSxcbiAgICB7XG4gICAgICBpY29uOiBcImZvcm1hdF9hbGlnbl9yaWdodFwiLFxuICAgICAgY29tbWFuZDogXCJqdXN0aWZ5cmlnaHRcIixcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2xpc3RfbnVtYmVyZWRcIixcbiAgICAgIGNvbW1hbmQ6IFwiaW5zZXJ0b3JkZXJlZGxpc3RcIixcbiAgICAgIGFjdGl2ZTogdGFncy5pbmNsdWRlcyhcIm9sXCIpLFxuICAgIH0sXG4gICAge1xuICAgICAgaWNvbjogXCJmb3JtYXRfbGlzdF9idWxsZXRlZFwiLFxuICAgICAgY29tbWFuZDogXCJpbnNlcnR1bm9yZGVyZWRsaXN0XCIsXG4gICAgICBhY3RpdmU6IHRhZ3MuaW5jbHVkZXMoXCJ1bFwiKSxcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X3F1b3RlXCIsXG4gICAgICBjb21tYW5kOiBcImZvcm1hdGJsb2NrXCIsXG4gICAgICBjb21tYW5kX3ZhbHVlOiBcImJsb2NrcXVvdGVcIixcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2luZGVudF9kZWNyZWFzZVwiLFxuICAgICAgY29tbWFuZDogXCJvdXRkZW50XCIsXG4gICAgfSxcbiAgICB7XG4gICAgICBpY29uOiBcImZvcm1hdF9pbmRlbnRfaW5jcmVhc2VcIixcbiAgICAgIGNvbW1hbmQ6IFwiaW5kZW50XCIsXG4gICAgfSxcbiAgICB0YWdzLmluY2x1ZGVzKFwiYVwiKVxuICAgICAgPyB7IGljb246IFwibGlua19vZmZcIiwgY29tbWFuZDogXCJ1bmxpbmtcIiB9XG4gICAgICA6IHtcbiAgICAgICAgICBpY29uOiBcImFkZF9saW5rXCIsXG4gICAgICAgICAgY29tbWFuZDogKCkgPT4ge1xuICAgICAgICAgICAgY29uc3QgbmV3TGluayA9IHByb21wdChcIldyaXRlIHRoZSBVUkwgaGVyZVwiLCBcImh0dHA6Ly9cIik7XG4gICAgICAgICAgICBpZiAobmV3TGluayAmJiBuZXdMaW5rICE9IFwiXCIgJiYgbmV3TGluayAhPSBcImh0dHA6Ly9cIikge1xuICAgICAgICAgICAgICBjb21tYW5kKFwiY3JlYXRlbGlua1wiLCBuZXdMaW5rKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X2NvbG9yX3RleHRcIixcbiAgICAgIGNvbW1hbmQ6ICgpID0-IHtcbiAgICAgICAgY29uc3QgaW5wdXQgPSBzaGFkb3dSb290LnF1ZXJ5U2VsZWN0b3IoXCIjZmdcIikhIGFzIEhUTUxJbnB1dEVsZW1lbnQ7XG4gICAgICAgIGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoXCJpbnB1dFwiLCAoZTogYW55KSA9PiB7XG4gICAgICAgICAgY29uc3QgdmFsID0gZS50YXJnZXQudmFsdWU7XG4gICAgICAgICAgY29tbWFuZChcImZvcmVjb2xvclwiLCB2YWwpO1xuICAgICAgICB9KTtcbiAgICAgICAgaW5wdXQuY2xpY2soKTtcbiAgICAgIH0sXG4gICAgICB0eXBlOiBcImNvbG9yXCIsXG4gICAgfSxcbiAgICB7XG4gICAgICBpY29uOiBcImJvcmRlcl9jb2xvclwiLFxuICAgICAgY29tbWFuZDogKCkgPT4ge1xuICAgICAgICBjb25zdCBpbnB1dCA9IHNoYWRvd1Jvb3QucXVlcnlTZWxlY3RvcihcIiNiZ1wiKSEgYXMgSFRNTElucHV0RWxlbWVudDtcbiAgICAgICAgaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcihcImlucHV0XCIsIChlOiBhbnkpID0-IHtcbiAgICAgICAgICBjb25zdCB2YWwgPSBlLnRhcmdldC52YWx1ZTtcbiAgICAgICAgICBjb21tYW5kKFwiYmFja2NvbG9yXCIsIHZhbCk7XG4gICAgICAgIH0pO1xuICAgICAgICBpbnB1dC5jbGljaygpO1xuICAgICAgfSxcbiAgICAgIHR5cGU6IFwiY29sb3JcIixcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwidGl0bGVcIixcbiAgICAgIGNvbW1hbmQ6IFwiZm9ybWF0YmxvY2tcIixcbiAgICAgIHZhbHVlczogW1xuICAgICAgICB7IG5hbWU6IFwiTm9ybWFsIFRleHRcIiwgdmFsdWU6IFwiLS1cIiB9LFxuICAgICAgICB7IG5hbWU6IFwiSGVhZGluZyAxXCIsIHZhbHVlOiBcImgxXCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIkhlYWRpbmcgMlwiLCB2YWx1ZTogXCJoMlwiIH0sXG4gICAgICAgIHsgbmFtZTogXCJIZWFkaW5nIDNcIiwgdmFsdWU6IFwiaDNcIiB9LFxuICAgICAgICB7IG5hbWU6IFwiSGVhZGluZyA0XCIsIHZhbHVlOiBcImg0XCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIkhlYWRpbmcgNVwiLCB2YWx1ZTogXCJoNVwiIH0sXG4gICAgICAgIHsgbmFtZTogXCJIZWFkaW5nIDZcIiwgdmFsdWU6IFwiaDZcIiB9LFxuICAgICAgICB7IG5hbWU6IFwiUGFyYWdyYXBoXCIsIHZhbHVlOiBcInBcIiB9LFxuICAgICAgICB7IG5hbWU6IFwiUHJlLUZvcm1hdHRlZFwiLCB2YWx1ZTogXCJwcmVcIiB9LFxuICAgICAgXSxcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwidGV4dF9mb3JtYXRcIixcbiAgICAgIGNvbW1hbmQ6IFwiZm9udG5hbWVcIixcbiAgICAgIHZhbHVlczogW1xuICAgICAgICB7IG5hbWU6IFwiRm9udCBOYW1lXCIsIHZhbHVlOiBcIi0tXCIgfSxcbiAgICAgICAgLi4uWy4uLmNoZWNrRm9udHMoKV0ubWFwKChmKSA9PiAoe1xuICAgICAgICAgIG5hbWU6IGYsXG4gICAgICAgICAgdmFsdWU6IGYsXG4gICAgICAgICAgZm9udDogdHJ1ZSxcbiAgICAgICAgfSkpLFxuICAgICAgXSxcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwiZm9ybWF0X3NpemVcIixcbiAgICAgIGNvbW1hbmQ6IFwiZm9udHNpemVcIixcbiAgICAgIHZhbHVlczogW1xuICAgICAgICB7IG5hbWU6IFwiRm9udCBTaXplXCIsIHZhbHVlOiBcIi0tXCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIlZlcnkgU21hbGxcIiwgdmFsdWU6IFwiMVwiIH0sXG4gICAgICAgIHsgbmFtZTogXCJTbWFsbFwiLCB2YWx1ZTogXCIyXCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIk5vcm1hbFwiLCB2YWx1ZTogXCIzXCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIk1lZGl1bSBMYXJnZVwiLCB2YWx1ZTogXCI0XCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIkxhcmdlXCIsIHZhbHVlOiBcIjVcIiB9LFxuICAgICAgICB7IG5hbWU6IFwiVmVyeSBMYXJnZVwiLCB2YWx1ZTogXCI2XCIgfSxcbiAgICAgICAgeyBuYW1lOiBcIk1heGltdW1cIiwgdmFsdWU6IFwiN1wiIH0sXG4gICAgICBdLFxuICAgIH0sXG4gICAge1xuICAgICAgaWNvbjogXCJ1bmRvXCIsXG4gICAgICBjb21tYW5kOiBcInVuZG9cIixcbiAgICB9LFxuICAgIHtcbiAgICAgIGljb246IFwicmVkb1wiLFxuICAgICAgY29tbWFuZDogXCJyZWRvXCIsXG4gICAgfSxcbiAgICB7XG4gICAgICBpY29uOiBcImNvbnRlbnRfY3V0XCIsXG4gICAgICBjb21tYW5kOiBcImN1dFwiLFxuICAgIH0sXG4gICAge1xuICAgICAgaWNvbjogXCJjb250ZW50X2NvcHlcIixcbiAgICAgIGNvbW1hbmQ6IFwiY29weVwiLFxuICAgIH0sXG4gICAge1xuICAgICAgaWNvbjogXCJjb250ZW50X3Bhc3RlXCIsXG4gICAgICBjb21tYW5kOiBcInBhc3RlXCIsXG4gICAgfSxcbiAgXTtcblxuICByZXR1cm4gaHRtbGBcbiAgICAke2NvbW1hbmRzLm1hcCgobikgPT4ge1xuICAgICAgY29uc3QgZWxlbSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoXCJtd2MtaWNvbi1idXR0b25cIik7XG4gICAgICBlbGVtLnNldEF0dHJpYnV0ZShcImljb25cIiwgbi5pY29uKTtcbiAgICAgIGVsZW0uY2xhc3NOYW1lID0gbi5hY3RpdmUgPyBcImFjdGl2ZVwiIDogXCJpbmFjdGl2ZVwiO1xuICAgICAgZWxlbS5hZGRFdmVudExpc3RlbmVyKFwiY2xpY2tcIiwgKCkgPT4ge1xuICAgICAgICBpZiAobi52YWx1ZXMpIHtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2Ygbi5jb21tYW5kID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgY29tbWFuZChuLmNvbW1hbmQsIG4uY29tbWFuZF92YWx1ZSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgbi5jb21tYW5kKCk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgICAgcmV0dXJuIGh0bWxgXG4gICAgICAgICR7bi52YWx1ZXNcbiAgICAgICAgICA_IGh0bWxgIDxzZWxlY3RcbiAgICAgICAgICAgICAgaWQ9XCIke24uaWNvbn1cIlxuICAgICAgICAgICAgICBAY2hhbmdlPSR7KGU6IGFueSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHZhbCA9IGUudGFyZ2V0LnZhbHVlO1xuICAgICAgICAgICAgICAgIGlmICh2YWwgPT09IFwiLS1cIikge1xuICAgICAgICAgICAgICAgICAgY29tbWFuZChcInJlbW92ZUZvcm1hdFwiLCB1bmRlZmluZWQpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIG4uY29tbWFuZCA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgY29tbWFuZChuLmNvbW1hbmQsIHZhbCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9fVxuICAgICAgICAgICAgPlxuICAgICAgICAgICAgICAke24udmFsdWVzLm1hcChcbiAgICAgICAgICAgICAgICAodikgPT4gaHRtbGAgPG9wdGlvbiB2YWx1ZT0ke3YudmFsdWV9PiR7di5uYW1lfTwvb3B0aW9uPmBcbiAgICAgICAgICAgICAgKX1cbiAgICAgICAgICAgIDwvc2VsZWN0PmBcbiAgICAgICAgICA6IGh0bWxgICR7ZWxlbX1gfVxuICAgICAgYDtcbiAgICB9KX1cbiAgYDtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGNoZWNrRm9udHMoKTogc3RyaW5nW10ge1xuICBjb25zdCBmb250Q2hlY2sgPSBuZXcgU2V0KFxuICAgIFtcbiAgICAgIC8vIFdpbmRvd3MgMTBcbiAgICAgIFwiQXJpYWxcIixcbiAgICAgIFwiQXJpYWwgQmxhY2tcIixcbiAgICAgIFwiQmFobnNjaHJpZnRcIixcbiAgICAgIFwiQ2FsaWJyaVwiLFxuICAgICAgXCJDYW1icmlhXCIsXG4gICAgICBcIkNhbWJyaWEgTWF0aFwiLFxuICAgICAgXCJDYW5kYXJhXCIsXG4gICAgICBcIkNvbWljIFNhbnMgTVNcIixcbiAgICAgIFwiQ29uc29sYXNcIixcbiAgICAgIFwiQ29uc3RhbnRpYVwiLFxuICAgICAgXCJDb3JiZWxcIixcbiAgICAgIFwiQ291cmllciBOZXdcIixcbiAgICAgIFwiRWJyaW1hXCIsXG4gICAgICBcIkZyYW5rbGluIEdvdGhpYyBNZWRpdW1cIixcbiAgICAgIFwiR2FicmlvbGFcIixcbiAgICAgIFwiR2FkdWdpXCIsXG4gICAgICBcIkdlb3JnaWFcIixcbiAgICAgIFwiSG9sb0xlbnMgTURMMiBBc3NldHNcIixcbiAgICAgIFwiSW1wYWN0XCIsXG4gICAgICBcIkluayBGcmVlXCIsXG4gICAgICBcIkphdmFuZXNlIFRleHRcIixcbiAgICAgIFwiTGVlbGF3YWRlZSBVSVwiLFxuICAgICAgXCJMdWNpZGEgQ29uc29sZVwiLFxuICAgICAgXCJMdWNpZGEgU2FucyBVbmljb2RlXCIsXG4gICAgICBcIk1hbGd1biBHb3RoaWNcIixcbiAgICAgIFwiTWFybGV0dFwiLFxuICAgICAgXCJNaWNyb3NvZnQgSGltYWxheWFcIixcbiAgICAgIFwiTWljcm9zb2Z0IEpoZW5nSGVpXCIsXG4gICAgICBcIk1pY3Jvc29mdCBOZXcgVGFpIEx1ZVwiLFxuICAgICAgXCJNaWNyb3NvZnQgUGhhZ3NQYVwiLFxuICAgICAgXCJNaWNyb3NvZnQgU2FucyBTZXJpZlwiLFxuICAgICAgXCJNaWNyb3NvZnQgVGFpIExlXCIsXG4gICAgICBcIk1pY3Jvc29mdCBZYUhlaVwiLFxuICAgICAgXCJNaWNyb3NvZnQgWWkgQmFpdGlcIixcbiAgICAgIFwiTWluZ0xpVS1FeHRCXCIsXG4gICAgICBcIk1vbmdvbGlhbiBCYWl0aVwiLFxuICAgICAgXCJNUyBHb3RoaWNcIixcbiAgICAgIFwiTVYgQm9saVwiLFxuICAgICAgXCJNeWFubWFyIFRleHRcIixcbiAgICAgIFwiTmlybWFsYSBVSVwiLFxuICAgICAgXCJQYWxhdGlubyBMaW5vdHlwZVwiLFxuICAgICAgXCJTZWdvZSBNREwyIEFzc2V0c1wiLFxuICAgICAgXCJTZWdvZSBQcmludFwiLFxuICAgICAgXCJTZWdvZSBTY3JpcHRcIixcbiAgICAgIFwiU2Vnb2UgVUlcIixcbiAgICAgIFwiU2Vnb2UgVUkgSGlzdG9yaWNcIixcbiAgICAgIFwiU2Vnb2UgVUkgRW1vamlcIixcbiAgICAgIFwiU2Vnb2UgVUkgU3ltYm9sXCIsXG4gICAgICBcIlNpbVN1blwiLFxuICAgICAgXCJTaXRrYVwiLFxuICAgICAgXCJTeWxmYWVuXCIsXG4gICAgICBcIlN5bWJvbFwiLFxuICAgICAgXCJUYWhvbWFcIixcbiAgICAgIFwiVGltZXMgTmV3IFJvbWFuXCIsXG4gICAgICBcIlRyZWJ1Y2hldCBNU1wiLFxuICAgICAgXCJWZXJkYW5hXCIsXG4gICAgICBcIldlYmRpbmdzXCIsXG4gICAgICBcIldpbmdkaW5nc1wiLFxuICAgICAgXCJZdSBHb3RoaWNcIixcbiAgICAgIC8vIG1hY09TXG4gICAgICBcIkFtZXJpY2FuIFR5cGV3cml0ZXJcIixcbiAgICAgIFwiQW5kYWxlIE1vbm9cIixcbiAgICAgIFwiQXJpYWxcIixcbiAgICAgIFwiQXJpYWwgQmxhY2tcIixcbiAgICAgIFwiQXJpYWwgTmFycm93XCIsXG4gICAgICBcIkFyaWFsIFJvdW5kZWQgTVQgQm9sZFwiLFxuICAgICAgXCJBcmlhbCBVbmljb2RlIE1TXCIsXG4gICAgICBcIkF2ZW5pclwiLFxuICAgICAgXCJBdmVuaXIgTmV4dFwiLFxuICAgICAgXCJBdmVuaXIgTmV4dCBDb25kZW5zZWRcIixcbiAgICAgIFwiQmFza2VydmlsbGVcIixcbiAgICAgIFwiQmlnIENhc2xvblwiLFxuICAgICAgXCJCb2RvbmkgNzJcIixcbiAgICAgIFwiQm9kb25pIDcyIE9sZHN0eWxlXCIsXG4gICAgICBcIkJvZG9uaSA3MiBTbWFsbGNhcHNcIixcbiAgICAgIFwiQnJhZGxleSBIYW5kXCIsXG4gICAgICBcIkJydXNoIFNjcmlwdCBNVFwiLFxuICAgICAgXCJDaGFsa2JvYXJkXCIsXG4gICAgICBcIkNoYWxrYm9hcmQgU0VcIixcbiAgICAgIFwiQ2hhbGtkdXN0ZXJcIixcbiAgICAgIFwiQ2hhcnRlclwiLFxuICAgICAgXCJDb2NoaW5cIixcbiAgICAgIFwiQ29taWMgU2FucyBNU1wiLFxuICAgICAgXCJDb3BwZXJwbGF0ZVwiLFxuICAgICAgXCJDb3VyaWVyXCIsXG4gICAgICBcIkNvdXJpZXIgTmV3XCIsXG4gICAgICBcIkRpZG90XCIsXG4gICAgICBcIkRJTiBBbHRlcm5hdGVcIixcbiAgICAgIFwiRElOIENvbmRlbnNlZFwiLFxuICAgICAgXCJGdXR1cmFcIixcbiAgICAgIFwiR2VuZXZhXCIsXG4gICAgICBcIkdlb3JnaWFcIixcbiAgICAgIFwiR2lsbCBTYW5zXCIsXG4gICAgICBcIkhlbHZldGljYVwiLFxuICAgICAgXCJIZWx2ZXRpY2EgTmV1ZVwiLFxuICAgICAgXCJIZXJjdWxhbnVtXCIsXG4gICAgICBcIkhvZWZsZXIgVGV4dFwiLFxuICAgICAgXCJJbXBhY3RcIixcbiAgICAgIFwiTHVjaWRhIEdyYW5kZVwiLFxuICAgICAgXCJMdW1pbmFyaVwiLFxuICAgICAgXCJNYXJrZXIgRmVsdFwiLFxuICAgICAgXCJNZW5sb1wiLFxuICAgICAgXCJNaWNyb3NvZnQgU2FucyBTZXJpZlwiLFxuICAgICAgXCJNb25hY29cIixcbiAgICAgIFwiTm90ZXdvcnRoeVwiLFxuICAgICAgXCJPcHRpbWFcIixcbiAgICAgIFwiUGFsYXRpbm9cIixcbiAgICAgIFwiUGFweXJ1c1wiLFxuICAgICAgXCJQaG9zcGhhdGVcIixcbiAgICAgIFwiUm9ja3dlbGxcIixcbiAgICAgIFwiU2F2b3llIExFVFwiLFxuICAgICAgXCJTaWduUGFpbnRlclwiLFxuICAgICAgXCJTa2lhXCIsXG4gICAgICBcIlNuZWxsIFJvdW5kaGFuZFwiLFxuICAgICAgXCJUYWhvbWFcIixcbiAgICAgIFwiVGltZXNcIixcbiAgICAgIFwiVGltZXMgTmV3IFJvbWFuXCIsXG4gICAgICBcIlRyYXR0YXRlbGxvXCIsXG4gICAgICBcIlRyZWJ1Y2hldCBNU1wiLFxuICAgICAgXCJWZXJkYW5hXCIsXG4gICAgICBcIlphcGZpbm9cIixcbiAgICBdLnNvcnQoKVxuICApO1xuICBjb25zdCBmb250QXZhaWxhYmxlID0gbmV3IFNldDxzdHJpbmc-KCk7XG4gIC8vIEB0cy1pZ25vcmVcbiAgZm9yIChjb25zdCBmb250IG9mIGZvbnRDaGVjay52YWx1ZXMoKSkge1xuICAgIC8vIEB0cy1pZ25vcmVcbiAgICBpZiAoZG9jdW1lbnQuZm9udHMuY2hlY2soYDEycHggXCIke2ZvbnR9XCJgKSkge1xuICAgICAgZm9udEF2YWlsYWJsZS5hZGQoZm9udCk7XG4gICAgfVxuICB9XG4gIC8vIEB0cy1pZ25vcmVcbiAgcmV0dXJuIGZvbnRBdmFpbGFibGUudmFsdWVzKCk7XG59XG4ifSx7Im5hbWUiOiJpbmRleC5odG1sIiwiY29udGVudCI6IjwhRE9DVFlQRSBodG1sPlxuPGh0bWwgbGFuZz1cImVuXCI-XG4gIDxoZWFkPlxuICAgIDxtZXRhIGNoYXJzZXQ9XCJVVEYtOFwiIC8-XG4gICAgPGxpbmsgcmVsPVwiaWNvblwiIHR5cGU9XCJpbWFnZS9zdmcreG1sXCIgaHJlZj1cIi9zcmMvZmF2aWNvbi5zdmdcIiAvPlxuICAgIDxtZXRhIG5hbWU9XCJ2aWV3cG9ydFwiIGNvbnRlbnQ9XCJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MS4wXCIgLz5cbiAgICA8bGlua1xuICAgICAgaHJlZj1cImh0dHBzOi8vZm9udHMuZ29vZ2xlYXBpcy5jb20vY3NzP2ZhbWlseT1NYXRlcmlhbCtJY29ucyZkaXNwbGF5PWJsb2NrXCJcbiAgICAgIHJlbD1cInN0eWxlc2hlZXRcIlxuICAgIC8-XG4gICAgPHRpdGxlPkxpdCBIVE1MIEVkaXRvcjwvdGl0bGU-XG4gICAgPHNjcmlwdCB0eXBlPVwibW9kdWxlXCIgc3JjPVwiLi9yaWNoLXRleHQtZWRpdG9yLmpzXCI-PC9zY3JpcHQ-XG4gICAgPHN0eWxlPlxuICAgICAgYm9keSB7XG4gICAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgICBoZWlnaHQ6IDEwMHZoO1xuICAgICAgICBwYWRkaW5nOiAwO1xuICAgICAgICBtYXJnaW46IDA7XG4gICAgICB9XG4gICAgICByaWNoLXRleHQtZWRpdG9yIHtcbiAgICAgICAgLS1lZGl0b3Itd2lkdGg6IDEwMCU7XG4gICAgICAgIC0tZWRpdG9yLWhlaWdodDogMTAwdmg7XG4gICAgICB9XG4gICAgPC9zdHlsZT5cbiAgPC9oZWFkPlxuICA8Ym9keT5cbiAgICA8cmljaC10ZXh0LWVkaXRvcj5cbiAgICAgIDx0ZW1wbGF0ZT5cbiAgICAgICAgPGgxPkhlYWRsaW5lIDE8L2gxPlxuICAgICAgICA8cD5UaGlzIGlzIGEgcGFyYWdyYXBoLjwvcD5cbiAgICAgICAgPHA-XG4gICAgICAgICAgPHNwYW4gc3R5bGU9XCJiYWNrZ3JvdW5kLWNvbG9yOiByZ2IoMjU1LCAwLCAwKVwiXG4gICAgICAgICAgICA-PGZvbnQgY29sb3I9XCIjZmZmZmZmXCI-U3R5bGVkIFRleHQ8L2ZvbnQ-PC9zcGFuXG4gICAgICAgICAgPlxuICAgICAgICA8L3A-XG4gICAgICA8L3RlbXBsYXRlPlxuICAgIDwvcmljaC10ZXh0LWVkaXRvcj5cbiAgPC9ib2R5PlxuPC9odG1sPlxuIn1d). diff --git a/lit-html-editor/index.html b/lit-html-editor/index.html new file mode 100644 index 0000000..f21a7cc --- /dev/null +++ b/lit-html-editor/index.html @@ -0,0 +1,63 @@ + + + + + + + + Lit HTML Editor + + + + + + + + + diff --git a/lit-html-editor/package-lock.json b/lit-html-editor/package-lock.json new file mode 100644 index 0000000..bf8b35d --- /dev/null +++ b/lit-html-editor/package-lock.json @@ -0,0 +1,653 @@ +{ + "name": "lit-html-editor", + "version": "0.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lit-html-editor", + "version": "0.0.0", + "dependencies": { + "@material/mwc-icon": "^0.25.3", + "@material/mwc-icon-button": "^0.21.0", + "lit": "*" + }, + "devDependencies": { + "typescript": "^4.1.3", + "vite": "^2.3.4" + } + }, + "node_modules/@lit/reactive-element": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.0.0.tgz", + "integrity": "sha512-Kpgenb8UNFsKCsFhggiVvUkCbcFQSd6N8hffYEEGjz27/4rw3cTSsmP9t3q1EHOAsdum60Wo64HvuZDFpEwexA==" + }, + "node_modules/@material/animation": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/animation/-/animation-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-SMkEHENcSy8jYYPg+ZmMGvI5YobU5FlYw0MPsg/RUxBdelt9OMQYELgJW3y7RrppF/tpJoZuYnZwyeUJc4OhLQ==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@material/base": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/base/-/base-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-aMPQ4eM95ZQDY53WzcSEbNhZAqRmYzgumpYEdz5PjOKO66lHparMUXlbQ2LqKhMrKuNg/LWY3Ncl8nL0h0LWfA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@material/dom": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/dom/-/dom-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-uoX4Z0EbrigvHp/M2MzG0S0DNMivTY0U6E0WCiDVo8YrY67NJLSyVJnTpNhtthrCWJInKMcOUJwj73H6/GxX1A==", + "dependencies": { + "@material/feature-targeting": "12.0.0-canary.197f64fa2.0", + "tslib": "^2.1.0" + } + }, + "node_modules/@material/feature-targeting": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-KZoxPbl0iCsESx11bAZ0qeAQJ7eqI6+nBX0T9AaJ5GFELP168uhkINDJX0TvQf5fgTNkEpeQrncJRaFuqHQTMg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@material/mwc-base": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.21.0.tgz", + "integrity": "sha512-yaXnsgMBtz8NEHLhoA6LNPip/8CWKDOdC6HZAPTBQH+ZnyQ8JvqATGSP0YrkiGg34jNVE8gNrbkI85GzNVKmCA==", + "dependencies": { + "@material/base": "=12.0.0-canary.197f64fa2.0", + "@material/dom": "=12.0.0-canary.197f64fa2.0", + "lit-element": "~2.4.0", + "tslib": "^2.0.1" + } + }, + "node_modules/@material/mwc-base/node_modules/lit-element": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", + "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "dependencies": { + "lit-html": "^1.1.1" + } + }, + "node_modules/@material/mwc-icon": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.25.3.tgz", + "integrity": "sha512-36076AWZIRSr8qYOLjuDDkxej/HA0XAosrj7TS1ZeLlUBnLUtbDtvc1S7KSa0hqez7ouzOqGaWK24yoNnTa2OA==", + "dependencies": { + "lit": "^2.0.0", + "tslib": "^2.0.1" + } + }, + "node_modules/@material/mwc-icon-button": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@material/mwc-icon-button/-/mwc-icon-button-0.21.0.tgz", + "integrity": "sha512-puJb956mvzlalDPhkHqb3AgVLO8nZUdHqDpzgX4WgIuQXOXhU1IYKbJpMv3CJG/xpbtETuzftvK5OZ5vO4sfRw==", + "dependencies": { + "@material/mwc-ripple": "^0.21.0", + "lit-element": "~2.4.0", + "tslib": "^2.0.1" + } + }, + "node_modules/@material/mwc-icon-button/node_modules/lit-element": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", + "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "dependencies": { + "lit-html": "^1.1.1" + } + }, + "node_modules/@material/mwc-ripple": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.21.0.tgz", + "integrity": "sha512-4UnUmtEBGJ9qH+bqUz7ydwt3G0sjtqUDujz2d5EFn5Iv6ddo1btcbRCWMm80oKSE4tevfTUMW0+3hlaAqrx8fg==", + "dependencies": { + "@material/dom": "=12.0.0-canary.197f64fa2.0", + "@material/mwc-base": "^0.21.0", + "@material/ripple": "=12.0.0-canary.197f64fa2.0", + "lit-element": "~2.4.0", + "lit-html": "^1.1.2", + "tslib": "^2.0.1" + } + }, + "node_modules/@material/mwc-ripple/node_modules/lit-element": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", + "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "dependencies": { + "lit-html": "^1.1.1" + } + }, + "node_modules/@material/ripple": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-KnwaJ4tb83uATp8dPePSeairxfLKpOhFjAwIqNUAuM2oxMGHQU4F6TU1lNuoH9J4gy+yK3uwmtCqMbQYe265MA==", + "dependencies": { + "@material/animation": "12.0.0-canary.197f64fa2.0", + "@material/base": "12.0.0-canary.197f64fa2.0", + "@material/dom": "12.0.0-canary.197f64fa2.0", + "@material/feature-targeting": "12.0.0-canary.197f64fa2.0", + "@material/theme": "12.0.0-canary.197f64fa2.0", + "tslib": "^2.1.0" + } + }, + "node_modules/@material/theme": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/theme/-/theme-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-7juM8i8nU1LfQjmknAi8OdUwg+Db2XYL9LBQNyQ0pib/WguuydLCwqZWckGGClBsyenn7MLCwIn//GtB5YO1eg==", + "dependencies": { + "@material/feature-targeting": "12.0.0-canary.197f64fa2.0", + "tslib": "^2.1.0" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "node_modules/colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.11.23", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.11.23.tgz", + "integrity": "sha512-iaiZZ9vUF5wJV8ob1tl+5aJTrwDczlvGP0JoMmnpC2B0ppiMCu8n8gmy5ZTGl5bcG081XBVn+U+jP+mPFm5T5Q==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + } + }, + "node_modules/lit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.0.0.tgz", + "integrity": "sha512-pqi5O/wVzQ9Bn4ERRoYQlt1EAUWyY5Wv888vzpoArbtChc+zfUv1XohRqSdtQZYCogl0eHKd+MQwymg2XJfECg==", + "dependencies": { + "@lit/reactive-element": "^1.0.0", + "lit-element": "^3.0.0", + "lit-html": "^2.0.0" + } + }, + "node_modules/lit-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.0.0.tgz", + "integrity": "sha512-oPqRhhBBhs+AlI62QLwtWQNU/bNK/h2L1jI3IDroqZubo6XVAkyNy2dW3CRfjij8mrNlY7wULOfyyKKOnfEePA==", + "dependencies": { + "@lit/reactive-element": "^1.0.0", + "lit-html": "^2.0.0" + } + }, + "node_modules/lit-element/node_modules/lit-html": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0.tgz", + "integrity": "sha512-tJsCapCmc0vtLj6harqd6HfCxnlt/RSkgowtz4SC9dFE3nSL38Tb33I5HMDiyJsRjQZRTgpVsahrnDrR9wg27w==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/lit-html": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.4.1.tgz", + "integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==" + }, + "node_modules/lit/node_modules/lit-html": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0.tgz", + "integrity": "sha512-tJsCapCmc0vtLj6harqd6HfCxnlt/RSkgowtz4SC9dFE3nSL38Tb33I5HMDiyJsRjQZRTgpVsahrnDrR9wg27w==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.0.tgz", + "integrity": "sha512-+ogXpdAjWGa+fdYY5BQ96V/6tAo+TdSSIMP5huJBIygdWwKtVoB5JWZ7yUd4xZ8r+8Kvvx4nyg/PQ071H4UtcQ==", + "dev": true, + "dependencies": { + "colorette": "^1.2.2", + "nanoid": "^3.1.23", + "source-map-js": "^0.6.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "node_modules/rollup": { + "version": "2.50.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.50.0.tgz", + "integrity": "sha512-wO+F2MqWPGUCZx0549oqY8dsQqHVjuSxoyBWWnxKoQE+1UGcDKjtL7wHq/8jnnLJEeoGDQLf3ztrpgRwlbGJ0A==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, + "node_modules/typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/vite": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.3.4.tgz", + "integrity": "sha512-7orxrF65+Q5n/sMCnO91S8OS0gkPJ7g+y3bLlc7CPCXVswK8to1T8YycCk9SZh+AcIc0TuN6YajWTBFS5atMNA==", + "dev": true, + "dependencies": { + "esbuild": "^0.11.23", + "postcss": "^8.2.10", + "resolve": "^1.19.0", + "rollup": "^2.38.5" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": ">=12.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + } + }, + "dependencies": { + "@lit/reactive-element": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.0.0.tgz", + "integrity": "sha512-Kpgenb8UNFsKCsFhggiVvUkCbcFQSd6N8hffYEEGjz27/4rw3cTSsmP9t3q1EHOAsdum60Wo64HvuZDFpEwexA==" + }, + "@material/animation": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/animation/-/animation-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-SMkEHENcSy8jYYPg+ZmMGvI5YobU5FlYw0MPsg/RUxBdelt9OMQYELgJW3y7RrppF/tpJoZuYnZwyeUJc4OhLQ==", + "requires": { + "tslib": "^2.1.0" + } + }, + "@material/base": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/base/-/base-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-aMPQ4eM95ZQDY53WzcSEbNhZAqRmYzgumpYEdz5PjOKO66lHparMUXlbQ2LqKhMrKuNg/LWY3Ncl8nL0h0LWfA==", + "requires": { + "tslib": "^2.1.0" + } + }, + "@material/dom": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/dom/-/dom-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-uoX4Z0EbrigvHp/M2MzG0S0DNMivTY0U6E0WCiDVo8YrY67NJLSyVJnTpNhtthrCWJInKMcOUJwj73H6/GxX1A==", + "requires": { + "@material/feature-targeting": "12.0.0-canary.197f64fa2.0", + "tslib": "^2.1.0" + } + }, + "@material/feature-targeting": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-KZoxPbl0iCsESx11bAZ0qeAQJ7eqI6+nBX0T9AaJ5GFELP168uhkINDJX0TvQf5fgTNkEpeQrncJRaFuqHQTMg==", + "requires": { + "tslib": "^2.1.0" + } + }, + "@material/mwc-base": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.21.0.tgz", + "integrity": "sha512-yaXnsgMBtz8NEHLhoA6LNPip/8CWKDOdC6HZAPTBQH+ZnyQ8JvqATGSP0YrkiGg34jNVE8gNrbkI85GzNVKmCA==", + "requires": { + "@material/base": "=12.0.0-canary.197f64fa2.0", + "@material/dom": "=12.0.0-canary.197f64fa2.0", + "lit-element": "~2.4.0", + "tslib": "^2.0.1" + }, + "dependencies": { + "lit-element": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", + "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "requires": { + "lit-html": "^1.1.1" + } + } + } + }, + "@material/mwc-icon": { + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.25.3.tgz", + "integrity": "sha512-36076AWZIRSr8qYOLjuDDkxej/HA0XAosrj7TS1ZeLlUBnLUtbDtvc1S7KSa0hqez7ouzOqGaWK24yoNnTa2OA==", + "requires": { + "lit": "^2.0.0", + "tslib": "^2.0.1" + } + }, + "@material/mwc-icon-button": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@material/mwc-icon-button/-/mwc-icon-button-0.21.0.tgz", + "integrity": "sha512-puJb956mvzlalDPhkHqb3AgVLO8nZUdHqDpzgX4WgIuQXOXhU1IYKbJpMv3CJG/xpbtETuzftvK5OZ5vO4sfRw==", + "requires": { + "@material/mwc-ripple": "^0.21.0", + "lit-element": "~2.4.0", + "tslib": "^2.0.1" + }, + "dependencies": { + "lit-element": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", + "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "requires": { + "lit-html": "^1.1.1" + } + } + } + }, + "@material/mwc-ripple": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.21.0.tgz", + "integrity": "sha512-4UnUmtEBGJ9qH+bqUz7ydwt3G0sjtqUDujz2d5EFn5Iv6ddo1btcbRCWMm80oKSE4tevfTUMW0+3hlaAqrx8fg==", + "requires": { + "@material/dom": "=12.0.0-canary.197f64fa2.0", + "@material/mwc-base": "^0.21.0", + "@material/ripple": "=12.0.0-canary.197f64fa2.0", + "lit-element": "~2.4.0", + "lit-html": "^1.1.2", + "tslib": "^2.0.1" + }, + "dependencies": { + "lit-element": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", + "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "requires": { + "lit-html": "^1.1.1" + } + } + } + }, + "@material/ripple": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-KnwaJ4tb83uATp8dPePSeairxfLKpOhFjAwIqNUAuM2oxMGHQU4F6TU1lNuoH9J4gy+yK3uwmtCqMbQYe265MA==", + "requires": { + "@material/animation": "12.0.0-canary.197f64fa2.0", + "@material/base": "12.0.0-canary.197f64fa2.0", + "@material/dom": "12.0.0-canary.197f64fa2.0", + "@material/feature-targeting": "12.0.0-canary.197f64fa2.0", + "@material/theme": "12.0.0-canary.197f64fa2.0", + "tslib": "^2.1.0" + } + }, + "@material/theme": { + "version": "12.0.0-canary.197f64fa2.0", + "resolved": "https://registry.npmjs.org/@material/theme/-/theme-12.0.0-canary.197f64fa2.0.tgz", + "integrity": "sha512-7juM8i8nU1LfQjmknAi8OdUwg+Db2XYL9LBQNyQ0pib/WguuydLCwqZWckGGClBsyenn7MLCwIn//GtB5YO1eg==", + "requires": { + "@material/feature-targeting": "12.0.0-canary.197f64fa2.0", + "tslib": "^2.1.0" + } + }, + "@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "colorette": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", + "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "dev": true + }, + "esbuild": { + "version": "0.11.23", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.11.23.tgz", + "integrity": "sha512-iaiZZ9vUF5wJV8ob1tl+5aJTrwDczlvGP0JoMmnpC2B0ppiMCu8n8gmy5ZTGl5bcG081XBVn+U+jP+mPFm5T5Q==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "lit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.0.0.tgz", + "integrity": "sha512-pqi5O/wVzQ9Bn4ERRoYQlt1EAUWyY5Wv888vzpoArbtChc+zfUv1XohRqSdtQZYCogl0eHKd+MQwymg2XJfECg==", + "requires": { + "@lit/reactive-element": "^1.0.0", + "lit-element": "^3.0.0", + "lit-html": "^2.0.0" + }, + "dependencies": { + "lit-html": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0.tgz", + "integrity": "sha512-tJsCapCmc0vtLj6harqd6HfCxnlt/RSkgowtz4SC9dFE3nSL38Tb33I5HMDiyJsRjQZRTgpVsahrnDrR9wg27w==", + "requires": { + "@types/trusted-types": "^2.0.2" + } + } + } + }, + "lit-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.0.0.tgz", + "integrity": "sha512-oPqRhhBBhs+AlI62QLwtWQNU/bNK/h2L1jI3IDroqZubo6XVAkyNy2dW3CRfjij8mrNlY7wULOfyyKKOnfEePA==", + "requires": { + "@lit/reactive-element": "^1.0.0", + "lit-html": "^2.0.0" + }, + "dependencies": { + "lit-html": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.0.0.tgz", + "integrity": "sha512-tJsCapCmc0vtLj6harqd6HfCxnlt/RSkgowtz4SC9dFE3nSL38Tb33I5HMDiyJsRjQZRTgpVsahrnDrR9wg27w==", + "requires": { + "@types/trusted-types": "^2.0.2" + } + } + } + }, + "lit-html": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.4.1.tgz", + "integrity": "sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==" + }, + "nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "postcss": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.0.tgz", + "integrity": "sha512-+ogXpdAjWGa+fdYY5BQ96V/6tAo+TdSSIMP5huJBIygdWwKtVoB5JWZ7yUd4xZ8r+8Kvvx4nyg/PQ071H4UtcQ==", + "dev": true, + "requires": { + "colorette": "^1.2.2", + "nanoid": "^3.1.23", + "source-map-js": "^0.6.2" + } + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "rollup": { + "version": "2.50.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.50.0.tgz", + "integrity": "sha512-wO+F2MqWPGUCZx0549oqY8dsQqHVjuSxoyBWWnxKoQE+1UGcDKjtL7wHq/8jnnLJEeoGDQLf3ztrpgRwlbGJ0A==", + "dev": true, + "requires": { + "fsevents": "~2.3.1" + } + }, + "source-map-js": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", + "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "dev": true + }, + "tslib": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", + "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + }, + "typescript": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", + "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "dev": true + }, + "vite": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.3.4.tgz", + "integrity": "sha512-7orxrF65+Q5n/sMCnO91S8OS0gkPJ7g+y3bLlc7CPCXVswK8to1T8YycCk9SZh+AcIc0TuN6YajWTBFS5atMNA==", + "dev": true, + "requires": { + "esbuild": "^0.11.23", + "fsevents": "~2.3.1", + "postcss": "^8.2.10", + "resolve": "^1.19.0", + "rollup": "^2.38.5" + } + } + } +} diff --git a/lit-html-editor/package.json b/lit-html-editor/package.json new file mode 100644 index 0000000..1d60f87 --- /dev/null +++ b/lit-html-editor/package.json @@ -0,0 +1,18 @@ +{ + "name": "lit-html-editor", + "version": "0.0.0", + "types": "types/my-element.d.ts", + "scripts": { + "dev": "vite --host", + "build": "tsc && vite build" + }, + "dependencies": { + "@material/mwc-icon": "^0.25.3", + "@material/mwc-icon-button": "^0.21.0", + "lit": "*" + }, + "devDependencies": { + "typescript": "^4.1.3", + "vite": "^2.3.4" + } +} diff --git a/lit-html-editor/screenshot.png b/lit-html-editor/screenshot.png new file mode 100644 index 0000000..c3ebe52 Binary files /dev/null and b/lit-html-editor/screenshot.png differ diff --git a/lit-html-editor/src/components/rich-action.ts b/lit-html-editor/src/components/rich-action.ts new file mode 100644 index 0000000..937792b --- /dev/null +++ b/lit-html-editor/src/components/rich-action.ts @@ -0,0 +1,96 @@ +import { html, css, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +import "@material/mwc-icon-button"; +import "@material/mwc-icon"; + +@customElement("rich-action") +export class RichAction extends LitElement { + static styles = css` + * { + --mdc-icon-size: var(--icon-size); + --mdc-icon-button-size: var(--icon-size); + } + section { + height: 100%; + display: flex; + flex-direction: row; + align-items: center; + } + section * { + margin: 2px; + } + mwc-icon-button[active] { + color: var(--rich-action-active-color); + } + mwc-icon { + cursor: pointer; + } + `; + + @property({ type: String }) command = ""; + @property({ type: String }) value?: string; + @property({ type: String }) icon = "info"; + @property({ type: Boolean }) active = false; + @property({ type: Array, hasChanged: () => true }) values: Option[] = []; + + render() { + const { icon, command, value, active, values } = this; + const hasItems = values.length > 0; + return html`
+ ${hasItems + ? html` ${icon} + ` + : html` { + if (command) { + editorCommand(command, value); + } else { + this.dispatchEvent( + new Event("action", { + bubbles: true, + composed: true, + }) + ); + } + }} + >`} +
+
`; + } +} + +interface Option { + name: string; + value: string; +} + +export function editorCommand(command: string, value?: string) { + document.execCommand(command, true, value); +} + +declare global { + interface HTMLElementTagNameMap { + "rich-action": RichAction; + } +} diff --git a/lit-html-editor/src/components/rich-text.ts b/lit-html-editor/src/components/rich-text.ts new file mode 100644 index 0000000..e214ed5 --- /dev/null +++ b/lit-html-editor/src/components/rich-text.ts @@ -0,0 +1,130 @@ +import { html, css, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { live } from "../utils/live"; + +import "./rich-toolbar"; +import "./rich-viewer"; + +@customElement("rich-text") +export class RichText extends LitElement { + static styles = css` + :host { + --rich-color: black; + --rich-background: white; + --rich-action-active-color: red; + --icon-size: 24px; + --rich-padding: 8px; + } + main { + height: 100%; + width: 100%; + display: grid; + grid-template-rows: 1fr auto; + grid-template-columns: 1fr; + grid-template-areas: + "viewer" + "toolbar"; + } + + rich-toolbar { + grid-area: toolbar; + width: 100%; + overflow-x: auto; + background-color: var(--rich-background); + color: var(--rich-color); + border-top: 1px solid var(--rich-color); + } + + rich-viewer { + grid-area: viewer; + flex: 1; + width: 100%; + overflow-y: auto; + background-color: var(--rich-background); + color: var(--rich-color); + } + + /* @media (hover: hover) and (pointer: fine) { + main { + grid-template-rows: auto 1fr; + grid-template-areas: + "toolbar" + "viewer"; + } + rich-toolbar { + border-top: none; + border-bottom: 1px solid var(--rich-color); + } + } */ + main { + grid-template-rows: auto 1fr; + grid-template-areas: + "toolbar" + "viewer"; + } + rich-toolbar { + border-top: none; + border-bottom: 1px solid var(--rich-color); + } + + @media (prefers-color-scheme: dark) { + :host { + --rich-background: black; + --rich-color: white; + } + } + `; + + @live selection: Selection | null = null; + @property({ type: Boolean }) readonly = false; + @property({ type: Object, hasChanged: () => true }) node: Element = + document.createElement("div"); + + render() { + const { selection, readonly, node } = this; + return html`
+ { + const event = e as CustomEvent; + const parser = new DOMParser(); + const doc = parser.parseFromString(event.detail, "text/html"); + const root = doc.querySelector("body"); + this.node.innerHTML = root?.innerHTML ?? ""; + this.requestUpdate(); + }} + > + { + const event = e as CustomEvent; + this.selection = event.detail; + }} + .node=${node} + > + +
`; + } + + firstUpdated() { + const children = this.children; + if (children.length > 0) { + // Check if