chore: setup and run prettier

This commit is contained in:
CoolElectronics 2024-03-13 20:16:11 -04:00
parent ffe095557e
commit 7a131a3e2e
No known key found for this signature in database
GPG key ID: F63593D168636C50
17 changed files with 1418 additions and 1512 deletions

97
DreamlandJS.d.ts vendored
View file

@ -1,15 +1,15 @@
declare namespace JSX { declare namespace JSX {
export type IntrinsicElements = { export type IntrinsicElements = {
[index: string]: any [index: string]: any
}; }
type ElementType = Fragment | string | Component<any, any>; type ElementType = Fragment | string | Component<any, any>
type Element = DLElement<any>; type Element = DLElement<any>
interface ElementAttributesProperty { interface ElementAttributesProperty {
props: {}; props: {}
} }
interface ElementChildrenAttribute { interface ElementChildrenAttribute {
children: {}; children: {}
} }
} }
@ -17,33 +17,46 @@ declare function h(
type: string, type: string,
props?: { [index: string]: any } | null, props?: { [index: string]: any } | null,
...children: (HTMLElement | string)[] ...children: (HTMLElement | string)[]
): Node; ): Node
declare function $if(condition: DLPointer<any> | any, then?: Element, otherwise?: Element): HTMLElement; declare function $if(
condition: DLPointer<any> | any,
then?: Element,
otherwise?: Element
): HTMLElement
type DLPointer<T> = { readonly __symbol: unique symbol, readonly __signature: T }; type DLPointer<T> = {
readonly __symbol: unique symbol
readonly __signature: T
}
declare function use<T>(sink: T, mapping?: (arg: T) => any): DLPointer<T>; declare function use<T>(sink: T, mapping?: (arg: T) => any): DLPointer<T>
declare function useValue<T>(trap: DLPointer<T>): T; declare function useValue<T>(trap: DLPointer<T>): T
type Stateful<T> = T & { readonly symbol: unique symbol }; type Stateful<T> = T & { readonly symbol: unique symbol }
declare function stateful<T>(target: T): Stateful<T>
declare function $state<T>(target: T): Stateful<T>
declare function $store<T>(
target: T,
ident: string,
backing: 'localstorage'
): Stateful<T>
declare function stateful<T>(target: T): Stateful<T>; declare function handle<T>(
declare function $state<T>(target: T): Stateful<T>; references: DLPointer<T>,
declare function $store<T>(target: T, ident: string, backing: "localstorage"): Stateful<T>; callback: (value: T) => void
): void
declare function handle<T>(references: DLPointer<T>, callback: (value: T) => void): void; declare function css(strings: TemplateStringsArray, ...values: any): string
declare function rule(strings: TemplateStringsArray, ...values: any): string
declare var styled: { new: typeof css; rule: typeof rule }
declare function css(strings: TemplateStringsArray, ...values: any): string; type DLCSS = string
declare function rule(strings: TemplateStringsArray, ...values: any): string;
declare var styled: { new: typeof css, rule: typeof rule };
type DLCSS = string; declare var $el: HTMLElement
declare var $el: HTMLElement; type Fragment = { readonly fragment: unique symbol }
declare var Fragment: Fragment
type Fragment = { readonly fragment: unique symbol };
declare var Fragment: Fragment;
interface Element { interface Element {
$: OuterComponentTypes & { [index: string | symbol]: any } $: OuterComponentTypes & { [index: string | symbol]: any }
@ -53,32 +66,32 @@ interface DLElement<T> extends HTMLElement {
$: T & OuterComponentTypes $: T & OuterComponentTypes
} }
type ComponentElement<T extends (...args: any) => any> = ReturnType<T>; type ComponentElement<T extends (...args: any) => any> = ReturnType<T>
type OuterComponentTypes = { type OuterComponentTypes = {
root: Element, root: Element
children: Element[], children: Element[]
} }
type InnerComponentTypes = { type InnerComponentTypes = {
css: DLCSS, css: DLCSS
mount?: () => void, mount?: () => void
} }
type ComponentTypes = OuterComponentTypes & InnerComponentTypes; type ComponentTypes = OuterComponentTypes & InnerComponentTypes
type ArrayOrSingular<T extends []> = T | T[keyof T]; type ArrayOrSingular<T extends []> = T | T[keyof T]
type Component<Public, Private, Constructed extends string | symbol | number = never> = type Component<
( Public,
( Private,
Constructed extends string | symbol | number = never,
> = (
this: Public & Private & ComponentTypes, this: Public & Private & ComponentTypes,
props: ( props: ([Constructed] extends [never]
[Constructed] extends [never] ? Public : Omit<Public, Constructed> ? Public
) & : Omit<Public, Constructed>) & {
{ children?: ArrayOrSingular<
children?: ArrayOrSingular<Private extends { children: any } ? Private["children"] : never> Private extends { children: any } ? Private['children'] : never
>
[index: `${'bind:'}${string}`]: any [index: `${'bind:'}${string}`]: any
}, }
) => DLElement<Public> ) => DLElement<Public>
)

View file

@ -1,83 +1,89 @@
## What is Dreamland? ## What is Dreamland?
dreamland.js is a reactive JSX-inspired rendering library with **no virtual dom** and **no build step** dreamland.js is a reactive JSX-inspired rendering library with **no virtual dom** and **no build step**
## Why Dreamland? ## Why Dreamland?
We've found frameworks such as React to be cumbersome, with more than just a few footguns. Dreamland can get you fast results with brutal simplicity. See the [documentation](https://dreamland.js.org) for more information. We've found frameworks such as React to be cumbersome, with more than just a few footguns. Dreamland can get you fast results with brutal simplicity. See the [documentation](https://dreamland.js.org) for more information.
## What does it look like? ## What does it look like?
Here's a simple counter app Here's a simple counter app
```jsx ```jsx
function App() { function App() {
this.counter = 0; this.counter = 0
return ( return (
<div> <div>
<button on:click={() => this.counter++}>Click me!</button> <button on:click={() => this.counter++}>Click me!</button>
<p> <p>{use(this.counter)}</p>
{use(this.counter)}
</p>
</div> </div>
); )
} }
window.addEventListener("load", () => { window.addEventListener('load', () => {
document.body.appendChild(<App/>); document.body.appendChild(<App />)
}); })
``` ```
Compare that to the equivalent code in react: Compare that to the equivalent code in react:
```jsx ```jsx
import { React, useState } from 'react' import { React, useState } from 'react'
function App() { function App() {
const [counter, setCounter] = useState(0); const [counter, setCounter] = useState(0)
const increase = () => { const increase = () => {
setCounter(count => count + 1); setCounter((count) => count + 1)
}; }
return ( return (
<div> <div>
<button onClick={increase}>Click me!</button> <button onClick={increase}>Click me!</button>
<p> <p>Value: {counter}</p>
Value: {counter}
</p>
</div> </div>
); )
} }
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<App /> <App />
</React.StrictMode>, </React.StrictMode>,
document.getElementById("root") document.getElementById('root')
); )
``` ```
The idea of dreamland is to get some of the convience of big framworks at a ridiculously tiny size (~3kb, smaller than preact) with less hurdles. The idea of dreamland is to get some of the convience of big framworks at a ridiculously tiny size (~3kb, smaller than preact) with less hurdles.
# Getting Started # Getting Started
Dreamland can be integrated into plain-javascript applications gradually and seamlessly. See the [Wiki](https://github.com/MercuryWorkshop/dreamlandjs/wiki) for learning the concepts that dreamland uses. Dreamland can be integrated into plain-javascript applications gradually and seamlessly. See the [Wiki](https://github.com/MercuryWorkshop/dreamlandjs/wiki) for learning the concepts that dreamland uses.
## Plain JS ## Plain JS
In your HTML file, add `<script src="https://unpkg.com/dreamland"></script>` somewhere. This unlocks the html builder allowing you to start writing dreamland code, such as the example shown below In your HTML file, add `<script src="https://unpkg.com/dreamland"></script>` somewhere. This unlocks the html builder allowing you to start writing dreamland code, such as the example shown below
```javascript ```javascript
function App() { function App() {
this.counter = 0; this.counter = 0
return html` return html`
<div> <div>
<button on:click=${() => this.counter++}>Click me!</button> <button on:click=${() => this.counter++}>Click me!</button>
<p> <p>${use(this.counter)}</p>
${use(this.counter)}
</p>
</div> </div>
`; `
} }
window.addEventListener("load", () => { window.addEventListener('load', () => {
document.body.appendChild(h(App)); document.body.appendChild(h(App))
}); })
``` ```
## Typescript + Bundler (vite, rollup, webpack, esbuild, etc) ## Typescript + Bundler (vite, rollup, webpack, esbuild, etc)
First install dreamland (`npm install dreamland`), then add this to the compileroptions of your `tsconfig.json` to setup JSX. First install dreamland (`npm install dreamland`), then add this to the compileroptions of your `tsconfig.json` to setup JSX.
```json ```json
"jsx":"react", "jsx":"react",
"jsxFactory":"h", "jsxFactory":"h",
@ -89,27 +95,28 @@ In the entry point of the app, add the line `import "dreamland/dev"` into at lea
```tsx ```tsx
// typescript syntax for defining components // typescript syntax for defining components
const App: Component<{ const App: Component<
{
// component properties. if you had a component that took a property like `<Button text="..." /> you would use a type like the one in the following line // component properties. if you had a component that took a property like `<Button text="..." /> you would use a type like the one in the following line
// text: string // text: string
},{ },
{
// types for internal state // types for internal state
counter: number counter: number
}> = function() { }
this.counter = 0; > = function () {
this.counter = 0
return ( return (
<div> <div>
<button on:click={() => this.counter++}>Click me!</button> <button on:click={() => this.counter++}>Click me!</button>
<p> <p>{use(this.counter)}</p>
{use(this.counter)}
</p>
</div> </div>
); )
} }
window.addEventListener("load", () => { window.addEventListener('load', () => {
document.body.appendChild(<App/>); document.body.appendChild(<App />)
}); })
``` ```
See the [documentation](https://dreamland.js.org) for more information. See the [documentation](https://dreamland.js.org) for more information.

View file

@ -1,18 +1,14 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Dreamland examples</title> <title>Dreamland examples</title>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="index.css" /> <link rel="stylesheet" href="index.css" />
<script src="../index.js"></script> <script src="../index.js"></script>
<script src="lib/index.js"></script> <script src="lib/index.js"></script>
</head> </head>
<body> <body></body>
</body>
</html> </html>

View file

@ -14,7 +14,8 @@ body {
padding: 2em; padding: 2em;
} }
p,h1 { p,
font-family: "serif"; h1 {
font-family: 'serif';
color: #e0def4; color: #e0def4;
} }

View file

@ -19,19 +19,18 @@ function Counter() {
p { p {
font-size: 20px; font-size: 20px;
} }
`; `
this.counter ??= 0; this.counter ??= 0
return ( return (
<div class="box"> <div class="box">
<h1>Counter</h1> <h1>Counter</h1>
<p> <p>Value: {use(this.counter)}</p>
Value: {use(this.counter)}
</p>
<button on:click={() => this.counter++}>Click me!</button> <button on:click={() => this.counter++}>Click me!</button>
<p> <p>
is {use(this.counter)} odd? {use(this.counter, p => p % 2 == 1)} is {use(this.counter)} odd?{' '}
{use(this.counter, (p) => p % 2 == 1)}
</p> </p>
</div> </div>
) )
@ -120,14 +119,20 @@ function Counter() {
// ); // );
// } // }
window.addEventListener("load", () => { window.addEventListener('load', () => {
document.body.appendChild(<Counter />); document.body.appendChild(<Counter />)
}); })
let a = stateful({ b: stateful({ c: stateful({ d: 0 }) }), array: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] }) as any; let a = stateful({
let r = use(a.array[a.b.c.d][a.b.c.d]); b: stateful({ c: stateful({ d: 0 }) }),
array: [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
],
}) as any
let r = use(a.array[a.b.c.d][a.b.c.d])
handle(r, (v) => {
handle(r, v => { console.log(v)
console.log(v); })
});

View file

@ -1,10 +1,11 @@
{ {
"name": "dreamland", "name": "dreamland",
"version": "0.0.3", "version": "0.0.4",
"description": "A utilitarian HTML rendering library", "description": "A utilitarian HTML rendering library",
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c && prettier . --check",
"watch": "rollup -cw" "watch": "rollup -cw",
"publish": "npm publish --access public"
}, },
"keywords": [ "keywords": [
"html", "html",
@ -45,10 +46,10 @@
"dist", "dist",
"DreamlandJS.d.ts" "DreamlandJS.d.ts"
], ],
"devDependencies": { "devDependencies": {
"rollup": "^4.12.1",
"@rollup/plugin-strip": "^3.0.4", "@rollup/plugin-strip": "^3.0.4",
"prettier": "^3.2.5",
"rollup": "^4.12.1",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"typescript": "^5.3.3" "typescript": "^5.3.3"
} }

713
pnpm-lock.yaml generated
View file

@ -4,123 +4,115 @@ settings:
autoInstallPeers: true autoInstallPeers: true
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
dependencies: devDependencies:
'@ampproject/rollup-plugin-closure-compiler':
specifier: ^0.27.0
version: 0.27.0(rollup@4.12.1)
'@rollup/plugin-strip': '@rollup/plugin-strip':
specifier: ^3.0.4 specifier: ^3.0.4
version: 3.0.4(rollup@4.12.1) version: 3.0.4(rollup@4.12.1)
mkdirp: prettier:
specifier: ^3.0.1 specifier: ^3.2.5
version: 3.0.1 version: 3.2.5
rollup-plugin-minify:
specifier: ^1.0.3
version: 1.0.3
rollup-plugin-terser:
specifier: ^7.0.2
version: 7.0.2(rollup@4.12.1)
devDependencies:
rollup: rollup:
specifier: ^4.12.1 specifier: ^4.12.1
version: 4.12.1 version: 4.12.1
rollup-plugin-terser:
specifier: ^7.0.2
version: 7.0.2(rollup@4.12.1)
typescript: typescript:
specifier: ^5.3.3 specifier: ^5.3.3
version: 5.3.3 version: 5.3.3
packages: packages:
/@ampproject/remapping@0.2.0:
resolution: {integrity: sha512-a4EztS9/GOVQjX5Ol+Iz33TFhaXvYBF7aB6D8+Qz0/SCIxOm3UNRhGZiwcCuJ8/Ifc6NCogp3S48kc5hFxRpUw==}
engines: {node: '>=6.0.0'}
dependencies:
'@jridgewell/resolve-uri': 1.0.0
sourcemap-codec: 1.4.8
dev: false
/@ampproject/rollup-plugin-closure-compiler@0.27.0(rollup@4.12.1):
resolution: {integrity: sha512-stpAOn2ZZEJuAV39HFw9cnKJYNhEeHtcsoa83orpLDhSxsxSbVEKwHaWlFBaQYpQRSOdapC4eJhJnCzocZxnqg==}
engines: {node: '>=10'}
peerDependencies:
rollup: '>=1.27'
dependencies:
'@ampproject/remapping': 0.2.0
acorn: 7.3.1
acorn-walk: 7.1.1
estree-walker: 2.0.1
google-closure-compiler: 20210808.0.0
magic-string: 0.25.7
rollup: 4.12.1
uuid: 8.1.0
dev: false
/@babel/code-frame@7.23.5: /@babel/code-frame@7.23.5:
resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} resolution:
{
integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==,
}
engines: { node: '>=6.9.0' } engines: { node: '>=6.9.0' }
dependencies: dependencies:
'@babel/highlight': 7.23.4 '@babel/highlight': 7.23.4
chalk: 2.4.2 chalk: 2.4.2
dev: false dev: true
/@babel/helper-validator-identifier@7.22.20: /@babel/helper-validator-identifier@7.22.20:
resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} resolution:
{
integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==,
}
engines: { node: '>=6.9.0' } engines: { node: '>=6.9.0' }
dev: false dev: true
/@babel/highlight@7.23.4: /@babel/highlight@7.23.4:
resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} resolution:
{
integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==,
}
engines: { node: '>=6.9.0' } engines: { node: '>=6.9.0' }
dependencies: dependencies:
'@babel/helper-validator-identifier': 7.22.20 '@babel/helper-validator-identifier': 7.22.20
chalk: 2.4.2 chalk: 2.4.2
js-tokens: 4.0.0 js-tokens: 4.0.0
dev: false dev: true
/@jridgewell/gen-mapping@0.3.5: /@jridgewell/gen-mapping@0.3.5:
resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} resolution:
{
integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==,
}
engines: { node: '>=6.0.0' } engines: { node: '>=6.0.0' }
dependencies: dependencies:
'@jridgewell/set-array': 1.2.1 '@jridgewell/set-array': 1.2.1
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
'@jridgewell/trace-mapping': 0.3.25 '@jridgewell/trace-mapping': 0.3.25
dev: false dev: true
/@jridgewell/resolve-uri@1.0.0:
resolution: {integrity: sha512-9oLAnygRMi8Q5QkYEU4XWK04B+nuoXoxjRvRxgjuChkLZFBja0YPSgdZ7dZtwhncLBcQe/I/E+fLuk5qxcYVJA==}
engines: {node: '>=6.0.0'}
dev: false
/@jridgewell/resolve-uri@3.1.2: /@jridgewell/resolve-uri@3.1.2:
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} resolution:
{
integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==,
}
engines: { node: '>=6.0.0' } engines: { node: '>=6.0.0' }
dev: false dev: true
/@jridgewell/set-array@1.2.1: /@jridgewell/set-array@1.2.1:
resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} resolution:
{
integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==,
}
engines: { node: '>=6.0.0' } engines: { node: '>=6.0.0' }
dev: false dev: true
/@jridgewell/source-map@0.3.5: /@jridgewell/source-map@0.3.5:
resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==} resolution:
{
integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==,
}
dependencies: dependencies:
'@jridgewell/gen-mapping': 0.3.5 '@jridgewell/gen-mapping': 0.3.5
'@jridgewell/trace-mapping': 0.3.25 '@jridgewell/trace-mapping': 0.3.25
dev: false dev: true
/@jridgewell/sourcemap-codec@1.4.15: /@jridgewell/sourcemap-codec@1.4.15:
resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} resolution:
dev: false {
integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==,
}
dev: true
/@jridgewell/trace-mapping@0.3.25: /@jridgewell/trace-mapping@0.3.25:
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} resolution:
{
integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==,
}
dependencies: dependencies:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
dev: false dev: true
/@rollup/plugin-strip@3.0.4(rollup@4.12.1): /@rollup/plugin-strip@3.0.4(rollup@4.12.1):
resolution: {integrity: sha512-LDRV49ZaavxUo2YoKKMQjCxzCxugu1rCPQa0lDYBOWLj6vtzBMr8DcoJjsmg+s450RbKbe3qI9ZLaSO+O1oNbg==} resolution:
{
integrity: sha512-LDRV49ZaavxUo2YoKKMQjCxzCxugu1rCPQa0lDYBOWLj6vtzBMr8DcoJjsmg+s450RbKbe3qI9ZLaSO+O1oNbg==,
}
engines: { node: '>=14.0.0' } engines: { node: '>=14.0.0' }
peerDependencies: peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
@ -132,10 +124,13 @@ packages:
estree-walker: 2.0.2 estree-walker: 2.0.2
magic-string: 0.30.8 magic-string: 0.30.8
rollup: 4.12.1 rollup: 4.12.1
dev: false dev: true
/@rollup/pluginutils@5.1.0(rollup@4.12.1): /@rollup/pluginutils@5.1.0(rollup@4.12.1):
resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} resolution:
{
integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==,
}
engines: { node: '>=14.0.0' } engines: { node: '>=14.0.0' }
peerDependencies: peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
@ -147,419 +142,337 @@ packages:
estree-walker: 2.0.2 estree-walker: 2.0.2
picomatch: 2.3.1 picomatch: 2.3.1
rollup: 4.12.1 rollup: 4.12.1
dev: false dev: true
/@rollup/rollup-android-arm-eabi@4.12.1: /@rollup/rollup-android-arm-eabi@4.12.1:
resolution: {integrity: sha512-iU2Sya8hNn1LhsYyf0N+L4Gf9Qc+9eBTJJJsaOGUp+7x4n2M9dxTt8UvhJl3oeftSjblSlpCfvjA/IfP3g5VjQ==} resolution:
{
integrity: sha512-iU2Sya8hNn1LhsYyf0N+L4Gf9Qc+9eBTJJJsaOGUp+7x4n2M9dxTt8UvhJl3oeftSjblSlpCfvjA/IfP3g5VjQ==,
}
cpu: [arm] cpu: [arm]
os: [android] os: [android]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-android-arm64@4.12.1: /@rollup/rollup-android-arm64@4.12.1:
resolution: {integrity: sha512-wlzcWiH2Ir7rdMELxFE5vuM7D6TsOcJ2Yw0c3vaBR3VOsJFVTx9xvwnAvhgU5Ii8Gd6+I11qNHwndDscIm0HXg==} resolution:
{
integrity: sha512-wlzcWiH2Ir7rdMELxFE5vuM7D6TsOcJ2Yw0c3vaBR3VOsJFVTx9xvwnAvhgU5Ii8Gd6+I11qNHwndDscIm0HXg==,
}
cpu: [arm64] cpu: [arm64]
os: [android] os: [android]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-darwin-arm64@4.12.1: /@rollup/rollup-darwin-arm64@4.12.1:
resolution: {integrity: sha512-YRXa1+aZIFN5BaImK+84B3uNK8C6+ynKLPgvn29X9s0LTVCByp54TB7tdSMHDR7GTV39bz1lOmlLDuedgTwwHg==} resolution:
{
integrity: sha512-YRXa1+aZIFN5BaImK+84B3uNK8C6+ynKLPgvn29X9s0LTVCByp54TB7tdSMHDR7GTV39bz1lOmlLDuedgTwwHg==,
}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-darwin-x64@4.12.1: /@rollup/rollup-darwin-x64@4.12.1:
resolution: {integrity: sha512-opjWJ4MevxeA8FhlngQWPBOvVWYNPFkq6/25rGgG+KOy0r8clYwL1CFd+PGwRqqMFVQ4/Qd3sQu5t7ucP7C/Uw==} resolution:
{
integrity: sha512-opjWJ4MevxeA8FhlngQWPBOvVWYNPFkq6/25rGgG+KOy0r8clYwL1CFd+PGwRqqMFVQ4/Qd3sQu5t7ucP7C/Uw==,
}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-linux-arm-gnueabihf@4.12.1: /@rollup/rollup-linux-arm-gnueabihf@4.12.1:
resolution: {integrity: sha512-uBkwaI+gBUlIe+EfbNnY5xNyXuhZbDSx2nzzW8tRMjUmpScd6lCQYKY2V9BATHtv5Ef2OBq6SChEP8h+/cxifQ==} resolution:
{
integrity: sha512-uBkwaI+gBUlIe+EfbNnY5xNyXuhZbDSx2nzzW8tRMjUmpScd6lCQYKY2V9BATHtv5Ef2OBq6SChEP8h+/cxifQ==,
}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-linux-arm64-gnu@4.12.1: /@rollup/rollup-linux-arm64-gnu@4.12.1:
resolution: {integrity: sha512-0bK9aG1kIg0Su7OcFTlexkVeNZ5IzEsnz1ept87a0TUgZ6HplSgkJAnFpEVRW7GRcikT4GlPV0pbtVedOaXHQQ==} resolution:
{
integrity: sha512-0bK9aG1kIg0Su7OcFTlexkVeNZ5IzEsnz1ept87a0TUgZ6HplSgkJAnFpEVRW7GRcikT4GlPV0pbtVedOaXHQQ==,
}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-linux-arm64-musl@4.12.1: /@rollup/rollup-linux-arm64-musl@4.12.1:
resolution: {integrity: sha512-qB6AFRXuP8bdkBI4D7UPUbE7OQf7u5OL+R94JE42Z2Qjmyj74FtDdLGeriRyBDhm4rQSvqAGCGC01b8Fu2LthQ==} resolution:
{
integrity: sha512-qB6AFRXuP8bdkBI4D7UPUbE7OQf7u5OL+R94JE42Z2Qjmyj74FtDdLGeriRyBDhm4rQSvqAGCGC01b8Fu2LthQ==,
}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-linux-riscv64-gnu@4.12.1: /@rollup/rollup-linux-riscv64-gnu@4.12.1:
resolution: {integrity: sha512-sHig3LaGlpNgDj5o8uPEoGs98RII8HpNIqFtAI8/pYABO8i0nb1QzT0JDoXF/pxzqO+FkxvwkHZo9k0NJYDedg==} resolution:
{
integrity: sha512-sHig3LaGlpNgDj5o8uPEoGs98RII8HpNIqFtAI8/pYABO8i0nb1QzT0JDoXF/pxzqO+FkxvwkHZo9k0NJYDedg==,
}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-linux-x64-gnu@4.12.1: /@rollup/rollup-linux-x64-gnu@4.12.1:
resolution: {integrity: sha512-nD3YcUv6jBJbBNFvSbp0IV66+ba/1teuBcu+fBBPZ33sidxitc6ErhON3JNavaH8HlswhWMC3s5rgZpM4MtPqQ==} resolution:
{
integrity: sha512-nD3YcUv6jBJbBNFvSbp0IV66+ba/1teuBcu+fBBPZ33sidxitc6ErhON3JNavaH8HlswhWMC3s5rgZpM4MtPqQ==,
}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-linux-x64-musl@4.12.1: /@rollup/rollup-linux-x64-musl@4.12.1:
resolution: {integrity: sha512-7/XVZqgBby2qp/cO0TQ8uJK+9xnSdJ9ct6gSDdEr4MfABrjTyrW6Bau7HQ73a2a5tPB7hno49A0y1jhWGDN9OQ==} resolution:
{
integrity: sha512-7/XVZqgBby2qp/cO0TQ8uJK+9xnSdJ9ct6gSDdEr4MfABrjTyrW6Bau7HQ73a2a5tPB7hno49A0y1jhWGDN9OQ==,
}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-win32-arm64-msvc@4.12.1: /@rollup/rollup-win32-arm64-msvc@4.12.1:
resolution: {integrity: sha512-CYc64bnICG42UPL7TrhIwsJW4QcKkIt9gGlj21gq3VV0LL6XNb1yAdHVp1pIi9gkts9gGcT3OfUYHjGP7ETAiw==} resolution:
{
integrity: sha512-CYc64bnICG42UPL7TrhIwsJW4QcKkIt9gGlj21gq3VV0LL6XNb1yAdHVp1pIi9gkts9gGcT3OfUYHjGP7ETAiw==,
}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-win32-ia32-msvc@4.12.1: /@rollup/rollup-win32-ia32-msvc@4.12.1:
resolution: {integrity: sha512-LN+vnlZ9g0qlHGlS920GR4zFCqAwbv2lULrR29yGaWP9u7wF5L7GqWu9Ah6/kFZPXPUkpdZwd//TNR+9XC9hvA==} resolution:
{
integrity: sha512-LN+vnlZ9g0qlHGlS920GR4zFCqAwbv2lULrR29yGaWP9u7wF5L7GqWu9Ah6/kFZPXPUkpdZwd//TNR+9XC9hvA==,
}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@rollup/rollup-win32-x64-msvc@4.12.1: /@rollup/rollup-win32-x64-msvc@4.12.1:
resolution: {integrity: sha512-n+vkrSyphvmU0qkQ6QBNXCGr2mKjhP08mPRM/Xp5Ck2FV4NrHU+y6axzDeixUrCBHVUS51TZhjqrKBBsHLKb2Q==} resolution:
{
integrity: sha512-n+vkrSyphvmU0qkQ6QBNXCGr2mKjhP08mPRM/Xp5Ck2FV4NrHU+y6axzDeixUrCBHVUS51TZhjqrKBBsHLKb2Q==,
}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@types/estree@1.0.5: /@types/estree@1.0.5:
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} resolution:
{
integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==,
}
dev: true
/@types/node@20.11.25: /@types/node@20.11.25:
resolution: {integrity: sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==} resolution:
{
integrity: sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==,
}
dependencies: dependencies:
undici-types: 5.26.5 undici-types: 5.26.5
dev: false dev: true
/acorn-walk@7.1.1:
resolution: {integrity: sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==}
engines: {node: '>=0.4.0'}
dev: false
/acorn@7.3.1:
resolution: {integrity: sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==}
engines: {node: '>=0.4.0'}
hasBin: true
dev: false
/acorn@8.11.3: /acorn@8.11.3:
resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} resolution:
{
integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==,
}
engines: { node: '>=0.4.0' } engines: { node: '>=0.4.0' }
hasBin: true hasBin: true
dev: false dev: true
/align-text@0.1.4:
resolution: {integrity: sha512-GrTZLRpmp6wIC2ztrWW9MjjTgSKccffgFagbNDOX95/dcjEcYZibYTeaOntySQLcdw1ztBoFkviiUvTMbb9MYg==}
engines: {node: '>=0.10.0'}
dependencies:
kind-of: 3.2.2
longest: 1.0.1
repeat-string: 1.6.1
dev: false
/ansi-styles@3.2.1: /ansi-styles@3.2.1:
resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} resolution:
{
integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==,
}
engines: { node: '>=4' } engines: { node: '>=4' }
dependencies: dependencies:
color-convert: 1.9.3 color-convert: 1.9.3
dev: false dev: true
/buffer-from@1.1.2: /buffer-from@1.1.2:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} resolution:
dev: false {
integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==,
/camelcase@1.2.1: }
resolution: {integrity: sha512-wzLkDa4K/mzI1OSITC+DUyjgIl/ETNHE9QvYgy6J6Jvqyyz4C0Xfd+lQhb19sX2jMpZV4IssUn0VDVmglV+s4g==} dev: true
engines: {node: '>=0.10.0'}
dev: false
/center-align@0.1.3:
resolution: {integrity: sha512-Baz3aNe2gd2LP2qk5U+sDk/m4oSuwSDcBfayTCTBoWpfIGO5XFxPmjILQII4NGiZjD6DoDI6kf7gKaxkf7s3VQ==}
engines: {node: '>=0.10.0'}
dependencies:
align-text: 0.1.4
lazy-cache: 1.0.4
dev: false
/chalk@2.4.2: /chalk@2.4.2:
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} resolution:
{
integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==,
}
engines: { node: '>=4' } engines: { node: '>=4' }
dependencies: dependencies:
ansi-styles: 3.2.1 ansi-styles: 3.2.1
escape-string-regexp: 1.0.5 escape-string-regexp: 1.0.5
supports-color: 5.5.0 supports-color: 5.5.0
dev: false dev: true
/cliui@2.1.0:
resolution: {integrity: sha512-GIOYRizG+TGoc7Wgc1LiOTLare95R3mzKgoln+Q/lE4ceiYH19gUpl0l0Ffq4lJDEf3FxujMe6IBfOCs7pfqNA==}
dependencies:
center-align: 0.1.3
right-align: 0.1.3
wordwrap: 0.0.2
dev: false
/clone-buffer@1.0.0:
resolution: {integrity: sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==}
engines: {node: '>= 0.10'}
dev: false
/clone-stats@1.0.0:
resolution: {integrity: sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==}
dev: false
/clone@2.1.2:
resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==}
engines: {node: '>=0.8'}
dev: false
/cloneable-readable@1.1.3:
resolution: {integrity: sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==}
dependencies:
inherits: 2.0.4
process-nextick-args: 2.0.1
readable-stream: 2.3.8
dev: false
/color-convert@1.9.3: /color-convert@1.9.3:
resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} resolution:
{
integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==,
}
dependencies: dependencies:
color-name: 1.1.3 color-name: 1.1.3
dev: false dev: true
/color-name@1.1.3: /color-name@1.1.3:
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} resolution:
dev: false {
integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==,
}
dev: true
/commander@2.20.3: /commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} resolution:
dev: false {
integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==,
/core-util-is@1.0.3: }
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} dev: true
dev: false
/decamelize@1.2.0:
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
engines: {node: '>=0.10.0'}
dev: false
/escape-string-regexp@1.0.5: /escape-string-regexp@1.0.5:
resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} resolution:
{
integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==,
}
engines: { node: '>=0.8.0' } engines: { node: '>=0.8.0' }
dev: false dev: true
/estree-walker@2.0.1:
resolution: {integrity: sha512-tF0hv+Yi2Ot1cwj9eYHtxC0jB9bmjacjQs6ZBTj82H8JwUywFuc+7E83NWfNMwHXZc11mjfFcVXPe9gEP4B8dg==}
dev: false
/estree-walker@2.0.2: /estree-walker@2.0.2:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} resolution:
dev: false {
integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==,
}
dev: true
/fsevents@2.3.3: /fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} resolution:
{
integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==,
}
engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 } engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 }
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/google-closure-compiler-java@20210808.0.0:
resolution: {integrity: sha512-7dEQfBzOdwdjwa/Pq8VAypNBKyWRrOcKjnNYOO9gEg2hjh8XVMeQzTqw4uANfVvvANGdE/JjD+HF6zHVgLRwjg==}
dev: false
/google-closure-compiler-linux@20210808.0.0:
resolution: {integrity: sha512-byKi5ITUiWRvEIcQo76i1siVnOwrTmG+GNcBG4cJ7x8IE6+4ki9rG5pUe4+DOYHkfk52XU6XHt9aAAgCcFDKpg==}
cpu: [x64, x86]
os: [linux]
requiresBuild: true
dev: false
optional: true
/google-closure-compiler-osx@20210808.0.0:
resolution: {integrity: sha512-iwyAY6dGj1FrrBdmfwKXkjtTGJnqe8F+9WZbfXxiBjkWLtIsJt2dD1+q7g/sw3w8mdHrGQAdxtDZP/usMwj/Rg==}
cpu: [x64, x86, arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/google-closure-compiler-windows@20210808.0.0:
resolution: {integrity: sha512-VI+UUYwtGWDYwpiixrWRD8EklHgl6PMbiEaHxQSrQbH8PDXytwaOKqmsaH2lWYd5Y/BOZie2MzjY7F5JI69q1w==}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/google-closure-compiler@20210808.0.0:
resolution: {integrity: sha512-+R2+P1tT1lEnDDGk8b+WXfyVZgWjcCK9n1mmZe8pMEzPaPWxqK7GMetLVWnqfTDJ5Q+LRspOiFBv3Is+0yuhCA==}
engines: {node: '>=10'}
hasBin: true
dependencies:
chalk: 2.4.2
google-closure-compiler-java: 20210808.0.0
minimist: 1.2.8
vinyl: 2.2.1
vinyl-sourcemaps-apply: 0.2.1
optionalDependencies:
google-closure-compiler-linux: 20210808.0.0
google-closure-compiler-osx: 20210808.0.0
google-closure-compiler-windows: 20210808.0.0
dev: false
/has-flag@3.0.0: /has-flag@3.0.0:
resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} resolution:
{
integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==,
}
engines: { node: '>=4' } engines: { node: '>=4' }
dev: false dev: true
/has-flag@4.0.0: /has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} resolution:
{
integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==,
}
engines: { node: '>=8' } engines: { node: '>=8' }
dev: false dev: true
/inherits@2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
dev: false
/is-buffer@1.1.6:
resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==}
dev: false
/isarray@1.0.0:
resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==}
dev: false
/jest-worker@26.6.2: /jest-worker@26.6.2:
resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} resolution:
{
integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==,
}
engines: { node: '>= 10.13.0' } engines: { node: '>= 10.13.0' }
dependencies: dependencies:
'@types/node': 20.11.25 '@types/node': 20.11.25
merge-stream: 2.0.0 merge-stream: 2.0.0
supports-color: 7.2.0 supports-color: 7.2.0
dev: false dev: true
/js-tokens@4.0.0: /js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} resolution:
dev: false {
integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==,
/kind-of@3.2.2: }
resolution: {integrity: sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==} dev: true
engines: {node: '>=0.10.0'}
dependencies:
is-buffer: 1.1.6
dev: false
/lazy-cache@1.0.4:
resolution: {integrity: sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==}
engines: {node: '>=0.10.0'}
dev: false
/longest@1.0.1:
resolution: {integrity: sha512-k+yt5n3l48JU4k8ftnKG6V7u32wyH2NfKzeMto9F/QRE0amxy/LayxwlvjjkZEIzqR+19IrtFO8p5kB9QaYUFg==}
engines: {node: '>=0.10.0'}
dev: false
/magic-string@0.25.7:
resolution: {integrity: sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==}
dependencies:
sourcemap-codec: 1.4.8
dev: false
/magic-string@0.30.8: /magic-string@0.30.8:
resolution: {integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==} resolution:
{
integrity: sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==,
}
engines: { node: '>=12' } engines: { node: '>=12' }
dependencies: dependencies:
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
dev: false dev: true
/merge-stream@2.0.0: /merge-stream@2.0.0:
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} resolution:
dev: false {
integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==,
/minimist@1.2.8: }
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true
dev: false
/mkdirp@3.0.1:
resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==}
engines: {node: '>=10'}
hasBin: true
dev: false
/picomatch@2.3.1: /picomatch@2.3.1:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} resolution:
{
integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==,
}
engines: { node: '>=8.6' } engines: { node: '>=8.6' }
dev: false dev: true
/process-nextick-args@2.0.1: /prettier@3.2.5:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} resolution:
dev: false {
integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==,
}
engines: { node: '>=14' }
hasBin: true
dev: true
/randombytes@2.1.0: /randombytes@2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} resolution:
{
integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==,
}
dependencies: dependencies:
safe-buffer: 5.1.2 safe-buffer: 5.1.2
dev: false dev: true
/readable-stream@2.3.8:
resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
dependencies:
core-util-is: 1.0.3
inherits: 2.0.4
isarray: 1.0.0
process-nextick-args: 2.0.1
safe-buffer: 5.1.2
string_decoder: 1.1.1
util-deprecate: 1.0.2
dev: false
/remove-trailing-separator@1.1.0:
resolution: {integrity: sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==}
dev: false
/repeat-string@1.6.1:
resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==}
engines: {node: '>=0.10'}
dev: false
/replace-ext@1.0.1:
resolution: {integrity: sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw==}
engines: {node: '>= 0.10'}
dev: false
/right-align@0.1.3:
resolution: {integrity: sha512-yqINtL/G7vs2v+dFIZmFUDbnVyFUJFKd6gK22Kgo6R4jfJGFtisKyncWDDULgjfqf4ASQuIQyjJ7XZ+3aWpsAg==}
engines: {node: '>=0.10.0'}
dependencies:
align-text: 0.1.4
dev: false
/rollup-plugin-minify@1.0.3:
resolution: {integrity: sha512-4lx1smcRMKS5QfPrvKE2oHkKY1HfB7OM42Ude3+kfoSmFx5c2ndqOUpugmrD1TDdWI72LkrnCM2c80GoJ8WT/A==}
dependencies:
uglify-js: 2.8.29
dev: false
/rollup-plugin-terser@7.0.2(rollup@4.12.1): /rollup-plugin-terser@7.0.2(rollup@4.12.1):
resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} resolution:
{
integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==,
}
deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
peerDependencies: peerDependencies:
rollup: ^2.0.0 rollup: ^2.0.0
@ -569,10 +482,13 @@ packages:
rollup: 4.12.1 rollup: 4.12.1
serialize-javascript: 4.0.0 serialize-javascript: 4.0.0
terser: 5.29.1 terser: 5.29.1
dev: false dev: true
/rollup@4.12.1: /rollup@4.12.1:
resolution: {integrity: sha512-ggqQKvx/PsB0FaWXhIvVkSWh7a/PCLQAsMjBc+nA2M8Rv2/HG0X6zvixAB7KyZBRtifBUhy5k8voQX/mRnABPg==} resolution:
{
integrity: sha512-ggqQKvx/PsB0FaWXhIvVkSWh7a/PCLQAsMjBc+nA2M8Rv2/HG0X6zvixAB7KyZBRtifBUhy5k8voQX/mRnABPg==,
}
engines: { node: '>=18.0.0', npm: '>=8.0.0' } engines: { node: '>=18.0.0', npm: '>=8.0.0' }
hasBin: true hasBin: true
dependencies: dependencies:
@ -592,61 +508,67 @@ packages:
'@rollup/rollup-win32-ia32-msvc': 4.12.1 '@rollup/rollup-win32-ia32-msvc': 4.12.1
'@rollup/rollup-win32-x64-msvc': 4.12.1 '@rollup/rollup-win32-x64-msvc': 4.12.1
fsevents: 2.3.3 fsevents: 2.3.3
dev: true
/safe-buffer@5.1.2: /safe-buffer@5.1.2:
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} resolution:
dev: false {
integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==,
}
dev: true
/serialize-javascript@4.0.0: /serialize-javascript@4.0.0:
resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==} resolution:
{
integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==,
}
dependencies: dependencies:
randombytes: 2.1.0 randombytes: 2.1.0
dev: false dev: true
/source-map-support@0.5.21: /source-map-support@0.5.21:
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} resolution:
{
integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==,
}
dependencies: dependencies:
buffer-from: 1.1.2 buffer-from: 1.1.2
source-map: 0.6.1 source-map: 0.6.1
dev: false dev: true
/source-map@0.5.7:
resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==}
engines: {node: '>=0.10.0'}
dev: false
/source-map@0.6.1: /source-map@0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} resolution:
{
integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==,
}
engines: { node: '>=0.10.0' } engines: { node: '>=0.10.0' }
dev: false dev: true
/sourcemap-codec@1.4.8:
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==}
deprecated: Please use @jridgewell/sourcemap-codec instead
dev: false
/string_decoder@1.1.1:
resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
dependencies:
safe-buffer: 5.1.2
dev: false
/supports-color@5.5.0: /supports-color@5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} resolution:
{
integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==,
}
engines: { node: '>=4' } engines: { node: '>=4' }
dependencies: dependencies:
has-flag: 3.0.0 has-flag: 3.0.0
dev: false dev: true
/supports-color@7.2.0: /supports-color@7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} resolution:
{
integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==,
}
engines: { node: '>=8' } engines: { node: '>=8' }
dependencies: dependencies:
has-flag: 4.0.0 has-flag: 4.0.0
dev: false dev: true
/terser@5.29.1: /terser@5.29.1:
resolution: {integrity: sha512-lZQ/fyaIGxsbGxApKmoPTODIzELy3++mXhS5hOqaAWZjQtpq/hFHAc+rm29NND1rYRxRWKcjuARNwULNXa5RtQ==} resolution:
{
integrity: sha512-lZQ/fyaIGxsbGxApKmoPTODIzELy3++mXhS5hOqaAWZjQtpq/hFHAc+rm29NND1rYRxRWKcjuARNwULNXa5RtQ==,
}
engines: { node: '>=10' } engines: { node: '>=10' }
hasBin: true hasBin: true
dependencies: dependencies:
@ -654,77 +576,20 @@ packages:
acorn: 8.11.3 acorn: 8.11.3
commander: 2.20.3 commander: 2.20.3
source-map-support: 0.5.21 source-map-support: 0.5.21
dev: false dev: true
/typescript@5.3.3: /typescript@5.3.3:
resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} resolution:
{
integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==,
}
engines: { node: '>=14.17' } engines: { node: '>=14.17' }
hasBin: true hasBin: true
dev: true dev: true
/uglify-js@2.8.29:
resolution: {integrity: sha512-qLq/4y2pjcU3vhlhseXGGJ7VbFO4pBANu0kwl8VCa9KEI0V8VfZIx2Fy3w01iSTA/pGwKZSmu/+I4etLNDdt5w==}
engines: {node: '>=0.8.0'}
hasBin: true
dependencies:
source-map: 0.5.7
yargs: 3.10.0
optionalDependencies:
uglify-to-browserify: 1.0.2
dev: false
/uglify-to-browserify@1.0.2:
resolution: {integrity: sha512-vb2s1lYx2xBtUgy+ta+b2J/GLVUR+wmpINwHePmPRhOsIVCG2wDzKJ0n14GslH1BifsqVzSOwQhRaCAsZ/nI4Q==}
requiresBuild: true
dev: false
optional: true
/undici-types@5.26.5: /undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} resolution:
dev: false {
integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==,
/util-deprecate@1.0.2: }
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true
dev: false
/uuid@8.1.0:
resolution: {integrity: sha512-CI18flHDznR0lq54xBycOVmphdCYnQLKn8abKn7PXUiKUGdEd+/l9LWNJmugXel4hXq7S+RMNl34ecyC9TntWg==}
hasBin: true
dev: false
/vinyl-sourcemaps-apply@0.2.1:
resolution: {integrity: sha512-+oDh3KYZBoZC8hfocrbrxbLUeaYtQK7J5WU5Br9VqWqmCll3tFJqKp97GC9GmMsVIL0qnx2DgEDVxdo5EZ5sSw==}
dependencies:
source-map: 0.5.7
dev: false
/vinyl@2.2.1:
resolution: {integrity: sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==}
engines: {node: '>= 0.10'}
dependencies:
clone: 2.1.2
clone-buffer: 1.0.0
clone-stats: 1.0.0
cloneable-readable: 1.1.3
remove-trailing-separator: 1.1.0
replace-ext: 1.0.1
dev: false
/window-size@0.1.0:
resolution: {integrity: sha512-1pTPQDKTdd61ozlKGNCjhNRd+KPmgLSGa3mZTHoOliaGcESD8G1PXhh7c1fgiPjVbNVfgy2Faw4BI8/m0cC8Mg==}
engines: {node: '>= 0.8.0'}
dev: false
/wordwrap@0.0.2:
resolution: {integrity: sha512-xSBsCeh+g+dinoBv3GAOWM4LcVVO68wLXRanibtBSdUvkGWQRGeE9P7IwU9EmDDi4jA6L44lz15CGMwdw9N5+Q==}
engines: {node: '>=0.4.0'}
dev: false
/yargs@3.10.0:
resolution: {integrity: sha512-QFzUah88GAGy9lyDKGBqZdkYApt63rCXYBGYnEP4xDJPXNqXXnBDACnbrXnViV6jRSqAePwrATi2i8mfYm4L1A==}
dependencies:
camelcase: 1.2.1
cliui: 2.1.0
decamelize: 1.2.0
window-size: 0.1.0
dev: false

11
prettier.config.js Normal file
View file

@ -0,0 +1,11 @@
// prettier.config.js, .prettierrc.js, prettier.config.cjs, or .prettierrc.cjs
/** @type {import("prettier").Config} */
const config = {
trailingComma: 'es5',
tabWidth: 4,
semi: false,
singleQuote: true,
}
module.exports = config

View file

@ -1,74 +1,74 @@
import strip from "@rollup/plugin-strip"; import strip from '@rollup/plugin-strip'
import { terser } from "rollup-plugin-terser"; import { terser } from 'rollup-plugin-terser'
const prodPlugins = [ const prodPlugins = [
strip({ strip({
functions: ["console.log", "assert.*", "panic", "log"], functions: ['console.log', 'assert.*', 'panic', 'log'],
labels: ["dev"] labels: ['dev'],
}), }),
terser({ terser({
mangle: { mangle: {
toplevel: true toplevel: true,
}, },
compress: { compress: {
unused: true, unused: true,
collapse_vars: true, collapse_vars: true,
toplevel: true toplevel: true,
}, },
output: { output: {
comments: false comments: false,
}, },
}) }),
] ]
const devPlugins = []; const devPlugins = []
export default [ export default [
{ {
input: "src/dev.js", input: 'src/dev.js',
output: { output: {
file: "dist/dev/index.js", file: 'dist/dev/index.js',
format: 'cjs', format: 'cjs',
sourcemap: true, sourcemap: true,
}, },
plugins: devPlugins plugins: devPlugins,
}, },
{ {
input: "src/js.js", input: 'src/js.js',
output: { output: {
file: "dist/js.js", file: 'dist/js.js',
strict: false, strict: false,
format: 'cjs', format: 'cjs',
sourcemap: true, sourcemap: true,
}, },
plugins: prodPlugins plugins: prodPlugins,
}, },
{ {
input: "src/css.js", input: 'src/css.js',
output: { output: {
file: "dist/css.js", file: 'dist/css.js',
strict: false, strict: false,
format: 'cjs', format: 'cjs',
sourcemap: true, sourcemap: true,
}, },
plugins: prodPlugins plugins: prodPlugins,
}, },
{ {
input: "src/html.js", input: 'src/html.js',
output: { output: {
file: "dist/html.js", file: 'dist/html.js',
strict: false, strict: false,
format: 'cjs', format: 'cjs',
sourcemap: true, sourcemap: true,
}, },
plugins: prodPlugins plugins: prodPlugins,
}, },
{ {
input: "src/store.js", input: 'src/store.js',
output: { output: {
file: "dist/store.js", file: 'dist/store.js',
strict: false, strict: false,
format: 'cjs', format: 'cjs',
sourcemap: true, sourcemap: true,
}, },
plugins: prodPlugins plugins: prodPlugins,
} },
]; ]

View file

@ -1,27 +1,26 @@
class DreamlandError extends Error { class DreamlandError extends Error {
constructor(message) { constructor(message) {
super("[dreamland-js/dev] " + message); super('[dreamland-js/dev] ' + message)
this.name = "DreamlandDevError"; this.name = 'DreamlandDevError'
} }
} }
export function log(message) { export function log(message) {
console.log("[dreamland-js/dev] " + message); console.log('[dreamland-js/dev] ' + message)
} }
export function panic(message) { export function panic(message) {
throw new DreamlandError("fatal: " + message); throw new DreamlandError('fatal: ' + message)
} }
export function assert(condition, message) { export function assert(condition, message) {
if (!condition) { if (!condition) {
panic(message); panic(message)
} }
} }
dev: assert.eq = (a, b) => { dev: assert.eq = (a, b) => {
if (a != b) panic("Assertion failed: " + a + " != " + b); if (a != b) panic('Assertion failed: ' + a + ' != ' + b)
}; }
dev: assert.neq = (a, b) => { dev: assert.neq = (a, b) => {
if (a == b) panic("Assertion failed: " + a + " == " + b); if (a == b) panic('Assertion failed: ' + a + ' == ' + b)
}; }

View file

@ -1 +1 @@
export const VERSION = "0.0.2-beta"; export const VERSION = '0.0.2-beta'

View file

@ -1,84 +1,76 @@
Object.assign(window, { css, rule, styled: { new: css, rule: rule } }); Object.assign(window, { css, rule, styled: { new: css, rule: rule } })
const cssmap = {}; const cssmap = {}
function scopify_css(uid, css) { function scopify_css(uid, css) {
const virtualDoc = document.implementation.createHTMLDocument(""); const virtualDoc = document.implementation.createHTMLDocument('')
const virtualStyleElement = document.createElement("style"); const virtualStyleElement = document.createElement('style')
virtualDoc.body.appendChild(virtualStyleElement); virtualDoc.body.appendChild(virtualStyleElement)
let cssParsed = ""; let cssParsed = ''
virtualStyleElement.textContent = css; virtualStyleElement.textContent = css
//@ts-ignore //@ts-ignore
for (const rule of virtualStyleElement.sheet.cssRules) { for (const rule of virtualStyleElement.sheet.cssRules) {
rule.selectorText = rule.selectorText.includes("self") rule.selectorText = rule.selectorText.includes('self')
? `.${uid}.self${rule.selectorText.replace("self", "")}` ? `.${uid}.self${rule.selectorText.replace('self', '')}`
: `.${uid} ${rule.selectorText}`; : `.${uid} ${rule.selectorText}`
cssParsed += `${rule.cssText}\n`; cssParsed += `${rule.cssText}\n`
} }
return cssParsed; return cssParsed
} }
function tagcss(strings, values, isblock) { function tagcss(strings, values, isblock) {
let cached = cssmap[strings[0]]; let cached = cssmap[strings[0]]
let cachable = strings.length == 1; let cachable = strings.length == 1
if (cachable && cached) return cached; if (cachable && cached) return cached
const uid = `dl${Array(5) const uid = `dl${Array(5)
.fill(0) .fill(0)
.map(() => { .map(() => {
return Math.floor(Math.random() * 36).toString(36); return Math.floor(Math.random() * 36).toString(36)
}) })
.join("")}`; .join('')}`
const styleElement = document.createElement("style"); const styleElement = document.createElement('style')
document.head.appendChild(styleElement); document.head.appendChild(styleElement)
const flattened_template = []; const flattened_template = []
for (const i in strings) { for (const i in strings) {
flattened_template.push(strings[i]); flattened_template.push(strings[i])
if (values[i]) { if (values[i]) {
const prop = values[i]; const prop = values[i]
if (isDLPtr(prop)) { if (isDLPtr(prop)) {
const current_i = flattened_template.length; const current_i = flattened_template.length
let oldparsed; let oldparsed
handle(prop, (val) => { handle(prop, (val) => {
flattened_template[current_i] = String(val); flattened_template[current_i] = String(val)
let parsed = flattened_template.join(""); let parsed = flattened_template.join('')
if (parsed != oldparsed) if (parsed != oldparsed)
if (isblock) if (isblock)
styleElement.textContent = scopify_css( styleElement.textContent = scopify_css(uid, parsed)
uid, else styleElement.textContent = `.${uid} { ${parsed}; }`
parsed, oldparsed = parsed
); })
else
styleElement.textContent = `.${uid} { ${parsed}; }`
oldparsed = parsed;
});
} else { } else {
flattened_template.push(String(prop)); flattened_template.push(String(prop))
} }
} }
} }
if (isblock) { if (isblock) {
styleElement.textContent = scopify_css( styleElement.textContent = scopify_css(uid, flattened_template.join(''))
uid,
flattened_template.join(""),
);
} else { } else {
styleElement.textContent = `.${uid} { ${flattened_template.join("")}; }` styleElement.textContent = `.${uid} { ${flattened_template.join('')}; }`
} }
if (cachable) cssmap[strings[0]] = uid; if (cachable) cssmap[strings[0]] = uid
return uid; return uid
} }
function rule(strings, ...values) { function rule(strings, ...values) {
return tagcss(strings, values, false) return tagcss(strings, values, false)
} }
function css(strings, ...values) { function css(strings, ...values) {
return tagcss(strings, values, true); return tagcss(strings, values, true)
} }

View file

@ -1,10 +1,12 @@
import { log } from "./asserts" import { log } from './asserts'
import { VERSION } from "./consts" import { VERSION } from './consts'
import "./js" import './js'
import "./css" import './css'
import "./html" import './html'
import "./store" import './store'
log("Version: " + VERSION) log('Version: ' + VERSION)
console.warn("This is a DEVELOPER build of dreamland.js. It is not suitable for production use.") console.warn(
'This is a DEVELOPER build of dreamland.js. It is not suitable for production use.'
)

View file

@ -1,65 +1,66 @@
Object.assign(window, { html }); Object.assign(window, { html })
function html(strings, ...values) { function html(strings, ...values) {
let flattened = ""; let flattened = ''
let markers = {}; let markers = {}
for (const i in strings) { for (const i in strings) {
let string = strings[i]; let string = strings[i]
let value = values[i]; let value = values[i]
flattened += string; flattened += string
if (i < values.length) { if (i < values.length) {
let dupe = Object.values(markers).findIndex(v => v == value); let dupe = Object.values(markers).findIndex((v) => v == value)
if (dupe !== -1) { if (dupe !== -1) {
flattened += Object.keys(markers)[dupe]; flattened += Object.keys(markers)[dupe]
} else { } else {
let marker = "m" + Array(16).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join(""); let marker =
markers[marker] = value; 'm' +
flattened += marker; Array(16)
.fill(0)
.map(() => Math.floor(Math.random() * 16).toString(16))
.join('')
markers[marker] = value
flattened += marker
} }
} }
} }
let dom = new DOMParser().parseFromString(flattened, "text/html"); let dom = new DOMParser().parseFromString(flattened, 'text/html')
if (dom.body.children.length !== 1) if (dom.body.children.length !== 1)
throw "html builder needs exactly one child"; throw 'html builder needs exactly one child'
function wraph(elm) { function wraph(elm) {
let nodename = elm.nodeName.toLowerCase(); let nodename = elm.nodeName.toLowerCase()
if (nodename === "#text") if (nodename === '#text') return elm.textContent
return elm.textContent; if (nodename in markers) nodename = markers[nodename]
if (nodename in markers)
nodename = markers[nodename];
let children = [...elm.childNodes].map(wraph); let children = [...elm.childNodes].map(wraph)
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
let text = children[i]; let text = children[i]
if (typeof text !== "string") continue; if (typeof text !== 'string') continue
for (const [marker, value] of Object.entries(markers)) { for (const [marker, value] of Object.entries(markers)) {
if (!text) break; if (!text) break
if (!text.includes(marker)) continue; if (!text.includes(marker)) continue
let before; let before
[before, text] = text.split(marker); ;[before, text] = text.split(marker)
children = [ children = [
...children.slice(0, i), ...children.slice(0, i),
before, before,
value, value,
text, text,
...children.slice(i + 1) ...children.slice(i + 1),
]; ]
i += 2; i += 2
} }
} }
let attributes = {}; let attributes = {}
for (const attr of [...elm.attributes]) { for (const attr of [...elm.attributes]) {
let val = attr.nodeValue; let val = attr.nodeValue
if (val in markers) if (val in markers) val = markers[val]
val = markers[val]; attributes[attr.name] = val
attributes[attr.name] = val;
} }
return h(nodename, attributes, children); return h(nodename, attributes, children)
} }
return wraph(dom.body.children[0]); return wraph(dom.body.children[0])
} }

457
src/js.js
View file

@ -1,17 +1,17 @@
import { assert } from "./asserts"; import { assert } from './asserts'
// enables a small terser optimization // enables a small terser optimization
let document = self.document; let document = self.document
let Fragment = Symbol(); let Fragment = Symbol()
// We add some extra properties into various objects throughout, better to use symbols and not interfere. this is just a tiny optimization // We add some extra properties into various objects throughout, better to use symbols and not interfere. this is just a tiny optimization
let [USE_MAPFN, TARGET, PROXY, STEPS, LISTENERS, IF] = [, , , , , ,].fill().map(Symbol); let [USE_MAPFN, TARGET, PROXY, STEPS, LISTENERS, IF] = [, , , , , ,]
.fill()
.map(Symbol)
// whether to return the true value from a stateful object or a "trap" containing the pointer // whether to return the true value from a stateful object or a "trap" containing the pointer
let __use_trap = false; let __use_trap = false
// Say you have some code like // Say you have some code like
//// let state = stateful({ //// let state = stateful({
@ -29,399 +29,418 @@ let __use_trap = false;
// - the JSX factory h() is now passed the trap, which essentially contains a set of pointers pointing to the theoretical value of b // - the JSX factory h() is now passed the trap, which essentially contains a set of pointers pointing to the theoretical value of b
// - with the setter on the stateful proxy, we can listen to any change in any of the nested layers and call whatever listeners registered // - with the setter on the stateful proxy, we can listen to any change in any of the nested layers and call whatever listeners registered
// - the result is full intuitive reactivity with minimal overhead // - the result is full intuitive reactivity with minimal overhead
Object.defineProperty(window, "use", { Object.defineProperty(window, 'use', {
get: () => { get: () => {
__use_trap = true; __use_trap = true
return (ptr, mapping, ...rest) => { return (ptr, mapping, ...rest) => {
if (ptr instanceof Array) return usestr(ptr, mapping, ...rest); if (ptr instanceof Array) return usestr(ptr, mapping, ...rest)
assert(isDLPtr(ptr), "a value was passed into use() that was not part of a stateful context"); assert(
__use_trap = false; isDLPtr(ptr),
if (mapping) ptr[USE_MAPFN] = mapping; 'a value was passed into use() that was not part of a stateful context'
return ptr; )
}; __use_trap = false
if (mapping) ptr[USE_MAPFN] = mapping
return ptr
} }
}); },
})
const usestr = (strings, ...values) => { const usestr = (strings, ...values) => {
__use_trap = false; __use_trap = false
let state = stateful({}); let state = stateful({})
const flattened_template = []; const flattened_template = []
for (const i in strings) { for (const i in strings) {
flattened_template.push(strings[i]); flattened_template.push(strings[i])
if (values[i]) { if (values[i]) {
const prop = values[i]; const prop = values[i]
if (isDLPtr(prop)) { if (isDLPtr(prop)) {
const current_i = flattened_template.length; const current_i = flattened_template.length
let oldparsed; let oldparsed
handle(prop, (val) => { handle(prop, (val) => {
flattened_template[current_i] = String(val); flattened_template[current_i] = String(val)
let parsed = flattened_template.join(""); let parsed = flattened_template.join('')
if (parsed != oldparsed) if (parsed != oldparsed) state.string = parsed
state.string = parsed oldparsed = parsed
oldparsed = parsed; })
});
} else { } else {
flattened_template.push(String(prop)); flattened_template.push(String(prop))
} }
} }
} }
state.string = flattened_template.join(""); state.string = flattened_template.join('')
return use(state.string); return use(state.string)
}; }
Object.assign(window, { isDLPtr, h, stateful, handle, $if, Fragment }); Object.assign(window, { isDLPtr, h, stateful, handle, $if, Fragment })
let TRAPS = new Map; let TRAPS = new Map()
// This wraps the target in a proxy, doing 2 things: // This wraps the target in a proxy, doing 2 things:
// - whenever a property is accessed, return a "trap" that catches and records accessors // - whenever a property is accessed, return a "trap" that catches and records accessors
// - whenever a property is set, notify the subscribed listeners // - whenever a property is set, notify the subscribed listeners
// This is what makes our "pass-by-reference" magic work // This is what makes our "pass-by-reference" magic work
function stateful(target, hook) { function stateful(target, hook) {
assert(isobj(target), "stateful() requires an object"); assert(isobj(target), 'stateful() requires an object')
target[LISTENERS] = []; target[LISTENERS] = []
target[TARGET] = target; target[TARGET] = target
let TOPRIMITIVE = Symbol.toPrimitive; let TOPRIMITIVE = Symbol.toPrimitive
let proxy = new Proxy(target, { let proxy = new Proxy(target, {
get(target, property, proxy) { get(target, property, proxy) {
if (__use_trap) { if (__use_trap) {
let sym = Symbol(); let sym = Symbol()
let trap = new Proxy({ let trap = new Proxy(
{
[TARGET]: target, [TARGET]: target,
[PROXY]: proxy, [PROXY]: proxy,
[STEPS]: [property], [STEPS]: [property],
[TOPRIMITIVE]: _ => sym, [TOPRIMITIVE]: (_) => sym,
}, { },
{
get(target, property) { get(target, property) {
if ([TARGET, PROXY, STEPS, USE_MAPFN, TOPRIMITIVE].includes(property)) return target[property]; if (
property = TRAPS.get(property) || property; [
target[STEPS].push(property); TARGET,
return trap; PROXY,
STEPS,
USE_MAPFN,
TOPRIMITIVE,
].includes(property)
)
return target[property]
property = TRAPS.get(property) || property
target[STEPS].push(property)
return trap
},
} }
}); )
TRAPS.set(sym, trap); TRAPS.set(sym, trap)
return trap; return trap
} }
return Reflect.get(target, property, proxy); return Reflect.get(target, property, proxy)
}, },
set(target, property, val) { set(target, property, val) {
if (hook) hook(target, property, val); if (hook) hook(target, property, val)
let trap = Reflect.set(target, property, val); let trap = Reflect.set(target, property, val)
for (let listener of target[LISTENERS]) { for (let listener of target[LISTENERS]) {
listener(target, property, val); listener(target, property, val)
} }
return trap; return trap
}, },
}); })
return proxy; return proxy
} }
let isobj = (o) => o instanceof Object; let isobj = (o) => o instanceof Object
let isfn = (o) => typeof o === "function"; let isfn = (o) => typeof o === 'function'
function isDLPtr(arr) { function isDLPtr(arr) {
return isobj(arr) && TARGET in arr return isobj(arr) && TARGET in arr
} }
function $if(condition, then, otherwise) { function $if(condition, then, otherwise) {
otherwise ??= document.createTextNode(""); otherwise ??= document.createTextNode('')
if (!isDLPtr(condition)) return condition ? then : otherwise; if (!isDLPtr(condition)) return condition ? then : otherwise
return { [IF]: condition, then, otherwise }; return { [IF]: condition, then, otherwise }
} }
// This lets you subscribe to a stateful object // This lets you subscribe to a stateful object
function handle(ptr, callback) { function handle(ptr, callback) {
assert(isDLPtr(ptr), "handle() requires a stateful object"); assert(isDLPtr(ptr), 'handle() requires a stateful object')
assert(isfn(callback), "handle() requires a callback function"); assert(isfn(callback), 'handle() requires a callback function')
let step, resolvedSteps = []; let step,
resolvedSteps = []
function update() { function update() {
let val = ptr[TARGET]; let val = ptr[TARGET]
for (step of resolvedSteps) { for (step of resolvedSteps) {
val = val[step]; val = val[step]
if (!isobj(val)) break; if (!isobj(val)) break
} }
let mapfn = ptr[USE_MAPFN]; let mapfn = ptr[USE_MAPFN]
if (mapfn) val = mapfn(val); if (mapfn) val = mapfn(val)
callback(val); callback(val)
} }
// inject ourselves into nested objects // inject ourselves into nested objects
let curry = (target, i) => function subscription(tgt, prop, val) { let curry = (target, i) =>
function subscription(tgt, prop, val) {
if (prop === resolvedSteps[i] && target === tgt) { if (prop === resolvedSteps[i] && target === tgt) {
update(); update()
if (isobj(val)) { if (isobj(val)) {
let v = val[LISTENERS]; let v = val[LISTENERS]
if (v && !v.includes(subscription)) { if (v && !v.includes(subscription)) {
v.push(curry(val[TARGET], i + 1)); v.push(curry(val[TARGET], i + 1))
}
} }
} }
} }
};
// imagine we have a `use(state.a[state.b])` // imagine we have a `use(state.a[state.b])`
// simply recursively resolve any of the intermediate steps until we get to the final value // simply recursively resolve any of the intermediate steps until we get to the final value
// this will "misfire" occassionaly with a scenario like state.a[state.b][state.c] and call the listener more than needed // this will "misfire" occassionaly with a scenario like state.a[state.b][state.c] and call the listener more than needed
// it is up to the caller to not implode // it is up to the caller to not implode
for (let i in ptr[STEPS]) { for (let i in ptr[STEPS]) {
let step = ptr[STEPS][i]; let step = ptr[STEPS][i]
if (isobj(step) && step[TARGET]) { if (isobj(step) && step[TARGET]) {
handle(step, val => { handle(step, (val) => {
resolvedSteps[i] = val; resolvedSteps[i] = val
update(); update()
}); })
continue; continue
} }
resolvedSteps[i] = step; resolvedSteps[i] = step
} }
let sub = curry(ptr[TARGET], 0); let sub = curry(ptr[TARGET], 0)
ptr[TARGET][LISTENERS].push(sub); ptr[TARGET][LISTENERS].push(sub)
sub(ptr[TARGET], resolvedSteps[0], ptr[TARGET][resolvedSteps[0]]); sub(ptr[TARGET], resolvedSteps[0], ptr[TARGET][resolvedSteps[0]])
} }
function JSXAddFixedWrapper(ptr, cb, $if) { function JSXAddFixedWrapper(ptr, cb, $if) {
let before, appended, first, flag; let before, appended, first, flag
handle(ptr, val => { handle(ptr, (val) => {
first = appended?.[0]; first = appended?.[0]
if (first) if (first) before = first.previousSibling || (flag = first.parentNode)
before = first.previousSibling || (flag = first.parentNode); if (appended) appended.forEach((a) => a.remove())
if (appended)
appended.forEach(a => a.remove());
appended = JSXAddChild($if ? (val ? $if.then : $if.otherwise) : val, el => { appended = JSXAddChild(
$if ? (val ? $if.then : $if.otherwise) : val,
(el) => {
if (before) { if (before) {
if (flag) { if (flag) {
before.prepend(el) before.prepend(el)
flag = null; flag = null
} else before.after(el)
before = el
} else cb(el)
} }
else before.after(el); )
before = el;
}
else cb(el)
})
}) })
} }
// returns a function that sets a reference // returns a function that sets a reference
// the currying is a small optimization // the currying is a small optimization
let curryset = ptr => val => { let curryset = (ptr) => (val) => {
let next = ptr[PROXY]; let next = ptr[PROXY]
let steps = ptr[STEPS]; let steps = ptr[STEPS]
let i = 0; let i = 0
for (; i < steps.length - 1; i++) { for (; i < steps.length - 1; i++) {
next = next[steps[i]]; next = next[steps[i]]
if (!isobj(next)) return; if (!isobj(next)) return
} }
next[steps[i]] = val; next[steps[i]] = val
} }
// Actual JSX factory. Responsible for creating the HTML elements and all of the *reactive* syntactic sugar // Actual JSX factory. Responsible for creating the HTML elements and all of the *reactive* syntactic sugar
function h(type, props, ...children) { function h(type, props, ...children) {
if (type == Fragment) return children; if (type == Fragment) return children
if (typeof type == "function") { if (typeof type == 'function') {
// functional components. create the stateful object // functional components. create the stateful object
let newthis = stateful(Object.create(type.prototype)); let newthis = stateful(Object.create(type.prototype))
for (let name in props) { for (let name in props) {
let ptr = props[name]; let ptr = props[name]
if (name.startsWith("bind:")) { if (name.startsWith('bind:')) {
assert(isDLPtr(ptr), "bind: requires a reference pointer from use"); assert(
isDLPtr(ptr),
'bind: requires a reference pointer from use'
)
let set = curryset(ptr); let set = curryset(ptr)
let propname = name.substring(5); let propname = name.substring(5)
if (propname == "this") { if (propname == 'this') {
set(newthis); set(newthis)
} else { } else {
// component two way data binding!! (exact same behavior as svelte:bind) // component two way data binding!! (exact same behavior as svelte:bind)
let isRecursive = false; let isRecursive = false
handle(ptr, value => { handle(ptr, (value) => {
if (isRecursive) { if (isRecursive) {
isRecursive = false; isRecursive = false
return; return
} }
isRecursive = true; isRecursive = true
newthis[propname] = value newthis[propname] = value
}); })
handle(use(newthis[propname]), value => { handle(use(newthis[propname]), (value) => {
if (isRecursive) { if (isRecursive) {
isRecursive = false; isRecursive = false
return; return
} }
isRecursive = true; isRecursive = true
set(value); set(value)
}); })
} }
delete props[name]; delete props[name]
} }
} }
Object.assign(newthis, props); Object.assign(newthis, props)
newthis.children = []; newthis.children = []
for (let child of children) { for (let child of children) {
JSXAddChild(child, newthis.children.push.bind(newthis.children)); JSXAddChild(child, newthis.children.push.bind(newthis.children))
} }
let elm = type.apply(newthis); let elm = type.apply(newthis)
elm.$ = newthis; elm.$ = newthis
newthis.root = elm; newthis.root = elm
if (newthis.css) { if (newthis.css) {
let cl = elm.classList let cl = elm.classList
cl.add(newthis.css); cl.add(newthis.css)
cl.add("self"); cl.add('self')
} }
elm.setAttribute("data-component", type.name); elm.setAttribute('data-component', type.name)
if (typeof newthis.mount === "function") if (typeof newthis.mount === 'function') newthis.mount()
newthis.mount(); return elm
return elm;
} }
let xmlns = props?.xmlns
let xmlns = props?.xmlns; let elm = xmlns
let elm = xmlns ? document.createElementNS(xmlns, type) : document.createElement(type); ? document.createElementNS(xmlns, type)
: document.createElement(type)
for (let child of children) { for (let child of children) {
let cond = child && !isDLPtr(child) && child[IF]; let cond = child && !isDLPtr(child) && child[IF]
let bappend = elm.append.bind(elm); let bappend = elm.append.bind(elm)
if (cond) { if (cond) {
JSXAddFixedWrapper(cond, bappend, child); JSXAddFixedWrapper(cond, bappend, child)
} else } else JSXAddChild(child, bappend)
JSXAddChild(child, bappend);
} }
if (!props) return elm; if (!props) return elm
let useProp = (name, callback) => { let useProp = (name, callback) => {
if (!(name in props)) return; if (!(name in props)) return
let prop = props[name]; let prop = props[name]
callback(prop); callback(prop)
delete props[name]; delete props[name]
} }
for (let name in props) { for (let name in props) {
let ptr = props[name]; let ptr = props[name]
if (name.startsWith("bind:")) { if (name.startsWith('bind:')) {
assert(isDLPtr(ptr), "bind: requires a reference pointer from use"); assert(isDLPtr(ptr), 'bind: requires a reference pointer from use')
let propname = name.substring(5); let propname = name.substring(5)
// create the function to set the value of the pointer // create the function to set the value of the pointer
let set = curryset(ptr); let set = curryset(ptr)
if (propname == "this") { if (propname == 'this') {
set(elm); set(elm)
} else if (propname == "value") { } else if (propname == 'value') {
handle(ptr, value => elm.value = value); handle(ptr, (value) => (elm.value = value))
elm.addEventListener("change", () => set(elm.value)) elm.addEventListener('change', () => set(elm.value))
} else if (propname == "checked") { } else if (propname == 'checked') {
handle(ptr, value => elm.checked = value); handle(ptr, (value) => (elm.checked = value))
elm.addEventListener("click", () => set(elm.checked)) elm.addEventListener('click', () => set(elm.checked))
} }
delete props[name]; delete props[name]
} }
if (name == "style" && isobj(ptr)) { if (name == 'style' && isobj(ptr)) {
for (let key in ptr) { for (let key in ptr) {
let prop = ptr[key]; let prop = ptr[key]
if (isDLPtr(prop)) { if (isDLPtr(prop)) {
handle(prop, value => elm.style[key] = value); handle(prop, (value) => (elm.style[key] = value))
} else { } else {
elm.style[key] = prop; elm.style[key] = prop
} }
} }
delete props[name]; delete props[name]
} }
} }
useProp("class", classlist => { useProp('class', (classlist) => {
assert(typeof classlist === "string" || classlist instanceof Array, "class must be a string or array"); assert(
if (typeof classlist === "string") { typeof classlist === 'string' || classlist instanceof Array,
elm.setAttribute("class", classlist); 'class must be a string or array'
return; )
if (typeof classlist === 'string') {
elm.setAttribute('class', classlist)
return
} }
if (isDLPtr(classlist)) { if (isDLPtr(classlist)) {
handle(classlist, classname => elm.setAttribute("class", classname)); handle(classlist, (classname) =>
return; elm.setAttribute('class', classname)
)
return
} }
for (let name of classlist) { for (let name of classlist) {
if (isDLPtr(name)) { if (isDLPtr(name)) {
let oldvalue = null; let oldvalue = null
handle(name, value => { handle(name, (value) => {
if (typeof oldvalue === "string") { if (typeof oldvalue === 'string') {
elm.classList.remove(oldvalue); elm.classList.remove(oldvalue)
} }
elm.classList.add(value); elm.classList.add(value)
oldvalue = value; oldvalue = value
}); })
} else { } else {
elm.classList.add(name); elm.classList.add(name)
} }
} }
}); })
// apply the non-reactive properties // apply the non-reactive properties
for (let name in props) { for (let name in props) {
let prop = props[name]; let prop = props[name]
if (isDLPtr(prop)) { if (isDLPtr(prop)) {
handle(prop, (val) => { handle(prop, (val) => {
JSXAddAttributes(elm, name, val); JSXAddAttributes(elm, name, val)
}); })
} else { } else {
JSXAddAttributes(elm, name, prop); JSXAddAttributes(elm, name, prop)
} }
} }
// hack to fix svgs // hack to fix svgs
if (xmlns) if (xmlns) elm.innerHTML = elm.innerHTML
elm.innerHTML = elm.innerHTML
return elm; return elm
} }
// glue for nested children // glue for nested children
function JSXAddChild(child, cb) { function JSXAddChild(child, cb) {
let childchild, elms, node; let childchild, elms, node
if (isDLPtr(child)) { if (isDLPtr(child)) {
JSXAddFixedWrapper(child, cb); JSXAddFixedWrapper(child, cb)
} else if (child instanceof Node) { } else if (child instanceof Node) {
cb(child); cb(child)
return [child]; return [child]
} else if (child instanceof Array) { } else if (child instanceof Array) {
elms = []; elms = []
for (childchild of child) { for (childchild of child) {
elms = elms.concat(JSXAddChild(childchild, cb)); elms = elms.concat(JSXAddChild(childchild, cb))
} }
if (!elms[0]) elms = JSXAddChild("", cb); if (!elms[0]) elms = JSXAddChild('', cb)
return elms; return elms
} else { } else {
node = document.createTextNode(child); node = document.createTextNode(child)
cb(node); cb(node)
return [node]; return [node]
} }
} }
// Where properties are assigned to elements, and where the *non-reactive* syntax sugar goes // Where properties are assigned to elements, and where the *non-reactive* syntax sugar goes
function JSXAddAttributes(elm, name, prop) { function JSXAddAttributes(elm, name, prop) {
if (name.startsWith("on:")) { if (name.startsWith('on:')) {
assert(typeof prop === "function", "on: requires a function"); assert(typeof prop === 'function', 'on: requires a function')
let names = name.substring(3); let names = name.substring(3)
for (let name of names.split("$")) { for (let name of names.split('$')) {
elm.addEventListener(name, (...args) => { elm.addEventListener(name, (...args) => {
self.$el = elm; self.$el = elm
prop(...args); prop(...args)
}); })
} }
return; return
} }
elm.setAttribute(name, prop); elm.setAttribute(name, prop)
} }

View file

@ -1,12 +1,12 @@
Object.assign(window, { $store }); Object.assign(window, { $store })
function $store(target, ident, type) { function $store(target, ident, type) {
let stored = localStorage.getItem(ident); let stored = localStorage.getItem(ident)
target = JSON.parse(stored) ?? target; target = JSON.parse(stored) ?? target
addEventListener("beforeunload", () => { addEventListener('beforeunload', () => {
console.info("[dreamland.js]: saving " + ident); console.info('[dreamland.js]: saving ' + ident)
localStorage.setItem(ident, JSON.stringify(target)); localStorage.setItem(ident, JSON.stringify(target))
}); })
return stateful(target); return stateful(target)
} }

View file

@ -1,10 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["ESNext", "dom"],
"lib": [
"ESNext",
"dom"
],
"outDir": "./examples/lib", "outDir": "./examples/lib",
"removeComments": true, "removeComments": true,
"target": "ES6", "target": "ES6",
@ -23,7 +19,5 @@
"noUncheckedIndexedAccess": true "noUncheckedIndexedAccess": true
}, },
"include": ["./examples/*.ts", "./examples/*.tsx", "./DreamlandJS.d.ts"], "include": ["./examples/*.ts", "./examples/*.tsx", "./DreamlandJS.d.ts"],
"exclude": [ "exclude": ["node_modules/**/*"]
"node_modules/**/*"
]
} }