tosijs 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js.map CHANGED
@@ -20,14 +20,14 @@
20
20
  "export function camelToKabob(s: string): string {\n return s.replace(/[A-Z]/g, (c: string): string => {\n return `-${c.toLocaleLowerCase()}`\n })\n}\n\nexport function kabobToCamel(s: string): string {\n return s.replace(/-([a-z])/g, (_: string, c: string): string => {\n return c.toLocaleUpperCase()\n })\n}\n",
21
21
  "/*#\n# 3. elements\n\n`xinjs` provides `elements` for easily and efficiently generating DOM elements\nwithout using `innerHTML` or other unsafe methods.\n\n```js\nimport { elements } from 'tosijs'\n\nconst { div, input, label, span } = elements\n\npreview.append(\n div(\n {\n style: {\n display: 'flex',\n flexDirection: 'column',\n padding: 10,\n gap: 10\n }\n },\n label(\n {\n style: {\n display: 'inline-flex'\n }\n },\n span('text'),\n input({value: 'hello world', placeholder: 'type something'})\n ),\n label(\n {\n style: {\n display: 'inline-flex'\n }\n },\n span('checkbox'),\n input({type: 'checkbox', checked: true})\n )\n )\n)\n```\n\n## `ElementCreator` functions\n\n`elements` is a proxy whose properties are element factory functions,\nreferred to throughout this documentation as `elementCreator`s, functions\nof type `ElementCreator`. So `elements.div` is a function that returns a `<div>`\nelement, `elements.foo` creates <foo> elements, and elements.fooBar creates\n`<foo-bar>` elements.\n\nThe arguments of `elementCreator`s can be strings, numbers, other\nelements, or property-maps, which are converted into attributes or properties\n(or bindings).\n\nE.g.\n\n```js\nimport { elements, tosi } from 'tosijs'\n\nconst { elementCreatorDemo } = tosi({\n elementCreatorDemo: {\n isChecked: true,\n someString: 'hello elementCreator',\n someColor: 'blue',\n clicks: 0\n }\n})\n\nconst { div, button, label, input } = elements\n\npreview.append(\n div('I am a div'),\n div(\n {\n style: { color: 'blue' }\n },\n elementCreatorDemo.someString\n ),\n label(\n 'Edit someString',\n input({bindValue: elementCreatorDemo.someString})\n ),\n div(\n button(\n 'Click me',\n {\n onClick() {\n elementCreatorDemo.clicks += 1\n }\n }\n ),\n div(elementCreatorDemo.clicks, ' clicks so far'),\n ),\n label(\n 'isChecked?',\n input({type: 'checkbox', bindValue: elementCreatorDemo.isChecked})\n )\n)\n```\n\n## camelCase conversion\n\nAttributes in camelCase, e.g. `dataInfo`, will be converted to kebab-case,\nso:\n\n span({dataInfo: 'foo'}) // produces <span data-info=\"foo\"></span>\n\n## style properties\n\n`style` properties can be objects, and these are used to modify the\nelement's `style` object (while a string property will just change the\nelement's `style` attribute, eliminating previous changes).\n\n span({style: 'border: 1px solid red'}, {style: 'font-size: 15px'})\n\n…produces `<span style=\"font-size: 15px\"></span>`, which is probably\nnot what was wanted.\n\n span({style: {border: '1px solid red'}, {style: {fontSize: '15px'}}})\n\n…produces `<span style=\"border: 1px solid red; fon-size: 15px></span>`\nwhich is probably what was wanted.\n\n## event handlers\n\nProperties starting with `on` (followed by an uppercase letter)\nwill be converted into event-handlers, so `onMouseup` will be\nturned into a `mouseup` listener.\n\n## binding\n\nYou can [bind](/?bind.ts) an element to state using [bindings](/?bindings.ts)\nusing convenient properties, e.g.\n\n import { elements } from 'tosijs'\n const {div} = elements\n div({ bindValue: 'app.title' })\n\n…is syntax sugar for:\n\n import { elements, bind, bindings } from 'tosijs'\n const { div } = elements\n bind( div(), 'app.title', bindings.value )\n\nIf you want to use your own bindings, you can use `apply`:\n\n const visibleBinding = {\n toDOM(element, value) {\n element.classList.toggle('hidden', !value)\n }\n }\n\n div({ apply(elt){\n bind(elt, 'app.prefs.isVisible', visibleBinding})\n } })\n\n## event-handlers\n\nYou can attach event handlers to elements using `on<EventType>`\nas syntax sugar, e.g.\n\n import { elements } from 'tosijs'\n const { button } = elements\n document.body.append(\n button('click me', {onClick() {\n alert('clicked!')\n }})\n )\n\n…is syntax sugar for:\n\n import { elements, on } from 'tosijs'\n const { button } = elements\n const aButton = button('click me')\n on(aButton, 'click', () => {\n alert('clicked!')\n })\n document.body.append(\n aButton\n )\n\nThere are some subtle but important differences between `on()` and\n`addEventListener` which are discussed in detail in the section on\n[bind](/?bind.ts).\n\n## apply\n\nA property named `apply` is assumed to be a function that will be called\non the element.\n\n span({\n apply(element){ element.textContent = 'foobar'}\n })\n\n…produces `<span>foobar</span>`.\n\n## fragment\n\n`elements.fragment` is produces `DocumentFragment`s, but is otherwise\njust like other element factory functions.\n\n## svgElements\n\n`svgElements` is a proxy just like `elements` but it produces **SVG** elements in\nthe appropriate namespace.\n\n## mathML\n\n`mathML` is a proxy just like `elements` but it products **MathML** elements in\nthe appropriate namespace.\n\n> ### Caution\n>\n> Both `svgElements` and `mathML` are experimental and do not have anything like the\n> degree of testing behind them as `elements`. In particular, the properties of\n> SVG elements (and possible MathML elements) are quite different from ordinary\n> elements, so the underlying `ElementCreator` will never try to set properties\n> directly and will always use `setAttribute(...)`.\n>\n> E.g. `svgElements.svg({viewBox: '0 0 100 100'})` will call `setAttribute()` and\n> not set the property directly, because the `viewBox` property is… weird, but\n> setting the attribute works.\n>\n> Again, use with caution!\n*/\n\nimport { bind, on } from './bind'\nimport { bindings } from './bindings'\nimport {\n ElementPart,\n ElementProps,\n ElementCreator,\n StringMap,\n XinBinding,\n EventType,\n} from './xin-types'\nimport { camelToKabob } from './string-case'\nimport { processProp } from './css'\nimport { xinPath } from './metadata'\n\nconst MATH = 'http://www.w3.org/1998/Math/MathML'\nconst SVG = 'http://www.w3.org/2000/svg'\nexport interface ElementsProxy {\n a: ElementCreator<HTMLAnchorElement>\n abbr: ElementCreator\n acronym: ElementCreator\n address: ElementCreator\n area: ElementCreator<HTMLAreaElement>\n article: ElementCreator\n aside: ElementCreator\n audio: ElementCreator<HTMLAudioElement>\n b: ElementCreator\n base: ElementCreator<HTMLBaseElement>\n basefont: ElementCreator\n bdi: ElementCreator\n bdo: ElementCreator\n big: ElementCreator\n blockquote: ElementCreator<HTMLQuoteElement>\n body: ElementCreator<HTMLBodyElement>\n br: ElementCreator<HTMLBRElement>\n button: ElementCreator<HTMLButtonElement>\n canvas: ElementCreator<HTMLCanvasElement>\n caption: ElementCreator\n center: ElementCreator\n cite: ElementCreator\n code: ElementCreator\n col: ElementCreator<HTMLTableColElement>\n colgroup: ElementCreator<HTMLTableColElement>\n data: ElementCreator<HTMLDataElement>\n datalist: ElementCreator<HTMLDataListElement>\n dd: ElementCreator\n del: ElementCreator\n details: ElementCreator<HTMLDetailsElement>\n dfn: ElementCreator\n dialog: ElementCreator<HTMLDialogElement>\n div: ElementCreator<HTMLDivElement>\n dl: ElementCreator\n dt: ElementCreator\n em: ElementCreator\n embed: ElementCreator<HTMLEmbedElement>\n fieldset: ElementCreator<HTMLFieldSetElement>\n figcaption: ElementCreator\n figure: ElementCreator\n font: ElementCreator\n footer: ElementCreator\n form: ElementCreator<HTMLFormElement>\n frame: ElementCreator\n frameset: ElementCreator\n head: ElementCreator<HTMLHeadElement>\n header: ElementCreator\n hgroup: ElementCreator\n h1: ElementCreator<HTMLHeadingElement>\n h2: ElementCreator<HTMLHeadingElement>\n h3: ElementCreator<HTMLHeadingElement>\n h4: ElementCreator<HTMLHeadingElement>\n h5: ElementCreator<HTMLHeadingElement>\n h6: ElementCreator<HTMLHeadingElement>\n hr: ElementCreator<HTMLHRElement>\n html: ElementCreator<HTMLHtmlElement>\n i: ElementCreator\n iframe: ElementCreator<HTMLIFrameElement>\n img: ElementCreator<HTMLImageElement>\n input: ElementCreator<HTMLInputElement>\n ins: ElementCreator<HTMLModElement>\n kbd: ElementCreator\n keygen: ElementCreator<HTMLUnknownElement>\n label: ElementCreator<HTMLLabelElement>\n legend: ElementCreator<HTMLLegendElement>\n li: ElementCreator<HTMLLIElement>\n link: ElementCreator<HTMLLinkElement>\n main: ElementCreator\n map: ElementCreator<HTMLMapElement>\n mark: ElementCreator\n menu: ElementCreator<HTMLMenuElement>\n menuitem: ElementCreator<HTMLUnknownElement>\n meta: ElementCreator<HTMLMetaElement>\n meter: ElementCreator<HTMLMeterElement>\n nav: ElementCreator\n noframes: ElementCreator\n noscript: ElementCreator\n object: ElementCreator<HTMLObjectElement>\n ol: ElementCreator<HTMLOListElement>\n optgroup: ElementCreator<HTMLOptGroupElement>\n option: ElementCreator<HTMLOptionElement>\n output: ElementCreator<HTMLOutputElement>\n p: ElementCreator<HTMLParagraphElement>\n param: ElementCreator\n picture: ElementCreator<HTMLPictureElement>\n pre: ElementCreator<HTMLPreElement>\n progress: ElementCreator<HTMLProgressElement>\n q: ElementCreator<HTMLQuoteElement>\n rp: ElementCreator\n rt: ElementCreator\n ruby: ElementCreator\n s: ElementCreator\n samp: ElementCreator\n script: ElementCreator<HTMLScriptElement>\n section: ElementCreator\n select: ElementCreator<HTMLSelectElement>\n slot: ElementCreator<HTMLSlotElement>\n small: ElementCreator\n source: ElementCreator<HTMLSourceElement>\n span: ElementCreator<HTMLSpanElement>\n strike: ElementCreator\n strong: ElementCreator\n style: ElementCreator<HTMLStyleElement>\n sub: ElementCreator\n summary: ElementCreator\n table: ElementCreator<HTMLTableElement>\n tbody: ElementCreator<HTMLTableSectionElement>\n td: ElementCreator<HTMLTableCellElement>\n template: ElementCreator<HTMLTemplateElement>\n textarea: ElementCreator<HTMLTextAreaElement>\n tfoot: ElementCreator<HTMLTableSectionElement>\n th: ElementCreator<HTMLTableCellElement>\n thead: ElementCreator<HTMLTableSectionElement>\n time: ElementCreator<HTMLTimeElement>\n title: ElementCreator<HTMLTitleElement>\n tr: ElementCreator<HTMLTableRowElement>\n track: ElementCreator<HTMLTrackElement>\n tt: ElementCreator\n u: ElementCreator\n ul: ElementCreator<HTMLUListElement>\n var: ElementCreator\n video: ElementCreator<HTMLVideoElement>\n wbr: ElementCreator\n [key: string | symbol]: ElementCreator<any>\n}\n\nconst templates: { [key: string]: Element } = {}\n\nconst elementStyle = (elt: HTMLElement, prop: string, value: any) => {\n const processed = processProp(camelToKabob(prop), value)\n if (processed.prop.startsWith('--')) {\n elt.style.setProperty(processed.prop, processed.value)\n } else {\n ;(elt.style as unknown as { [key: string]: string })[prop] = processed.value\n }\n}\n\nconst elementStyleBinding = (prop: string): XinBinding => {\n return {\n toDOM(element, value) {\n elementStyle(element as HTMLElement, prop, value)\n },\n }\n}\n\nconst elementProp = (elt: HTMLElement, key: string, value: any) => {\n if (key === 'style') {\n if (typeof value === 'object') {\n for (const prop of Object.keys(value)) {\n if (xinPath(value[prop])) {\n bind(elt, value[prop], elementStyleBinding(prop))\n } else {\n elementStyle(elt, prop, value[prop])\n }\n }\n } else {\n elt.setAttribute('style', value)\n }\n } else if ((elt as { [key: string]: any })[key] !== undefined) {\n // MathML is only supported on 91% of browsers, and not on the Raspberry Pi Chromium\n const { MathMLElement } = globalThis\n if (\n elt instanceof SVGElement ||\n (MathMLElement !== undefined && elt instanceof MathMLElement)\n ) {\n elt.setAttribute(key, value)\n } else {\n ;(elt as { [key: string]: any })[key] = value\n }\n } else {\n const attr = camelToKabob(key)\n\n if (attr === 'class') {\n value.split(' ').forEach((className: string) => {\n elt.classList.add(className)\n })\n } else if ((elt as { [key: string]: any })[attr] !== undefined) {\n ;(elt as StringMap)[attr] = value\n } else if (typeof value === 'boolean') {\n value ? elt.setAttribute(attr, '') : elt.removeAttribute(attr)\n } else {\n elt.setAttribute(attr, value)\n }\n }\n}\n\nconst elementPropBinding = (key: string): XinBinding => {\n return {\n toDOM(element, value) {\n elementProp(element as HTMLElement, key, value)\n },\n }\n}\n\nconst elementSet = (elt: HTMLElement, key: string, value: any) => {\n if (key === 'apply') {\n value(elt)\n } else if (key.match(/^on[A-Z]/) != null) {\n const eventType = key.substring(2).toLowerCase()\n on(elt, eventType as EventType, value)\n } else if (key === 'bind') {\n const binding =\n typeof value.binding === 'string'\n ? bindings[value.binding]\n : value.binding\n if (binding !== undefined && value.value !== undefined) {\n bind(\n elt,\n value.value,\n value.binding instanceof Function\n ? { toDOM: value.binding }\n : value.binding\n )\n } else {\n throw new Error(`bad binding`)\n }\n } else if (key.match(/^bind[A-Z]/) != null) {\n const bindingType = key.substring(4, 5).toLowerCase() + key.substring(5)\n const binding = bindings[bindingType]\n if (binding !== undefined) {\n bind(elt, value, binding)\n } else {\n throw new Error(\n `${key} is not allowed, bindings.${bindingType} is not defined`\n )\n }\n } else if (xinPath(value)) {\n bind(elt, value, elementPropBinding(key))\n } else {\n elementProp(elt, key, value)\n }\n}\n\nconst create = (tagType: string, ...contents: ElementPart[]): HTMLElement => {\n if (templates[tagType] === undefined) {\n const [tag, namespace] = tagType.split('|')\n if (namespace === undefined) {\n templates[tagType] = globalThis.document.createElement(tag)\n } else {\n templates[tagType] = globalThis.document.createElementNS(namespace, tag)\n }\n }\n const elt = templates[tagType].cloneNode() as HTMLElement\n const elementProps: ElementProps = {}\n for (const item of contents) {\n if (\n item instanceof Element ||\n item instanceof DocumentFragment ||\n typeof item === 'string' ||\n typeof item === 'number'\n ) {\n if (elt instanceof HTMLTemplateElement) {\n elt.content.append(item as Node)\n } else {\n elt.append(item as Node)\n }\n } else if (xinPath(item)) {\n elt.append(elements.span({ bindText: item }))\n } else {\n Object.assign(elementProps, item)\n }\n }\n for (const key of Object.keys(elementProps)) {\n const value: any = elementProps[key]\n elementSet(elt, key, value)\n }\n return elt\n}\n\nconst fragment = (...contents: ElementPart[]): DocumentFragment => {\n const frag = globalThis.document.createDocumentFragment()\n for (const item of contents) {\n frag.append(item as Node)\n }\n return frag\n}\n\n/**\n * elements is a proxy that produces ElementCreators, e.g.\n * elements.div() creates <div> elements and\n * elements.myElement() creates <my-element> elements.\n */\nexport const elements = new Proxy(\n { fragment },\n {\n get(target, tagName: string) {\n tagName = tagName.replace(/[A-Z]/g, (c) => `-${c.toLocaleLowerCase()}`)\n if ((target as StringMap)[tagName] === undefined) {\n ;(target as StringMap)[tagName] = (...contents: ElementPart[]) =>\n create(tagName, ...contents)\n }\n return (target as StringMap)[tagName]\n },\n set() {\n throw new Error('You may not add new properties to elements')\n },\n }\n) as unknown as ElementsProxy\n\ninterface SVGElementsProxy {\n [key: string]: ElementCreator<SVGElement>\n}\n\nexport const svgElements = new Proxy(\n { fragment },\n {\n get(target, tagName: string) {\n if ((target as StringMap)[tagName] === undefined) {\n ;(target as StringMap)[tagName] = (...contents: ElementPart[]) =>\n create(`${tagName}|${SVG}`, ...contents)\n }\n return (target as StringMap)[tagName]\n },\n set() {\n throw new Error('You may not add new properties to elements')\n },\n }\n) as unknown as SVGElementsProxy\n\ninterface MathMLElementsProxy {\n [key: string]: ElementCreator<MathMLElement>\n}\n\nexport const mathML = new Proxy(\n { fragment },\n {\n get(target, tagName: string) {\n if ((target as StringMap)[tagName] === undefined) {\n ;(target as StringMap)[tagName] = (...contents: ElementPart[]) =>\n create(`${tagName}|${MATH}`, ...contents)\n }\n return (target as StringMap)[tagName]\n },\n set() {\n throw new Error('You may not add new properties to elements')\n },\n }\n) as unknown as MathMLElementsProxy\n",
22
22
  "/*#\n# 5. css\n\n`xinjs` provides a collection of utilities for working with CSS rules that\nhelp leverage CSS variables to produce highly maintainable and lightweight\ncode that is nonetheless easy to customize.\n\nThe basic goal is to be able to implement some or all of our CSS very efficiently, compactly,\nand reusably in Javascript because:\n\n- Javascript quality tooling is really good, CSS quality tooling is terrible\n- Having to write CSS in Javascript is *inevitable* so it might as well be consistent and painless\n- It turns out you can get by with *much less* and generally *simpler* CSS this way\n- You get some natural wins this way. E.g. writing two definitions of `body {}` is easy to do\n and bad in CSS. In Javascript it's simply an error!\n\nThe `css` module attempts to implement all this the simplest and most obvious way possible,\nproviding syntax sugar to help with best-practices such as `css-variables` and the use of\n`@media` queries to drive consistency, themes, and accessibility.\n\n## css(styleMap: XinStyleMap): string\n\nA function that, given a `XinStyleMap` renders CSS code. What is a XinStyleMap?\nIt's kind of what you'd expect if you wanted to represent CSS as Javascript in\nthe most straightforward way possible. It allows for things like `@import`,\n`@keyframes` and so forth, but knows just enough about CSS to help with things\nlike autocompletion of CSS rules (rendered as camelcase) so that, unlike me, it\ncan remind you that it's `whiteSpace` and not `whitespace`.\n\n```\nimport {elements, css} from 'xinjs'\nconst {style} = elements\n\nconst myStyleMap = {\n body: {\n color: 'red'\n },\n button: {\n borderRadius: 5\n }\n}\n\ndocument.head.append(style(css(myStyleMap)))\n```\n\nThere's a convenient `Stylesheet()` function that does all this and adds an id to the\nresulting `<style>` element to make it easier to figure out where a given stylesheet\ncame from.\n\n```\nStylesheet('my-styles', {\n body: {\n color: 'red'\n },\n button: {\n borderRadius: 5\n }\n})\n```\n\n…inserts the following in the `document.head`:\n\n```\n<style id=\"my-styles\">\nbody {\n color: red;\n}\nbutton {\n border-radius: 5px;\n}\n</style>\n```\n\nIf a bare, non-zero **number** is assigned to a CSS property it will have 'px' suffixed\nto it automatically. There are *no bare numeric*ele properties in CSS except `0`.\n\nWhy `px`? Well the other obvious options would be `rem` and `em` but `px` seems the\nleast surprising option.\n\n`css` should render nested rules, such as `@keyframes` and `@media` correctly.\n\n## Initializing CSS Variables\n\nYou can initialize CSS variables using `_` or `__` prefixes on property names.\nOne bar, turns the camelCase property-name into a --snake-case CSS variable\nname, while two creates a default that can be overridden.\n\n```\nStyleSheet('my-theme', {\n ':root', {\n _fooBar: 'red',\n __bazBar: '10px'\n }\n})\n```\n\nWill produce:\n\n```\n<style id=\"my-theme\">\n :root {\n --foo-bar: red;\n --baz-bar: var(--baz-bar-default, 10px);\n }\n</style>\n```\n```js\nimport { elements, vars } from 'tosijs'\nconst { div } = elements\n\nwindow.CSS.registerProperty({\n name: '--at-bar',\n syntax: '<color>',\n inherits: true,\n initialValue: 'green',\n})\n\npreview.append(\n div(\n {\n style: {\n _fooBar: 'red',\n __bazBar: 'blue',\n }\n },\n div(\n {\n style: { color: vars.fooBar },\n },\n 'fooBar'\n ),\n div(\n {\n style: { color: vars.bazBar },\n },\n 'bazBar'\n ),\n div(\n {\n style: { color: vars.atBar },\n },\n 'atBar'\n ),\n )\n)\n```\n\n> ### @property and CSS.registerProperty() considered harmful\n>\n> This [new CSS feature}(https://developer.mozilla.org/en-US/docs/Web/CSS/@property) \n> is well-intentioned but ill-considered. I advise\n> against using it yourself until its serious flaws are addressed. The problem\n> is that if someone registers a variable you're using or you register\n> a variable someone else is using then your CSS may be broken. And\n> you can't re-register a variable either. \n\n> This is a bit like the problem\n> that xinjs Component works around with tagNames, but in practice far more\n> difficult to solve. It is impossible to tell if a given instance of \n> a given variable name is an intentional reuse or a new separate variable.\n> No-one intentionally defines two different components with the same tag.\n\n## invertLuminance({[key: string]: any}) => {[key: string]: string}\n\nGiven a map of CSS properties (in camelCase) emit a map of those properties that\nhas color values with their luminance inverted.\n\n const myStyleMap = {\n ':root': cssVars, // includes --font-size\n '@media (prefers-color-scheme: dark)': {\n ':root': invertLuminance(cssVars) // omits --font-size\n },\n }\n\n## vars\n\n`vars` is a proxy object that will return a css variable string from\na camelCase property, e.g.\n\n vars.camelCase // 'var(--camel-case)'\n\n> **it isn't called `var`** because that's a reserved word!\n\n### varDefault\n\n`varDefault` is a proxy object just like `vars` except that it returns a\n`function` that takes a property and renders it as a css variable reference\nwith a default, e.g\n\n varDefault.borderColor('red') // `var(--border-color, red)`\n \n## `getCssVar(variable: string, atElement = document.body): string`\n\n`getCssVar()` obtains the css variable evaluated at the specified element \n(an element defined at `:root` can be evaluated at `document.body`). You\ncan provide the name, e.g. `--foo-bar`, or \"wrapped\", e.g. `var(--foo-bar)`.\n\n### Syntax Sugar for `calc(...)`\n\nMore importantly, `vars` allows you to conveniently perform calculations\non css (dimensional) variables by a percentage:\n\n vars.camelSize50 // 'calc(var(--camel-size) * 0.5)'\n vars.camelSize_50 // 'calc(var(--camel-size) * -0.5)'\n\n### Computed Colors\n\n> #### Notes\n>\n> `color()` and `color-mix()` are [now enjoy 91% support](https://caniuse.com/?search=color-mix) as of writing.\n> See [color-mix()](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix) documentation.\n> Where they meet your needs, I'd suggest using them.\n>\n> [contrast-color()](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/contrast-color) is coming in Safari 26, \n> but [currently enjoys 0% upport](https://caniuse.com/?search=contrast-color).\n>\n> **Caution** although these look superficially like the `vars` syntax\n> sugar for `calc()` performed on dimensional variables, they are in fact\n> color calculations are performed on colors *evaluated* on `document.body` at \n> execution time. (So they won'b automatically be recomputed on theme change.)\n\nYou can write:\n\n```\nconst styleSpec = {\n _lineHeight: 24,\n _spacing: 5,\n _buttonHeight: calc(`vars.lineHeight + vars.spacing200`)\n)\n```\n\nAnd then render this as CSS and stick it into a StyleNode and it will work.\n\nYou *cannot* write:\n\n```\nconst styleSpec = {\n _background: '#fafafa',\n _blockColor: vars.background_5b\n}\n```\n\nBecause `--background` isn't defined on `document.body` yet, so vars.background_5b\nwon't be able to tell what `--background` is going to be yet. So either you need to\ndo this in two stags (create a StyleNode that defines the base color `--background`\nthen define the computed colors and add this) OR use a `Color` instance:\n\n```\nconst background = Color.fromCss('#fafafa')\n\ninitVars({\n background: background.toHTML,\n blockColor: background.brighten(-0.05).toHTML\n})\n```\n\nUntil browsers support color calculations the way they support dimension arithmetic with `calc()`\nthis is the miserable existence we all lead. That, or defining huge arrays of color\nvalues that we mostly don't use and are often not exactly what we want. You choose!\n\n> **New** color now supports CSS [named colors](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color),\nsuch as `black`, `red`, and `aliceblue`.\n\n`vars` also allows you to perform color calculations on css (color)\nvariables:\n\n#### Change luminance with `b` (for brighten) suffix\n\nThe scale value is treated as a percentage and moves the brightness\nthat far from its current value to 100% (if positive) or 0% (if negattive).\n\n vars.textColor50b // increases the luminance of textColor\n vars.textColor_50b // halves the luminance of textColor\n\n#### Change saturation with `s` suffix\n\nThe scale value is treated as a percentage and moves the saturation\nthat far from its current value to 100% (if positive) or 0% (if negattive).\n\n vars.textColor50s // increases the saturation of textColor\n vars.textColor_50s // halves the saturation of textColor\n\n#### Rotate hue with `h` suffix\n\n vars.textColor30h // rotates the hue of textColor by 30°\n vars.textColor_90h // rotates the hue of textColor by -90°\n\n#### Set Opacity with `o` suffix\n\nUnlike the other modifiers, `o` simply sets the opacity of the\nresulting color to the value provided.\n\n vars.textColor50o // textColor with opacity set to 0.5\n\n## More to follow?\n\nThe more I use the `css` module, the more I like it and the more ideas I have\nto make it even better, but I have a very tight size/complexity target\nfor `xinjs` so these new ideas really have to earn a spot. Perhaps the\nfeature I have come closest to adding and then decided against was providing\nsyntax-sugar for classs so that:\n\n css({\n _foo: {\n color: 'red'\n }\n })\n\nWould render:\n\n .foo {\n color: 'red'\n }\n\nBut looking at the code I and others have written, the case for this is weak as most class\ndeclarations are not just bare classes. This doesn't help with declarations\nfor `input.foo` or `.foo::after` or `.foo > *` and now there'd be things that\nlook different which violates the \"principle of least surprise\". So, no.\n\n### Something to Declare\n\nWhere I am always looking to improve this module (and all of `xinjs`) is to\ndo a better job of **declaring** things to improve autocomplete behavior and\nminimize casting and other Typescript antipatterns. E.g. adding a ton of\ndeclarations to `elements` and `css` has done wonders to reduce the need for\nstuff like `const nameElement = this.parts.nameField as unknown as HTMLInputElement`\nand prevent css property typos without adding a single byte to the size of\nthe javascript payload.\n*/\nimport { Color } from './color'\nimport { elements } from './elements'\nimport { camelToKabob } from './string-case'\nimport { XinStyleSheet, XinStyleRule } from './css-types'\n\nexport function StyleSheet(id: string, styleSpec: XinStyleSheet) {\n const element = elements.style(css(styleSpec))\n element.id = id\n document.head.append(element)\n}\n\nconst numericProps = [\n 'animation-iteration-count',\n 'flex',\n 'flex-base',\n 'flex-grow',\n 'flex-shrink',\n 'opacity',\n 'order',\n 'tab-size',\n 'widows',\n 'z-index',\n 'zoom',\n]\n\nexport const processProp = (\n prop: string,\n value: string | number\n): { prop: string; value: string } => {\n if (typeof value === 'number' && !numericProps.includes(prop)) {\n value = `${value}px`\n }\n if (prop.startsWith('_')) {\n if (prop.startsWith('__')) {\n prop = '--' + prop.substring(2)\n value = `var(${prop}-default, ${value})`\n } else {\n prop = '--' + prop.substring(1)\n }\n }\n return {\n prop,\n value: String(value),\n }\n}\n\nconst renderProp = (\n indentation: string,\n cssProp: string,\n value: string | number | Color | undefined\n): string => {\n if (value === undefined) {\n return ''\n }\n if (value instanceof Color) {\n value = value.html\n }\n const processed = processProp(cssProp, value)\n return `${indentation} ${processed.prop}: ${processed.value};`\n}\n\nconst renderStatement = (\n key: string,\n value: Color | string | number | XinStyleRule | undefined,\n indentation = ''\n): string => {\n const cssProp = camelToKabob(key)\n if (typeof value === 'object' && !(value instanceof Color)) {\n const renderedRule = Object.keys(value)\n .map((innerKey) =>\n renderStatement(innerKey, value[innerKey], `${indentation} `)\n )\n .join('\\n')\n return `${indentation} ${key} {\\n${renderedRule}\\n${indentation} }`\n } else {\n return renderProp(indentation, cssProp, value)\n }\n}\n\nexport const css = (obj: XinStyleSheet, indentation = ''): string => {\n const selectors = Object.keys(obj).map((selector) => {\n const body = obj[selector]\n if (typeof body === 'string') {\n if (selector === '@import') {\n return `@import url('${body}');`\n }\n throw new Error('top-level string value only allowed for `@import`')\n }\n const rule = Object.keys(body)\n .map((prop) => renderStatement(prop, body[prop]))\n .join('\\n')\n return `${indentation}${selector} {\\n${rule}\\n}`\n })\n return selectors.join('\\n\\n')\n}\n\nexport const initVars = (obj: {\n [key: string]: string | number\n}): XinStyleRule => {\n console.warn('initVars is deprecated. Just use _ and __ prefixes instead.')\n const rule: XinStyleRule = {}\n for (const key of Object.keys(obj)) {\n const value = obj[key]\n const kabobKey = camelToKabob(key)\n rule[`--${kabobKey}`] =\n typeof value === 'number' && value !== 0 ? String(value) + 'px' : value\n }\n return rule\n}\n\nexport const invertLuminance = (map: XinStyleRule): XinStyleRule => {\n const inverted: XinStyleRule = {}\n\n for (const key of Object.keys(map)) {\n const value = map[key]\n if (value instanceof Color) {\n inverted[key] = value.inverseLuminance\n } else if (\n typeof value === 'string' &&\n value.match(/^(#[0-9a-fA-F]{3}|rgba?\\(|hsla?\\()/)\n ) {\n inverted[key] = Color.fromCss(value).inverseLuminance\n }\n }\n\n return inverted\n}\n\nexport const varDefault = new Proxy<{ [key: string]: CssVarBuilder }>(\n {},\n {\n get(target, prop: string) {\n if (target[prop] === undefined) {\n const varName = '--' + camelToKabob(prop)\n target[prop] = (val: string | number) => `var(${varName}, ${val})`\n }\n return target[prop]\n },\n }\n)\n\ntype VarsType = {\n default: typeof varDefault\n} & {\n [key: string]: string\n}\n\nexport const vars = new Proxy<VarsType>({} as VarsType, {\n get(target, prop: string) {\n if (prop === 'default') {\n return varDefault\n }\n if (target[prop] == null) {\n prop = camelToKabob(prop)\n const [, _varName, , isNegative, scaleText, method] = prop.match(\n /^([-\\w]*?)((_)?(\\d+)(\\w?))?$/\n ) || ['', prop]\n const varName = `--${_varName}`\n if (scaleText != null) {\n const scale =\n isNegative == null\n ? Number(scaleText) / 100\n : -Number(scaleText) / 100\n switch (method) {\n case 'b': // brighten\n {\n const baseColor = Color.fromVar(varName)\n target[prop] =\n scale > 0\n ? baseColor.brighten(scale).rgba\n : baseColor.darken(-scale).rgba\n }\n break\n case 's': // saturate\n {\n const baseColor = Color.fromVar(varName)\n target[prop] =\n scale > 0\n ? baseColor.saturate(scale).rgba\n : baseColor.desaturate(-scale).rgba\n }\n break\n case 'h': // hue\n {\n const baseColor = Color.fromVar(varName)\n target[prop] = baseColor.rotate(scale * 100).rgba\n }\n break\n case 'o': // alpha\n {\n const baseColor = Color.fromVar(varName)\n target[prop] = baseColor.opacity(scale).rgba\n }\n break\n case '':\n target[prop] = `calc(var(${varName}) * ${scale})`\n break\n default:\n console.error(method)\n throw new Error(\n `Unrecognized method ${method} for css variable ${varName}`\n )\n }\n } else {\n target[prop] = `var(${varName})`\n }\n }\n return target[prop]\n },\n})\n\ntype CssVarBuilder = (val: string | number) => string\n",
23
- "/*#\n# 4. web-components\n\n**xinjs** provides the abstract `Component` class to make defining custom-elements\neasier.\n\n## Component\n\nTo define a custom-element you can subclass `Component`, simply add the properties\nand methods you want, with some help from `Component` itself, and then simply\nexport your new class's `elementCreator()` which is a function that defines your\nnew component's element and produces instances of it as needed.\n\n```\nimport {Component} from 'xinjs'\n\nclass ToolBar extends Component {\n static styleSpec = {\n ':host': {\n display: 'flex',\n gap: '10px',\n },\n }\n}\n\nexport const toolBar = ToolBar.elementCreator({ tag: 'tool-bar' })\n```\n\nThis component is just a structural element. By default a `Component` subclass will\ncomprise itself and a `<slot>`. You can change this by giving your subclass its\nown `content` template.\n\nThe last line defines the `ToolBar` class as the implementation of `<tool-bar>`\nHTML elements (`tool-bar` is derived automatically from the class name) and\nreturns an `ElementCreator` function that creates `<tool-bar>` elements.\n\nSee [elements](/?elements.ts) for more information on `ElementCreator` functions.\n\n### Component properties\n\n#### content: Element | Element[] | () => Element | () => Element[] | null\n\nHere's a simple example of a custom-element that simply produces a\n`<label>` wrapped around `<span>` and an `<input>`. Its value is synced\nto that of its `<input>` so the user doesn't need to care about how\nit works internally.\n\n```js\nimport { Component, elements } from 'tosijs'\n\nconst {label, span, input} = elements\n\nclass LabeledInput extends Component {\n caption = 'untitled'\n value = ''\n\n constructor() {\n super()\n this.initAttributes('caption')\n }\n\n content = label(span(), input())\n\n connectedCallback() {\n super.connectedCallback()\n const {input} = this.parts\n input.addEventListener('input', () => {\n this.value = input.value\n })\n }\n\n render() {\n super.render()\n const {span, input} = this.parts\n span.textContent = this.caption\n if (input.value !== this.value) {\n input.value = this.value\n }\n }\n}\n\nconst labeledInput = LabeledInput.elementCreator()\n\npreview.append(\n labeledInput({caption: 'A text field', value: 'some text'})\n)\n```\n\n`content` is, in essence, a template for the internals of the element. By default\nit's a single `<slot>` element. If you explicitly want an element with no content\nyou can set your subclass's content to `null` or omit any `<slot>` from its template.\n\nBy setting content to be a function that returns elements instead of a collection\nof elements you can take customize elements based on the component's properties.\nIn particular, you can use `onXxxx` syntax sugar to bind events.\n\n(Note that you cannot bind to xin paths reliably if your component uses a `shadowDOM`\nbecause `xin` cannot \"see\" elements there. As a general rule, you need to take care\nof anything in the `shadowDOM` yourself.)\n\nIf you'd like to see a more complex example along the same lines, look at\n[xin-form and xin-field](https://ui.xinjs.net/?form.ts).\n\n##### <slot> names and the `slot` attribute\n\n```\nconst {slot} = Component.elements\nclass MenuBar extends Component {\n static styleSpec = {\n ':host, :host > slot': {\n display: 'flex',\n },\n ':host > slot:nth-child(1)': {\n flex: '1 1 auto'\n },\n }\n\n content = [slot(), slot({name: 'gadgets'})]\n}\n\nexport menuBar = MenuBar.elementCreator()\n```\n\nOne of the neat things about custom-elements is that you can give them *multiple*\n`<slot>`s with different `name` attributes and then have children target a specific\nslot using the `slot` attribute.\n\nThis app's layout (the nav sidebar that disappears if the app is in a narrow space, etc.)\nis built using just such a custom-element.\n\n#### `<xin-slot>`\n\nIf you put `<slot>` elements inside a `Component` subclass that doesn't have a\nshadowDOM, they will automatically be replaced with `<xin-slot>` elements that\nhave the expected behavior (i.e. sucking in children in based on their `<slot>`\nattribute).\n\n`<xin-slot>` doesn't support `:slotted` but since there's no shadowDOM, just\nstyle such elements normally, or use `xin-slot` as a CSS-selector.\n\nNote that you cannot give a `<slot>` element attributes (other than `name`) so if\nyou want to give a `<xin-slot>` attributes (such as `class` or `style`), create it\nexplicitly (e.g. using `elements.xinSlot()`) rather than using `<slot>` elements\nand letting them be switched out (because they'll lose any attributes you give them).\n\nHere's a very simple example:\n\n```js\nimport { Component, elements } from 'tosijs'\n\nconst { xinSlot, div } = elements\n\nclass FauxSlotExample extends Component {\n content = [\n div('This is a web-component with no shadow DOM and working slots!'),\n xinSlot({name: 'top'}),\n xinSlot(),\n xinSlot({name: 'bottom'}),\n ]\n}\n\nconst fauxSlotExample = FauxSlotExample.elementCreator({\n tag: 'faux-slot-example',\n styleSpec: {\n ':host': {\n display: 'flex',\n flexDirection: 'column'\n },\n }\n})\n\npreview.append(\n fauxSlotExample(\n div({slot: 'bottom'}, 'I should be on the bottom'),\n div({slot: 'top'}, 'I should be on the top'),\n div('I should be in the middle')\n )\n)\n```\n\n> ##### Background\n>\n> `<slot>` elements do not work as expected in shadowDOM-less components. This is\n> hugely annoying since it prevents components from composing nicely unless they\n> have a shadowDOM, and while the shadowDOM is great for small widgets, it's\n> terrible for composite views and breaks `xinjs`'s bindings (inside the shadow\n> DOM you need to do data- and event- binding manually).\n\n#### styleNode: HTMLStyleElement\n\n`styleNode` is the `<style>` element that will be inserted into the element's\n`shadowRoot`.\n\nIf a `Component` subclass has no `styleNode`, no `shadowRoot` will be\ncreated. This reduces the memory and performance cost of the element.\n\nThis is to avoid the performance/memory costs associated with the `shadowDOM`\nfor custom-elements with no styling.\n\n##### Notes\n\nStyling custom-elements can be tricky, and it's worth learning about\nhow the `:host` and `:slotted()` selectors work.\n\nIt's also very useful to understand how CSS-Variables interact with the\n`shadowDOM`. In particular, CSS-variables are passed into the `shadowDOM`\nwhen other CSS rules are not. You can use css rules to modify css-variables\nwhich will then penetrate the `shadowDOM`.\n\n#### refs: {[key:string]: Element | undefined}\n\n render() {\n super.render() // see note\n const {span, input} = this.parts\n span.textContent = this.caption\n if (input.value !== this.value) {\n input.value = this.value\n }\n }\n\n> **Note**: the `render()` method of the base `Component` class doesn't currently\n> do anything, so calling it is optional (but a good practice in case one day…)\n>\n> It is *necessary* however to call `super.connectedCallback`, `super.disconnectedCallback`\n> and `super()` in the `constructor()` should you override them.\n\n`this.parts` returns a proxy that provides elements conveniently and efficiently. It\nis intended to facilitate access to static elements (it memoizes its values the\nfirst time they are computed).\n\n`this.parts.foo` will return a content element with `data-ref=\"foo\"`. If no such\nelement is found it tries it as a css selector, so `this.parts['.foo']` would find\na content element with `class=\"foo\"` while `this.parts.h1` will find an `<h1>`.\n\n`this.parts` will also remove a `data-ref` attribute once it has been used to find\nthe element. This means that if you use all your refs in `render` or `connectedCallback`\nthen no trace will remain in the DOM for a mounted element.\n\n### Component methods\n\n#### initAttributes(...attributeNames: string[])\n\n class LabeledInput extends Component {\n caption: string = 'untitled'\n value: string = ''\n\n constructor() {\n super()\n this.initAttributes('caption')\n }\n\n ...\n }\n\nSets up basic behavior such as queueing a render if an attribute is changed, setting\nattributes based on the DOM source, updating them if they're changed, implementing\nboolean attributes in the expected manner, and so forth.\n\nCall `initAttributes` in your subclass's `constructor`, and make sure to call `super()`.\n\n#### queueRender(triggerChangeEvent = false): void\n\nUses `requestAnimationFrame` to queue a call to the component's `render` method. If\ncalled with `true` it will also trigger a `change` event.\n\n#### private initValue(): void\n\n**Don't call this!** Sets up expected behavior for an `HTMLElement` with\na value (i.e. triggering a `change` events and `render` when the `value` changes).\n\n#### private hydrate(): void\n\n**Don't call this** Appends `content` to the element (or its `shadowRoot` if it has a `styleNode`)\n\n#### connectedCallback(): void\n\nIf the class has an `onResize` handler then a ResizeObserver will trigger `resize`\nevents on the element when its size changes and `onResize` will be set up to respond\nto `resize` events.\n\nAlso, if the subclass has defined `value`, calls `initValue()`.\n\n`connectedCallback` is a great place to attach **event-handlers** to elements in your component.\n\nBe sure to call `super.connectedCallback()` if you implement `connectedCallback` in the subclass.\n\n#### disconnectedCallback(): void\n\nBe sure to call `super.disconnectedCallback()` if you implement `disconnectedCallback` in the subclass.\n\n#### render(): void\n\nBe sure to call `super.render()` if you implement `render` in the subclass.\n\n### Component static properties\n\n#### Component.elements\n\n const {label, span, input} = Component.elements\n\nThis is simply provided as a convenient way to get to [elements](/?elements.ts)\n\n### Component static methods\n\n#### Component.elementCreator(options? {tag?: string, styleSpec: XinStyleSheet}): ElementCreator\n\n export const toolBar = ToolBar.elementCreator({tag: 'tool-bar'})\n\nReturns a function that creates the custom-element. If you don't pass a `tag` or if the provided tag\nis already in use, a new unique tag will be used.\n\nIf no tag is provided, the Component will try to use introspection to \"snake-case\" the\n\"ClassName\", but if you're using name mangling this won't work and you'll get something\npretty meaningless.\n\nIf you want to create a global `<style>` sheet for the element (especially useful if\nyour component doesn't use the `shadowDOM`) then you can pass `styleSpec`. E.g.\n\n export const toolBar = ToolBar.elementCreator({\n tag: 'tool-bar',\n styleSpec: {\n ':host': { // note that ':host' will be turned into the tagName automatically!\n display: 'flex',\n padding: 'var(--toolbar-padding, 0 8px)',\n gap: '4px'\n }\n }\n })\n\nThis will—assuming \"tool-bar\" is available—create:\n\n <style id=\"tool-bar-helper\">\n tool-bar {\n display: flex;\n padding: var(--toolbar-padding, 0 8px);\n gap: 4px;\n }\n <style>\n\nAnd append it to `document.head` when the first instance of `<tool-bar>` is inserted in the DOM.\n\nFinally, `elementCreator` is memoized and only generated once (and the arguments are\nignored on all subsequent calls).\n\n## Examples\n\n[xinjs-ui](https://ui.xinjs.net) is a component library built using this `Component` class\nthat provides the essential additions to standard HTML elements needed to build many\nuser-interfaces.\n\n- [xin-example](https://ui.xinjs.net/https://ui.xinjs.net/?live-example.ts) uses multiple named slots to implement\n powers the interactive examples used for this site.\n- [xin-sidebar](https://ui.xinjs.net/?side-nav.ts) implements the sidebar navigation\n used on this site.\n- [xin-table](https://ui.xinjs.net/?data-table.ts) implements virtualized tables\n with resizable, reorderable, sortable columns that can handle more data\n than you're probably willing to load.\n- [xin-form and xin-field](https://ui.xinjs.net/?form.ts) allow you to\n quickly create forms that leverage all the built-in functionality of `<input>`\n elements (including powerful validation) even for custom-fields.\n- [xin-md](https://ui.xinjs.net/?markdown-viewer.ts) uses `marked` to render\n markdown.\n- [xin-3d](https://ui.xinjs.net/?babylon-3d.ts) lets you easily embed 3d scenes\n in your application using [babylonjs](https://babylonjs.com/)\n*/\nimport { css } from './css'\nimport { XinStyleSheet } from './css-types'\nimport { deepClone } from './deep-clone'\nimport { appendContentToElement, dispatch, resizeObserver } from './dom'\nimport { elements, ElementsProxy } from './elements'\nimport { camelToKabob, kabobToCamel } from './string-case'\nimport { ElementCreator, ContentType, PartsMap } from './xin-types'\n\nlet anonymousElementCount = 0\n\nfunction anonElementTag(): string {\n return `custom-elt${(anonymousElementCount++).toString(36)}`\n}\nlet instanceCount = 0\n\ninterface ElementCreatorOptions extends ElementDefinitionOptions {\n tag?: string\n styleSpec?: XinStyleSheet\n}\n\nconst globalStyleSheets: {\n [key: string]: string\n} = {}\n\nfunction setGlobalStyle(tagName: string, styleSpec: XinStyleSheet) {\n const existing = globalStyleSheets[tagName]\n const processed = css(styleSpec).replace(/:host\\b/g, tagName)\n globalStyleSheets[tagName] = existing\n ? existing + '\\n' + processed\n : processed\n}\n\nfunction insertGlobalStyles(tagName: string) {\n if (globalStyleSheets[tagName]) {\n document.head.append(\n elements.style({ id: tagName + '-component' }, globalStyleSheets[tagName])\n )\n }\n delete globalStyleSheets[tagName]\n}\n\nexport abstract class Component<T = PartsMap> extends HTMLElement {\n static elements: ElementsProxy = elements\n private static _elementCreator?: ElementCreator<Component>\n instanceId: string\n styleNode?: HTMLStyleElement\n static styleSpec?: XinStyleSheet\n static styleNode?: HTMLStyleElement\n content: ContentType | (() => ContentType) | null = elements.slot()\n isSlotted?: boolean\n private static _tagName: null | string = null\n static get tagName(): null | string {\n return this._tagName\n }\n [key: string]: any\n\n static StyleNode(styleSpec: XinStyleSheet): HTMLStyleElement {\n console.warn(\n 'StyleNode is deprecated, just assign static styleSpec: XinStyleSheet to the class directly'\n )\n return elements.style(css(styleSpec))\n }\n\n static elementCreator(\n options: ElementCreatorOptions = {}\n ): ElementCreator<Component> {\n if (this._elementCreator == null) {\n const { tag, styleSpec } = options\n let tagName = options != null ? tag : null\n if (tagName == null) {\n if (typeof this.name === 'string' && this.name !== '') {\n tagName = camelToKabob(this.name)\n if (tagName.startsWith('-')) {\n tagName = tagName.slice(1)\n }\n } else {\n tagName = anonElementTag()\n }\n }\n if (customElements.get(tagName) != null) {\n console.warn(`${tagName} is already defined`)\n }\n if (tagName.match(/\\w+(-\\w+)+/) == null) {\n console.warn(`${tagName} is not a legal tag for a custom-element`)\n tagName = anonElementTag()\n }\n while (customElements.get(tagName) !== undefined) {\n tagName = anonElementTag()\n }\n this._tagName = tagName\n if (styleSpec !== undefined) {\n setGlobalStyle(tagName, styleSpec)\n }\n window.customElements.define(\n tagName,\n this as unknown as CustomElementConstructor,\n options\n )\n this._elementCreator = elements[tagName]\n }\n return this._elementCreator\n }\n\n initAttributes(...attributeNames: string[]): void {\n const attributes: { [key: string]: any } = {}\n const attributeValues: { [key: string]: any } = {}\n const observer = new MutationObserver((mutationsList) => {\n let triggerRender = false\n mutationsList.forEach((mutation) => {\n triggerRender = !!(\n mutation.attributeName &&\n attributeNames.includes(kabobToCamel(mutation.attributeName))\n )\n })\n if (triggerRender && this.queueRender !== undefined)\n this.queueRender(false)\n })\n observer.observe(this, { attributes: true })\n attributeNames.forEach((attributeName) => {\n attributes[attributeName] = deepClone(this[attributeName])\n const attributeKabob = camelToKabob(attributeName)\n Object.defineProperty(this, attributeName, {\n enumerable: false,\n get() {\n if (typeof attributes[attributeName] === 'boolean') {\n return this.hasAttribute(attributeKabob)\n } else {\n if (this.hasAttribute(attributeKabob)) {\n return typeof attributes[attributeName] === 'number'\n ? parseFloat(this.getAttribute(attributeKabob))\n : this.getAttribute(attributeKabob)\n } else if (attributeValues[attributeName] !== undefined) {\n return attributeValues[attributeName]\n } else {\n return attributes[attributeName]\n }\n }\n },\n set(value) {\n if (typeof attributes[attributeName] === 'boolean') {\n if (value !== this[attributeName]) {\n if (value) {\n this.setAttribute(attributeKabob, '')\n } else {\n this.removeAttribute(attributeKabob)\n }\n this.queueRender()\n }\n } else if (typeof attributes[attributeName] === 'number') {\n if (value !== parseFloat(this[attributeName])) {\n this.setAttribute(attributeKabob, value)\n this.queueRender()\n }\n } else {\n if (\n typeof value === 'object' ||\n `${value as string}` !== `${this[attributeName] as string}`\n ) {\n if (\n value === null ||\n value === undefined ||\n typeof value === 'object'\n ) {\n this.removeAttribute(attributeKabob)\n } else {\n this.setAttribute(attributeKabob, value)\n }\n this.queueRender()\n attributeValues[attributeName] = value\n }\n }\n },\n })\n })\n }\n\n private initValue(): void {\n const valueDescriptor = Object.getOwnPropertyDescriptor(this, 'value')\n if (\n valueDescriptor === undefined ||\n valueDescriptor.get !== undefined ||\n valueDescriptor.set !== undefined\n ) {\n return\n }\n let value = this.hasAttribute('value')\n ? this.getAttribute('value')\n : deepClone(this.value)\n delete this.value\n Object.defineProperty(this, 'value', {\n enumerable: false,\n get() {\n return value\n },\n set(newValue: any) {\n if (value !== newValue) {\n value = newValue\n this.queueRender(true)\n }\n },\n })\n }\n\n private _parts?: T\n get parts(): T {\n const root = this.shadowRoot != null ? this.shadowRoot : this\n if (this._parts == null) {\n this._parts = new Proxy(\n {},\n {\n get(target: any, ref: string) {\n if (target[ref] === undefined) {\n let element = root.querySelector(`[part=\"${ref}\"]`)\n if (element == null) {\n element = root.querySelector(ref)\n }\n if (element == null)\n throw new Error(`elementRef \"${ref}\" does not exist!`)\n element.removeAttribute('data-ref')\n target[ref] = element as Element\n }\n return target[ref]\n },\n }\n ) as T\n }\n return this._parts\n }\n\n constructor() {\n super()\n instanceCount += 1\n this.initAttributes('hidden')\n this.instanceId = `${this.tagName.toLocaleLowerCase()}-${instanceCount}`\n this._value = deepClone(this.defaultValue)\n }\n\n connectedCallback(): void {\n insertGlobalStyles((this.constructor as unknown as Component).tagName)\n this.hydrate()\n // super annoyingly, chrome loses its shit if you set *any* attributes in the constructor\n if (this.role != null) this.setAttribute('role', this.role)\n if (this.onResize !== undefined) {\n resizeObserver.observe(this)\n if (this._onResize == null) {\n this._onResize = this.onResize.bind(this)\n }\n this.addEventListener('resize', this._onResize)\n }\n if (this.value != null && this.getAttribute('value') != null) {\n this._value = this.getAttribute('value')\n }\n this.queueRender()\n }\n\n disconnectedCallback(): void {\n resizeObserver.unobserve(this)\n }\n\n private _changeQueued = false\n private _renderQueued = false\n queueRender(triggerChangeEvent = false): void {\n if (!this._hydrated) return\n if (!this._changeQueued) this._changeQueued = triggerChangeEvent\n if (!this._renderQueued) {\n this._renderQueued = true\n requestAnimationFrame(() => {\n // TODO add mechanism to allow component developer to have more control over\n // whether input vs. change events are emitted\n if (this._changeQueued) dispatch(this, 'change')\n this._changeQueued = false\n this._renderQueued = false\n this.render()\n })\n }\n }\n\n private _hydrated = false\n private hydrate(): void {\n if (!this._hydrated) {\n this.initValue()\n const cloneElements = typeof this.content !== 'function'\n const _content: ContentType | null =\n typeof this.content === 'function' ? this.content() : this.content\n\n const { styleSpec } = this.constructor as unknown as Component\n let { styleNode } = this.constructor as unknown as Component\n if (styleSpec) {\n styleNode = (this.constructor as unknown as Component).styleNode =\n elements.style(css(styleSpec))\n delete (this.constructor as unknown as Component).styleNode\n }\n if (this.styleNode) {\n console.warn(\n this,\n 'styleNode is deprecrated, use static styleNode or statc styleSpec instead'\n )\n styleNode = this.styleNode\n }\n if (styleNode) {\n const shadow = this.attachShadow({ mode: 'open' })\n shadow.appendChild(styleNode.cloneNode(true))\n appendContentToElement(shadow, _content, cloneElements)\n } else if (_content !== null) {\n const existingChildren = Array.from(this.childNodes)\n appendContentToElement(this as HTMLElement, _content, cloneElements)\n this.isSlotted = this.querySelector('slot,xin-slot') !== undefined\n const slots = Array.from(this.querySelectorAll('slot'))\n if (slots.length > 0) {\n slots.forEach(XinSlot.replaceSlot)\n }\n if (existingChildren.length > 0) {\n const slotMap: { [key: string]: Element } = { '': this }\n Array.from(this.querySelectorAll('xin-slot')).forEach((slot) => {\n slotMap[(slot as XinSlot).name] = slot\n })\n existingChildren.forEach((child) => {\n const defaultSlot = slotMap['']\n const destSlot =\n child instanceof Element ? slotMap[child.slot] : defaultSlot\n ;(destSlot !== undefined ? destSlot : defaultSlot).append(child)\n })\n }\n }\n this._hydrated = true\n }\n }\n\n render(): void {}\n}\n\nclass XinSlot extends Component {\n name = ''\n content = null\n\n static replaceSlot(slot: HTMLSlotElement): void {\n const _slot = document.createElement('xin-slot')\n if (slot.name !== '') {\n _slot.setAttribute('name', slot.name)\n }\n slot.replaceWith(_slot)\n }\n\n constructor() {\n super()\n this.initAttributes('name')\n }\n}\n\nexport const xinSlot = XinSlot.elementCreator({ tag: 'xin-slot' })\n",
23
+ "/*#\n# 4. web-components\n\n**xinjs** provides the abstract `Component` class to make defining custom-elements\neasier.\n\n## Component\n\nTo define a custom-element you can subclass `Component`, simply add the properties\nand methods you want, with some help from `Component` itself, and then simply\nexport your new class's `elementCreator()` which is a function that defines your\nnew component's element and produces instances of it as needed.\n\n```\nimport {Component} from 'xinjs'\n\nclass ToolBar extends Component {\n static styleSpec = {\n ':host': {\n display: 'flex',\n gap: '10px',\n },\n }\n}\n\nexport const toolBar = ToolBar.elementCreator({ tag: 'tool-bar' })\n```\n\nThis component is just a structural element. By default a `Component` subclass will\ncomprise itself and a `<slot>`. You can change this by giving your subclass its\nown `content` template.\n\nThe last line defines the `ToolBar` class as the implementation of `<tool-bar>`\nHTML elements (`tool-bar` is derived automatically from the class name) and\nreturns an `ElementCreator` function that creates `<tool-bar>` elements.\n\nSee [elements](/?elements.ts) for more information on `ElementCreator` functions.\n\n### Component properties\n\n#### content: Element | Element[] | () => Element | () => Element[] | null\n\nHere's a simple example of a custom-element that simply produces a\n`<label>` wrapped around `<span>` and an `<input>`. Its value is synced\nto that of its `<input>` so the user doesn't need to care about how\nit works internally.\n\n```js\nimport { Component, elements } from 'tosijs'\n\nconst {label, span, input} = elements\n\nclass LabeledInput extends Component {\n caption = 'untitled'\n value = ''\n\n constructor() {\n super()\n this.initAttributes('caption')\n }\n\n content = label(span(), input())\n\n connectedCallback() {\n super.connectedCallback()\n const {input} = this.parts\n input.addEventListener('input', () => {\n this.value = input.value\n })\n }\n\n render() {\n super.render()\n const {span, input} = this.parts\n span.textContent = this.caption\n if (input.value !== this.value) {\n input.value = this.value\n }\n }\n}\n\nconst labeledInput = LabeledInput.elementCreator()\n\npreview.append(\n labeledInput({caption: 'A text field', value: 'some text'})\n)\n```\n\n`content` is, in essence, a template for the internals of the element. By default\nit's a single `<slot>` element. If you explicitly want an element with no content\nyou can set your subclass's content to `null` or omit any `<slot>` from its template.\n\nBy setting content to be a function that returns elements instead of a collection\nof elements you can take customize elements based on the component's properties.\nIn particular, you can use `onXxxx` syntax sugar to bind events.\n\n(Note that you cannot bind to xin paths reliably if your component uses a `shadowDOM`\nbecause `xin` cannot \"see\" elements there. As a general rule, you need to take care\nof anything in the `shadowDOM` yourself.)\n\nIf you'd like to see a more complex example along the same lines, look at\n[xin-form and xin-field](https://ui.xinjs.net/?form.ts).\n\n##### <slot> names and the `slot` attribute\n\n```\nconst {slot} = Component.elements\nclass MenuBar extends Component {\n static styleSpec = {\n ':host, :host > slot': {\n display: 'flex',\n },\n ':host > slot:nth-child(1)': {\n flex: '1 1 auto'\n },\n }\n\n content = [slot(), slot({name: 'gadgets'})]\n}\n\nexport menuBar = MenuBar.elementCreator()\n```\n\nOne of the neat things about custom-elements is that you can give them *multiple*\n`<slot>`s with different `name` attributes and then have children target a specific\nslot using the `slot` attribute.\n\nThis app's layout (the nav sidebar that disappears if the app is in a narrow space, etc.)\nis built using just such a custom-element.\n\n#### `<xin-slot>`\n\nIf you put `<slot>` elements inside a `Component` subclass that doesn't have a\nshadowDOM, they will automatically be replaced with `<xin-slot>` elements that\nhave the expected behavior (i.e. sucking in children in based on their `<slot>`\nattribute).\n\n`<xin-slot>` doesn't support `:slotted` but since there's no shadowDOM, just\nstyle such elements normally, or use `xin-slot` as a CSS-selector.\n\nNote that you cannot give a `<slot>` element attributes (other than `name`) so if\nyou want to give a `<xin-slot>` attributes (such as `class` or `style`), create it\nexplicitly (e.g. using `elements.xinSlot()`) rather than using `<slot>` elements\nand letting them be switched out (because they'll lose any attributes you give them).\n\nHere's a very simple example:\n\n```js\nimport { Component, elements } from 'tosijs'\n\nconst { xinSlot, div } = elements\n\nclass FauxSlotExample extends Component {\n content = [\n div('This is a web-component with no shadow DOM and working slots!'),\n xinSlot({name: 'top'}),\n xinSlot(),\n xinSlot({name: 'bottom'}),\n ]\n}\n\nconst fauxSlotExample = FauxSlotExample.elementCreator({\n tag: 'faux-slot-example',\n styleSpec: {\n ':host': {\n display: 'flex',\n flexDirection: 'column'\n },\n }\n})\n\npreview.append(\n fauxSlotExample(\n div({slot: 'bottom'}, 'I should be on the bottom'),\n div({slot: 'top'}, 'I should be on the top'),\n div('I should be in the middle')\n )\n)\n```\n\n> ##### Background\n>\n> `<slot>` elements do not work as expected in shadowDOM-less components. This is\n> hugely annoying since it prevents components from composing nicely unless they\n> have a shadowDOM, and while the shadowDOM is great for small widgets, it's\n> terrible for composite views and breaks `xinjs`'s bindings (inside the shadow\n> DOM you need to do data- and event- binding manually).\n\n#### styleNode: HTMLStyleElement\n\n`styleNode` is the `<style>` element that will be inserted into the element's\n`shadowRoot`.\n\nIf a `Component` subclass has no `styleNode`, no `shadowRoot` will be\ncreated. This reduces the memory and performance cost of the element.\n\nThis is to avoid the performance/memory costs associated with the `shadowDOM`\nfor custom-elements with no styling.\n\n##### Notes\n\nStyling custom-elements can be tricky, and it's worth learning about\nhow the `:host` and `:slotted()` selectors work.\n\nIt's also very useful to understand how CSS-Variables interact with the\n`shadowDOM`. In particular, CSS-variables are passed into the `shadowDOM`\nwhen other CSS rules are not. You can use css rules to modify css-variables\nwhich will then penetrate the `shadowDOM`.\n\n#### refs: {[key:string]: Element | undefined}\n\n render() {\n super.render() // see note\n const {span, input} = this.parts\n span.textContent = this.caption\n if (input.value !== this.value) {\n input.value = this.value\n }\n }\n\n> **Note**: the `render()` method of the base `Component` class doesn't currently\n> do anything, so calling it is optional (but a good practice in case one day…)\n>\n> It is *necessary* however to call `super.connectedCallback`, `super.disconnectedCallback`\n> and `super()` in the `constructor()` should you override them.\n\n`this.parts` returns a proxy that provides elements conveniently and efficiently. It\nis intended to facilitate access to static elements (it memoizes its values the\nfirst time they are computed).\n\n`this.parts.foo` will return a content element with `data-ref=\"foo\"`. If no such\nelement is found it tries it as a css selector, so `this.parts['.foo']` would find\na content element with `class=\"foo\"` while `this.parts.h1` will find an `<h1>`.\n\n`this.parts` will also remove a `data-ref` attribute once it has been used to find\nthe element. This means that if you use all your refs in `render` or `connectedCallback`\nthen no trace will remain in the DOM for a mounted element.\n\n### Component methods\n\n#### initAttributes(...attributeNames: string[])\n\n class LabeledInput extends Component {\n caption: string = 'untitled'\n value: string = ''\n\n constructor() {\n super()\n this.initAttributes('caption')\n }\n\n ...\n }\n\nSets up basic behavior such as queueing a render if an attribute is changed, setting\nattributes based on the DOM source, updating them if they're changed, implementing\nboolean attributes in the expected manner, and so forth.\n\nCall `initAttributes` in your subclass's `constructor`, and make sure to call `super()`.\n\n#### queueRender(triggerChangeEvent = false): void\n\nUses `requestAnimationFrame` to queue a call to the component's `render` method. If\ncalled with `true` it will also trigger a `change` event.\n\n#### private initValue(): void\n\n**Don't call this!** Sets up expected behavior for an `HTMLElement` with\na value (i.e. triggering a `change` events and `render` when the `value` changes).\n\n#### private hydrate(): void\n\n**Don't call this** Appends `content` to the element (or its `shadowRoot` if it has a `styleNode`)\n\n#### connectedCallback(): void\n\nIf the class has an `onResize` handler then a ResizeObserver will trigger `resize`\nevents on the element when its size changes and `onResize` will be set up to respond\nto `resize` events.\n\nAlso, if the subclass has defined `value`, calls `initValue()`.\n\n`connectedCallback` is a great place to attach **event-handlers** to elements in your component.\n\nBe sure to call `super.connectedCallback()` if you implement `connectedCallback` in the subclass.\n\n#### disconnectedCallback(): void\n\nBe sure to call `super.disconnectedCallback()` if you implement `disconnectedCallback` in the subclass.\n\n#### render(): void\n\nBe sure to call `super.render()` if you implement `render` in the subclass.\n\n### Component static properties\n\n#### Component.elements\n\n const {label, span, input} = Component.elements\n\nThis is simply provided as a convenient way to get to [elements](/?elements.ts)\n\n### Component static methods\n\n#### Component.elementCreator(options? {tag?: string, styleSpec: XinStyleSheet}): ElementCreator\n\n export const toolBar = ToolBar.elementCreator({tag: 'tool-bar'})\n\nReturns a function that creates the custom-element. If you don't pass a `tag` or if the provided tag\nis already in use, a new unique tag will be used.\n\nIf no tag is provided, the Component will try to use introspection to \"snake-case\" the\n\"ClassName\", but if you're using name mangling this won't work and you'll get something\npretty meaningless.\n\nIf you want to create a global `<style>` sheet for the element (especially useful if\nyour component doesn't use the `shadowDOM`) then you can pass `styleSpec`. E.g.\n\n export const toolBar = ToolBar.elementCreator({\n tag: 'tool-bar',\n styleSpec: {\n ':host': { // note that ':host' will be turned into the tagName automatically!\n display: 'flex',\n padding: 'var(--toolbar-padding, 0 8px)',\n gap: '4px'\n }\n }\n })\n\nThis will—assuming \"tool-bar\" is available—create:\n\n <style id=\"tool-bar-helper\">\n tool-bar {\n display: flex;\n padding: var(--toolbar-padding, 0 8px);\n gap: 4px;\n }\n <style>\n\nAnd append it to `document.head` when the first instance of `<tool-bar>` is inserted in the DOM.\n\nFinally, `elementCreator` is memoized and only generated once (and the arguments are\nignored on all subsequent calls).\n\n## Examples\n\n[xinjs-ui](https://ui.xinjs.net) is a component library built using this `Component` class\nthat provides the essential additions to standard HTML elements needed to build many\nuser-interfaces.\n\n- [xin-example](https://ui.xinjs.net/https://ui.xinjs.net/?live-example.ts) uses multiple named slots to implement\n powers the interactive examples used for this site.\n- [xin-sidebar](https://ui.xinjs.net/?side-nav.ts) implements the sidebar navigation\n used on this site.\n- [xin-table](https://ui.xinjs.net/?data-table.ts) implements virtualized tables\n with resizable, reorderable, sortable columns that can handle more data\n than you're probably willing to load.\n- [xin-form and xin-field](https://ui.xinjs.net/?form.ts) allow you to\n quickly create forms that leverage all the built-in functionality of `<input>`\n elements (including powerful validation) even for custom-fields.\n- [xin-md](https://ui.xinjs.net/?markdown-viewer.ts) uses `marked` to render\n markdown.\n- [xin-3d](https://ui.xinjs.net/?babylon-3d.ts) lets you easily embed 3d scenes\n in your application using [babylonjs](https://babylonjs.com/)\n*/\nimport { css } from './css'\nimport { XinStyleSheet } from './css-types'\nimport { deepClone } from './deep-clone'\nimport { appendContentToElement, dispatch, resizeObserver } from './dom'\nimport { elements, ElementsProxy } from './elements'\nimport { camelToKabob, kabobToCamel } from './string-case'\nimport { ElementCreator, ContentType, PartsMap } from './xin-types'\n\nlet anonymousElementCount = 0\n\nfunction anonElementTag(): string {\n return `custom-elt${(anonymousElementCount++).toString(36)}`\n}\nlet instanceCount = 0\n\ninterface ElementCreatorOptions extends ElementDefinitionOptions {\n tag?: string\n styleSpec?: XinStyleSheet\n}\n\nconst globalStyleSheets: {\n [key: string]: string\n} = {}\n\nfunction setGlobalStyle(tagName: string, styleSpec: XinStyleSheet) {\n const existing = globalStyleSheets[tagName]\n const processed = css(styleSpec).replace(/:host\\b/g, tagName)\n globalStyleSheets[tagName] = existing\n ? existing + '\\n' + processed\n : processed\n}\n\nfunction insertGlobalStyles(tagName: string) {\n if (globalStyleSheets[tagName]) {\n document.head.append(\n elements.style({ id: tagName + '-component' }, globalStyleSheets[tagName])\n )\n }\n delete globalStyleSheets[tagName]\n}\n\nexport abstract class Component<T = PartsMap> extends HTMLElement {\n static elements: ElementsProxy = elements\n private static _elementCreator?: ElementCreator<Component>\n instanceId: string\n styleNode?: HTMLStyleElement\n static styleSpec?: XinStyleSheet\n static styleNode?: HTMLStyleElement\n content: ContentType | (() => ContentType) | null = elements.slot()\n isSlotted?: boolean\n private static _tagName: null | string = null\n static get tagName(): null | string {\n return this._tagName\n }\n [key: string]: any\n\n static StyleNode(styleSpec: XinStyleSheet): HTMLStyleElement {\n console.warn(\n 'StyleNode is deprecated, just assign static styleSpec: XinStyleSheet to the class directly'\n )\n return elements.style(css(styleSpec))\n }\n\n static elementCreator<C = Component>(\n this: C,\n options: ElementCreatorOptions = {}\n ): ElementCreator<C> {\n const componentClass = this as Component\n if (componentClass._elementCreator == null) {\n const { tag, styleSpec } = options\n let tagName = options != null ? tag : null\n if (tagName == null) {\n if (\n typeof componentClass.name === 'string' &&\n componentClass.name !== ''\n ) {\n tagName = camelToKabob(componentClass.name)\n if (tagName.startsWith('-')) {\n tagName = tagName.slice(1)\n }\n } else {\n tagName = anonElementTag()\n }\n }\n if (customElements.get(tagName) != null) {\n console.warn(`${tagName} is already defined`)\n }\n if (tagName.match(/\\w+(-\\w+)+/) == null) {\n console.warn(`${tagName} is not a legal tag for a custom-element`)\n tagName = anonElementTag()\n }\n while (customElements.get(tagName) !== undefined) {\n tagName = anonElementTag()\n }\n componentClass._tagName = tagName\n if (styleSpec !== undefined) {\n setGlobalStyle(tagName, styleSpec)\n }\n window.customElements.define(\n tagName,\n this as unknown as CustomElementConstructor,\n options\n )\n componentClass._elementCreator = elements[tagName]\n }\n return componentClass._elementCreator\n }\n\n initAttributes(...attributeNames: string[]): void {\n const attributes: { [key: string]: any } = {}\n const attributeValues: { [key: string]: any } = {}\n const observer = new MutationObserver((mutationsList) => {\n let triggerRender = false\n mutationsList.forEach((mutation) => {\n triggerRender = !!(\n mutation.attributeName &&\n attributeNames.includes(kabobToCamel(mutation.attributeName))\n )\n })\n if (triggerRender && this.queueRender !== undefined)\n this.queueRender(false)\n })\n observer.observe(this, { attributes: true })\n attributeNames.forEach((attributeName) => {\n attributes[attributeName] = deepClone(this[attributeName])\n const attributeKabob = camelToKabob(attributeName)\n Object.defineProperty(this, attributeName, {\n enumerable: false,\n get() {\n if (typeof attributes[attributeName] === 'boolean') {\n return this.hasAttribute(attributeKabob)\n } else {\n if (this.hasAttribute(attributeKabob)) {\n return typeof attributes[attributeName] === 'number'\n ? parseFloat(this.getAttribute(attributeKabob))\n : this.getAttribute(attributeKabob)\n } else if (attributeValues[attributeName] !== undefined) {\n return attributeValues[attributeName]\n } else {\n return attributes[attributeName]\n }\n }\n },\n set(value) {\n if (typeof attributes[attributeName] === 'boolean') {\n if (value !== this[attributeName]) {\n if (value) {\n this.setAttribute(attributeKabob, '')\n } else {\n this.removeAttribute(attributeKabob)\n }\n this.queueRender()\n }\n } else if (typeof attributes[attributeName] === 'number') {\n if (value !== parseFloat(this[attributeName])) {\n this.setAttribute(attributeKabob, value)\n this.queueRender()\n }\n } else {\n if (\n typeof value === 'object' ||\n `${value as string}` !== `${this[attributeName] as string}`\n ) {\n if (\n value === null ||\n value === undefined ||\n typeof value === 'object'\n ) {\n this.removeAttribute(attributeKabob)\n } else {\n this.setAttribute(attributeKabob, value)\n }\n this.queueRender()\n attributeValues[attributeName] = value\n }\n }\n },\n })\n })\n }\n\n private initValue(): void {\n const valueDescriptor = Object.getOwnPropertyDescriptor(this, 'value')\n if (\n valueDescriptor === undefined ||\n valueDescriptor.get !== undefined ||\n valueDescriptor.set !== undefined\n ) {\n return\n }\n let value = this.hasAttribute('value')\n ? this.getAttribute('value')\n : deepClone(this.value)\n delete this.value\n Object.defineProperty(this, 'value', {\n enumerable: false,\n get() {\n return value\n },\n set(newValue: any) {\n if (value !== newValue) {\n value = newValue\n this.queueRender(true)\n }\n },\n })\n }\n\n private _parts?: T\n get parts(): T {\n const root = this.shadowRoot != null ? this.shadowRoot : this\n if (this._parts == null) {\n this._parts = new Proxy(\n {},\n {\n get(target: any, ref: string) {\n if (target[ref] === undefined) {\n let element = root.querySelector(`[part=\"${ref}\"]`)\n if (element == null) {\n element = root.querySelector(ref)\n }\n if (element == null)\n throw new Error(`elementRef \"${ref}\" does not exist!`)\n element.removeAttribute('data-ref')\n target[ref] = element as Element\n }\n return target[ref]\n },\n }\n ) as T\n }\n return this._parts\n }\n\n constructor() {\n super()\n instanceCount += 1\n this.initAttributes('hidden')\n this.instanceId = `${this.tagName.toLocaleLowerCase()}-${instanceCount}`\n this._value = deepClone(this.defaultValue)\n }\n\n connectedCallback(): void {\n insertGlobalStyles((this.constructor as unknown as Component).tagName)\n this.hydrate()\n // super annoyingly, chrome loses its shit if you set *any* attributes in the constructor\n if (this.role != null) this.setAttribute('role', this.role)\n if (this.onResize !== undefined) {\n resizeObserver.observe(this)\n if (this._onResize == null) {\n this._onResize = this.onResize.bind(this)\n }\n this.addEventListener('resize', this._onResize)\n }\n if (this.value != null && this.getAttribute('value') != null) {\n this._value = this.getAttribute('value')\n }\n this.queueRender()\n }\n\n disconnectedCallback(): void {\n resizeObserver.unobserve(this)\n }\n\n private _changeQueued = false\n private _renderQueued = false\n queueRender(triggerChangeEvent = false): void {\n if (!this._hydrated) return\n if (!this._changeQueued) this._changeQueued = triggerChangeEvent\n if (!this._renderQueued) {\n this._renderQueued = true\n requestAnimationFrame(() => {\n // TODO add mechanism to allow component developer to have more control over\n // whether input vs. change events are emitted\n if (this._changeQueued) dispatch(this, 'change')\n this._changeQueued = false\n this._renderQueued = false\n this.render()\n })\n }\n }\n\n private _hydrated = false\n private hydrate(): void {\n if (!this._hydrated) {\n this.initValue()\n const cloneElements = typeof this.content !== 'function'\n const _content: ContentType | null =\n typeof this.content === 'function' ? this.content() : this.content\n\n const { styleSpec } = this.constructor as unknown as Component\n let { styleNode } = this.constructor as unknown as Component\n if (styleSpec) {\n styleNode = (this.constructor as unknown as Component).styleNode =\n elements.style(css(styleSpec))\n delete (this.constructor as unknown as Component).styleNode\n }\n if (this.styleNode) {\n console.warn(\n this,\n 'styleNode is deprecrated, use static styleNode or statc styleSpec instead'\n )\n styleNode = this.styleNode\n }\n if (styleNode) {\n const shadow = this.attachShadow({ mode: 'open' })\n shadow.appendChild(styleNode.cloneNode(true))\n appendContentToElement(shadow, _content, cloneElements)\n } else if (_content !== null) {\n const existingChildren = Array.from(this.childNodes)\n appendContentToElement(this as HTMLElement, _content, cloneElements)\n this.isSlotted = this.querySelector('slot,xin-slot') !== undefined\n const slots = Array.from(this.querySelectorAll('slot'))\n if (slots.length > 0) {\n slots.forEach(XinSlot.replaceSlot)\n }\n if (existingChildren.length > 0) {\n const slotMap: { [key: string]: Element } = { '': this }\n Array.from(this.querySelectorAll('xin-slot')).forEach((slot) => {\n slotMap[(slot as XinSlot).name] = slot\n })\n existingChildren.forEach((child) => {\n const defaultSlot = slotMap['']\n const destSlot =\n child instanceof Element ? slotMap[child.slot] : defaultSlot\n ;(destSlot !== undefined ? destSlot : defaultSlot).append(child)\n })\n }\n }\n this._hydrated = true\n }\n }\n\n render(): void {}\n}\n\ninterface SlotParts extends PartsMap {\n slotty: HTMLSlotElement\n}\n\nclass XinSlot extends Component<SlotParts> {\n name = ''\n content = null\n\n static replaceSlot(slot: HTMLSlotElement): void {\n const _slot = document.createElement('xin-slot')\n if (slot.name !== '') {\n _slot.setAttribute('name', slot.name)\n }\n slot.replaceWith(_slot)\n }\n\n constructor() {\n super()\n this.initAttributes('name')\n }\n}\n\nexport const xinSlot = XinSlot.elementCreator({ tag: 'xin-slot' })\n",
24
24
  "/*#\n# A.3 hotReload\n\n`hotReload()` persists any root-level paths in `xin` that its test function evaluates as true\nto `localStorage`.\n\n```\nhotReload(test: PathTestFunction = () => true): void\n```\n*/\nimport { xin, observe } from './xin'\nimport { xinValue } from './metadata'\nimport {\n XinObject,\n PathTestFunction,\n ObserverCallbackFunction,\n} from './xin-types'\nimport { debounce } from './throttle'\n\n// TODO reimplement using IndexedDB\n\nexport const hotReload = (test: PathTestFunction = () => true): void => {\n const savedState = localStorage.getItem('xin-state')\n if (savedState != null) {\n const state = JSON.parse(savedState)\n for (const key of Object.keys(state).filter(test)) {\n if (xin[key] !== undefined) {\n Object.assign(xin[key], state[key])\n } else {\n xin[key] = state[key]\n }\n }\n }\n\n const saveState = debounce(() => {\n const obj: XinObject = {}\n const state = xinValue(xin)\n for (const key of Object.keys(state).filter(test)) {\n obj[key] = state[key]\n }\n localStorage.setItem('xin-state', JSON.stringify(obj))\n console.log('xin state saved to localStorage')\n }, 500)\n\n observe(test, saveState as ObserverCallbackFunction)\n}\n",
25
- "export const version = '1.0.6'",
26
- "/*#\n# 1.1 tosi, boxedProxy, and xinProxy\n\n> This documentation is mainly here for explanatory purposes. Just use `tosi()`\n> as described in section 1.\n\nThe key to managing application state with `xinjs` is the `xin` proxy object\n(and `boxed`). These are documented [here](/?xin.ts).\n\n## `xinProxy()` and `tosi()`\n\n> `tosi()` was formerly called `boxedProxy()`.\n\nAfter coding with `xin` for a while, it became apparent that a common pattern\nwas something like this:\n\n import myThing as _myThing from 'path/to/my-thing'\n import { xin } from 'xinjs'\n\n xin.myThing = _myThing\n export const myThing = xin.myThing as typeof _myThing\n\nNow we can use the new `myThing` in a pretty intuitive way, leverage autocomplete\nmost of the time, and it's all pretty nice.\n\nAnd because `myThing.path.to.something` is actually a `XinProxy` we can actually\nbind to it directly. So instead of typing (or mis-typing):\n\n customElement({bindValue: 'mything.path.to.something'}))\n\nWe can type the following and even use autocomplete:\n\n customElement({bindValue: mything.path.to.something}))\n\nThis gets you:\n\n const { myThing } = xinProxy({ myThing: ... })\n\nAnd after working with that for a while, the question became, what if we could\nleverage autocomplete even for non-object properties?\n\nThis gets us to:\n\n const { myThing } = boxedProxy({ myThing: ... })\n\n…(and also `boxed`).\n\n`boxed` and `boxedProxy` deliver a proxy wrapped around an object wrapped around\nthe original `string`, `boolean`, or `number`. This gets you autocomplete and\nstrong typing in general, at the cost of slight annoyances (e.g. having to write\n`myThing.path.to.string.valueOf() === 'some value'`). That's the tradeoff. In\npractice it's really very nice.\n\n`xinProxy(foo)` is simply declared as a function that takes an object of type T and\nreturns a BoxedProxy<T>.\n\n import { xinProxy } from 'xinjs'\n\n const { foo, bar } = boxedProxy({\n foo: 'bar',\n bar: {\n director: 'luhrmann'\n }\n })\n\nThis is syntax sugar for:\n\n import { boxed } from 'xinjs'\n\n const stuff = {\n foo: 'bar',\n bar: {\n director: 'luhrmann',\n born: 1962\n }\n }\n\n Object.assign(boxed, stuff)\n\n const { foo, bar } = boxed as XinProxy<typeof stuff>\n\nSo, Typescript will know that `foo` is a `string` and `bar` is a `XinProxy<typeof stuff.bar>`.\n\nNow, `boxedProxy` is the same except replace `XinProxy` with `BoxedProxy` and\nnow Typescript will know that `foo` is a `BoxedProxy<string>`, `bar` is a `BoxedProxy<typeof stuff.bar>`\nand `bar.born` is a `BoxedProxy<number>`.\n\nThis lets you write bindings that support autocomplete and lint. Yay!\n*/\nimport { XinProxy, BoxedProxy } from './xin-types'\nimport { xin, boxed } from './xin'\n\nexport function tosi<T extends object>(obj: T): BoxedProxy<T> {\n Object.assign(boxed, obj)\n return boxed as BoxedProxy<T>\n}\n\nexport function boxedProxy<T extends object>(obj: T): BoxedProxy<T> {\n console.warn('boxedProxy is deprecated, please use tosi() instead')\n return tosi(obj)\n}\n\nexport function xinProxy<T extends object>(obj: T, boxed = false): XinProxy<T> {\n if (boxed) {\n console.warn(`xinProxy(..., true) is deprecated; use tosi(...) instead`)\n // @ts-expect-error deprecated\n return boxedProxy(obj)\n }\n Object.keys(obj).forEach((key: string) => {\n xin[key] = (obj as { [key: string]: any })[key]\n })\n return xin as XinProxy<T>\n}\n",
27
- "/*#\n# 4.2 makeComponent\n\n`makeComponent(tag: string, bluePrint: XinBlueprint<T>): Promise<XinComponentSpec<T>>`\nhydrates [blueprints](/?blueprint-loader.ts) into usable [web-component](./?component.ts)s.\n\nHere are the relevant interfaces:\n\n```\nexport interface PartsMap<T = Element> {\n [key: string]: T\n}\n\nexport type XinBlueprint<T = PartsMap> = (\n tag: string,\n module: XinFactory\n) => XinComponentSpec<T> | Promise<XinComponentSpec<T>>\n\nexport interface XinComponentSpec<T = PartsMap> {\n type: Component<T>\n styleSpec?: XinStyleSheet\n}\n```\n\nNote that a crucial benefit of blueprints is that the **consumer** of the blueprint gets\nto choose the `tagName` of the custom-element. (Of course with react you can choose\nthe virtualDOM representation, but this often doesn't give you much of a clue where\nthe corresponding code is by looking at the DOM or even the React component panel.\n*/\n\nimport { Color } from './color'\nimport { Component } from './component'\nimport { vars, varDefault } from './css'\nimport { XinStyleSheet } from './css-types'\nimport { bind, on } from './bind'\nimport { elements, svgElements, mathML } from './elements'\nimport { ElementCreator, PartsMap } from './xin-types'\nimport { version } from './version'\nimport { xin, boxed } from './xin'\nimport { xinProxy, boxedProxy } from './xin-proxy'\n\nexport interface XinFactory {\n Color: typeof Color\n Component: typeof Component\n elements: typeof elements\n svgElements: typeof svgElements\n mathML: typeof mathML\n vars: typeof vars\n varDefault: typeof varDefault\n xin: typeof xin\n boxed: typeof boxed\n xinProxy: typeof xinProxy\n boxedProxy: typeof boxedProxy\n makeComponent: typeof makeComponent\n bind: typeof bind\n on: typeof on\n version: string\n}\n\nexport interface XinComponentSpec<T = PartsMap> {\n type: Component<T>\n styleSpec?: XinStyleSheet\n}\n\nexport interface XinPackagedComponent<T = PartsMap> {\n type: Component<T>\n creator: ElementCreator\n}\n\nexport const madeComponents: { [key: string]: XinPackagedComponent<any> } = {}\n\nexport type XinBlueprint<T = PartsMap> = (\n tag: string,\n module: XinFactory\n) => XinComponentSpec<T> | Promise<XinComponentSpec<T>>\n\nexport async function makeComponent<T = PartsMap>(\n tag: string,\n blueprint: XinBlueprint<T>\n): Promise<XinPackagedComponent<T>> {\n const { type, styleSpec } = (await blueprint(tag, {\n Color,\n Component,\n elements,\n svgElements,\n mathML,\n varDefault,\n vars,\n xin,\n boxed,\n xinProxy,\n boxedProxy,\n makeComponent,\n bind,\n on,\n version,\n })) as XinComponentSpec<T>\n const packagedComponent = {\n type,\n creator: type.elementCreator({ tag, styleSpec }),\n }\n\n madeComponents[tag] = packagedComponent\n return packagedComponent\n}\n",
28
- "/*#\n# 4.1 blueprints\n\nOne issue with standard web-components built with xinjs is that building them\n\"sucks in\" the version of `xinjs` you're working with. This isn't a huge problem\nwith monolithic code-bases, but it does prevent components from being loaded\n\"on-the-fly\" from CDNs and composed on the spot and it does make it hard to\n\"tree shake\" component libraries.\n\n```js\nimport { elements, blueprintLoader, blueprint } from 'tosijs'\n\npreview.append(\n blueprintLoader(\n blueprint({\n tag: 'swiss-clock',\n src: 'https://tonioloewald.github.io/xin-clock/dist/blueprint.js?1234',\n blueprintLoaded({creator}) {\n preview.append(creator())\n }\n }),\n )\n)\n```\n\nAnother issue is name-collision. What if two people create a `<tab-selector>` component\nand you want to use both of them? Or you want to switch to a new and better one but\ndon't want to do it everywhere all at once?\n\nWith blueprints, the *consumer* of the component chooses the `tag`, reducing the\nchance of name-collision. (You can consume the same blueprint multiple times,\ngiving each one its own tag.)\n\nTo address these issues, `xinjs` provides a `<xin-loader>` loader component and\na function `makeComponent` that can define a component given a blueprint\nfunction.\n\n## `<xin-loader>`—the blueprint loader\n\n`<xin-loader>` is a simple custom-element provided by `xinjs` for the dynamic loading\nof component **blueprints**. It will load its `<xin-blueprint>`s in parallel.\n\n```\n<xin-loader>\n <xin-blueprint tag=\"swiss-clock\" src=\"https://loewald.com/lib/swiss-clock\"></xin-blueprint>\n</xin-loader>\n<swiss-clock>\n <code style=\"color: var(--brand-color)\">xinjs</code> rules!\n</swiss-clock>\n```\n\n### `<xin-blueprint>` Attributes\n\n- `src` is the url of the `blueprint` javascript module (required)\n- `tag` is the tagName you wish to use. This defaults to the name of the source file if suitable.\n- `property` allows you to load a named exported property from a blueprint module\n (allowing one blueprint to export multiple blueprints). By default, it's `default`.\n- `loaded` is the `XinPackagedComponent` after loading\n\n#### `<xin-blueprint>` Properties\n\n- `blueprintLoaded(package: XinPackagedComponent)` `<xin-blueprint>` when its blueprint is loaded.\n\n#### `<xin-loader>` Properties\n\n- `allLoaded()` is called when all the blueprints have loaded.\n\n## `makeComponent(tag: string, blueprint: XinBlueprint): Promise<XinPackagedCompoent>`\n\n`makeComponent` takes a `tag` of your choice and a `blueprint` and generates\nthe custom-element's `class` and `elementCreator` as its `type` and `creator`\nproperties.\n\nSo, instead of:\n\n import {myThing} from './path/to/my-thing'\n\n document.body.append(myThing())\n\nYou could write:\n\n import { makeComponent } from 'xinjs'\n import myThingBlueprint from './path/to/my-thing-blueprint'\n\n makeComponent('different-tag', myThingBlueprint).then((packaged) => {\n document.body.append(packaged.creator())\n })\n\nThis is a more complex example that loads two components and only generates\nthe test component once everything is ready:\n\n```js\nimport { blueprintLoader, blueprint } from 'tosijs'\n\nlet clockType = null\n\npreview.append(\n blueprintLoader(\n {\n allLoaded() {\n const xinTest = this.querySelector('[tag=\"xin-test\"]').loaded.creator\n preview.append(\n xinTest({\n description: `${clockType.tagName} registered`,\n test() {\n return (\n preview.querySelector(clockType.tagName) && preview.querySelector(clockType.tagName).constructor !==\n HTMLElement\n )\n },\n })\n )\n },\n },\n blueprint({\n tag: 'swiss-clock',\n src: 'https://tonioloewald.github.io/xin-clock/dist/blueprint.js?1234',\n blueprintLoaded({type, creator}) {\n clockType = type\n preview.append(creator())\n },\n }),\n blueprint({\n tag: 'xin-test',\n src: 'https://tonioloewald.github.io/xin-test/dist/blueprint.js',\n })\n )\n)\n```\n\n## `XinBlueprint`\n\n export interface XinFactory {\n Color: typeof Color\n Component: typeof Component\n elements: typeof elements\n svgElements: typeof svgElements\n mathML: typeof mathML\n vars: typeof vars\n varDefault: typeof varDefault\n xin: typeof xin\n boxed: typeof boxed\n xinProxy: typeof xinProxy\n boxedProxy: typeof boxedProxy\n makeComponent: typeof makeComponent\n bind: typeof bind\n on: typeof on\n version: string\n }\n\n export interface XinPackagedComponent {\n type: typeof Component\n creator: ElementCreator\n }\n\n export type XinBlueprint = (\n tag: string,\n module: XinFactory\n ) => XinPackagedComponent\n\n`XinBlueprint` lets you provide a component \"blueprint\", in the form of a function,\nthat can be loaded and turned into an actual component. The beauty of this is that\nunlike an actual component, the blueprint has no special dependencies.\n\nSo instead of defining a component like this:\n\n import { Component, elements, vars, varDefault } from 'xinjs'\n\n const { h2, slot } = elements\n\n export class MyThing extends Component {\n static styleSpec = {\n ':host': {\n color: varDefault.textColor('#222'),\n background: vars.bgColor,\n },\n\n content = () => [\n h2('my thing'),\n slot()\n ]\n }\n }\n\n export const myThing = myThing.elementCreator({\n tag: 'my-thing',\n styleSpec: {\n _bgColor: '#f00'\n }\n })\n\nYou can define a \"blueprint\" like this:\n\n import { XinBlueprint } from 'xinjs'\n\n const blueprint: XinBlueprint = (\n tag,\n { Component, elements, vars, varDefault }\n ) => {\n const {h2, slot} = elements\n\n class MyThing extends Component {\n static styleSpec = {\n ':host': {\n color: varDefault.textColor('#222'),\n background: vars.bgColor,\n },\n\n content = () => [\n h2('my thing'),\n slot()\n ]\n }\n }\n\n return {\n type: MyThing,\n styleSpec: {\n _bgColor: '#f00'\n }\n }\n }\n\nThe blueprint function can be `async`, so you can use async import inside it to pull in dependencies.\n\n> **Note** that in this example the blueprint is a *pure* function (i.e. it has no side-effects).\n> If this blueprint is consumed twice, each will be completely independent. A non-pure blueprint\n> could be implemented such that the different versions of the blueprint share information.\n> E.g. you could maintain a list of all the instances of any version of the blueprint.\n\n*/\n\nimport { Component } from './component'\nimport {\n makeComponent,\n XinBlueprint,\n XinPackagedComponent,\n} from './make-component'\n\nconst loadedBlueprints: { [key: string]: Promise<XinPackagedComponent> } = {}\n\n// unfortunately this is needed to avoid webpack and similar bundlers from\n// rewriting the import call or getting confused by it.\nconst loadModule = (src: string): Promise<any> => eval(`import('${src}')`)\n\nexport class Blueprint extends Component {\n tag = 'anon-elt'\n src = ''\n property = 'default'\n loaded?: XinPackagedComponent\n blueprintLoaded = (_package: XinPackagedComponent) => {}\n\n async packaged(): Promise<XinPackagedComponent> {\n const { tag, src, property } = this\n const signature = `${tag}.${property}:${src}`\n if (!this.loaded) {\n if (loadedBlueprints[signature] === undefined) {\n loadedBlueprints[signature] = loadModule(src).then((imported) => {\n const blueprint = imported[property] as XinBlueprint\n return makeComponent(tag, blueprint)\n })\n } else {\n console.log(`using cached ${tag} with signature ${signature}`)\n }\n this.loaded = await loadedBlueprints[signature]\n this.blueprintLoaded(this.loaded)\n }\n return this.loaded!\n }\n\n constructor() {\n super()\n\n this.initAttributes('tag', 'src', 'property')\n }\n}\n\nexport const blueprint = Blueprint.elementCreator({\n tag: 'xin-blueprint',\n styleSpec: { ':host': { display: 'none' } },\n})\n\nexport class BlueprintLoader extends Component {\n allLoaded = () => {}\n\n constructor() {\n super()\n }\n\n private async load() {\n const blueprintElements = (\n Array.from(\n this.querySelectorAll(Blueprint.tagName as string)\n ) as Blueprint[]\n ).filter((elt) => elt.src)\n const promises = blueprintElements.map((elt) => elt.packaged())\n await Promise.all(promises)\n this.allLoaded()\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.load()\n }\n}\n\nexport const blueprintLoader = BlueprintLoader.elementCreator({\n tag: 'xin-loader',\n styleSpec: { ':host': { display: 'none' } },\n})\n"
25
+ "export const version = '1.0.8'",
26
+ "/*#\n# 1.1 tosi, xin, and xinProxy\n\n> This documentation is mainly here for explanatory purposes. Just use `tosi()`\n> as described in section 1.\n\nThe key to managing application state with `xinjs` is the `xin` proxy object\n(and `boxed`). These are documented [here](/?xin.ts).\n\n## `xinProxy()` and `tosi()`\n\n> `tosi()` was formerly called `boxedProxy()`.\n\nAfter coding with `xin` for a while, it became apparent that a common pattern\nwas something like this:\n\n import myThing as _myThing from 'path/to/my-thing'\n import { xin } from 'xinjs'\n\n xin.myThing = _myThing\n export const myThing = xin.myThing as typeof _myThing\n\nNow we can use the new `myThing` in a pretty intuitive way, leverage autocomplete\nmost of the time, and it's all pretty nice.\n\nAnd because `myThing.path.to.something` is actually a `XinProxy` we can actually\nbind to it directly. So instead of typing (or mis-typing):\n\n customElement({bindValue: 'mything.path.to.something'}))\n\nWe can type the following and even use autocomplete:\n\n customElement({bindValue: mything.path.to.something}))\n\nThis gets you:\n\n const { myThing } = xinProxy({ myThing: ... })\n\nAnd after working with that for a while, the question became, what if we could\nleverage autocomplete even for non-object properties?\n\nThis gets us to:\n\n const { myThing } = boxedProxy({ myThing: ... })\n\n…(and also `boxed`).\n\n`boxed` and `boxedProxy` deliver a proxy wrapped around an object wrapped around\nthe original `string`, `boolean`, or `number`. This gets you autocomplete and\nstrong typing in general, at the cost of slight annoyances (e.g. having to write\n`myThing.path.to.string.valueOf() === 'some value'`). That's the tradeoff. In\npractice it's really very nice.\n\n`xinProxy(foo)` is simply declared as a function that takes an object of type T and\nreturns a BoxedProxy<T>.\n\n import { xinProxy } from 'xinjs'\n\n const { foo, bar } = boxedProxy({\n foo: 'bar',\n bar: {\n director: 'luhrmann'\n }\n })\n\nThis is syntax sugar for:\n\n import { boxed } from 'xinjs'\n\n const stuff = {\n foo: 'bar',\n bar: {\n director: 'luhrmann',\n born: 1962\n }\n }\n\n Object.assign(boxed, stuff)\n\n const { foo, bar } = boxed as XinProxy<typeof stuff>\n\nSo, Typescript will know that `foo` is a `string` and `bar` is a `XinProxy<typeof stuff.bar>`.\n\nNow, `boxedProxy` is the same except replace `XinProxy` with `BoxedProxy` and\nnow Typescript will know that `foo` is a `BoxedProxy<string>`, `bar` is a `BoxedProxy<typeof stuff.bar>`\nand `bar.born` is a `BoxedProxy<number>`.\n\nThis lets you write bindings that support autocomplete and lint. Yay!\n*/\nimport { XinProxy, BoxedProxy } from './xin-types'\nimport { xin, boxed } from './xin'\n\nexport function tosi<T extends object>(obj: T): BoxedProxy<T> {\n Object.assign(boxed, obj)\n return boxed as BoxedProxy<T>\n}\n\nexport function boxedProxy<T extends object>(obj: T): BoxedProxy<T> {\n console.warn('boxedProxy is deprecated, please use tosi() instead')\n return tosi(obj)\n}\n\nexport function xinProxy<T extends object>(obj: T, boxed = false): XinProxy<T> {\n if (boxed) {\n console.warn(`xinProxy(..., true) is deprecated; use tosi(...) instead`)\n // @ts-expect-error deprecated\n return boxedProxy(obj)\n }\n Object.keys(obj).forEach((key: string) => {\n xin[key] = (obj as { [key: string]: any })[key]\n })\n return xin as XinProxy<T>\n}\n",
27
+ "/*#\n# 4.2 makeComponent\n\n`makeComponent(tag: string, bluePrint: XinBlueprint<T>): Promise<XinComponentSpec<T>>`\nhydrates [blueprints](/?blueprint-loader.ts) into usable [web-components](./?component.ts).\n\nHere are the relevant interfaces:\n\n```\nexport interface PartsMap<T = Element> {\n [key: string]: T\n}\n\nexport type XinBlueprint<T = PartsMap> = (\n tag: string,\n module: XinFactory\n) => XinComponentSpec<T> | Promise<XinComponentSpec<T>>\n\nexport interface XinComponentSpec<T = PartsMap> {\n type: Component<T>\n styleSpec?: XinStyleSheet\n}\n```\n\nNote that a crucial benefit of blueprints is that the **consumer** of the blueprint gets\nto choose the `tagName` of the custom-element.\n*/\n\nimport { Color } from './color'\nimport { Component } from './component'\nimport { vars, varDefault } from './css'\nimport { XinStyleSheet } from './css-types'\nimport { bind, on } from './bind'\nimport { elements, svgElements, mathML } from './elements'\nimport { ElementCreator, PartsMap } from './xin-types'\nimport { version } from './version'\nimport { xin, boxed } from './xin'\nimport { xinProxy, boxedProxy } from './xin-proxy'\n\nexport interface XinFactory {\n Color: typeof Color\n Component: typeof Component\n elements: typeof elements\n svgElements: typeof svgElements\n mathML: typeof mathML\n vars: typeof vars\n varDefault: typeof varDefault\n xin: typeof xin\n boxed: typeof boxed\n xinProxy: typeof xinProxy\n boxedProxy: typeof boxedProxy\n makeComponent: typeof makeComponent\n bind: typeof bind\n on: typeof on\n version: string\n}\n\nexport interface XinComponentSpec<T = PartsMap> {\n type: Component<T>\n styleSpec?: XinStyleSheet\n}\n\nexport interface XinPackagedComponent<T = PartsMap> {\n type: Component<T>\n creator: ElementCreator\n}\n\nexport const madeComponents: { [key: string]: XinPackagedComponent<any> } = {}\n\nexport type XinBlueprint<T = PartsMap> = (\n tag: string,\n module: XinFactory\n) => XinComponentSpec<T> | Promise<XinComponentSpec<T>>\n\nexport async function makeComponent<T = PartsMap>(\n tag: string,\n blueprint: XinBlueprint<T>\n): Promise<XinPackagedComponent<T>> {\n const { type, styleSpec } = (await blueprint(tag, {\n Color,\n Component,\n elements,\n svgElements,\n mathML,\n varDefault,\n vars,\n xin,\n boxed,\n xinProxy,\n boxedProxy,\n makeComponent,\n bind,\n on,\n version,\n })) as XinComponentSpec<T>\n const packagedComponent = {\n type,\n creator: type.elementCreator({ tag, styleSpec }),\n }\n\n madeComponents[tag] = packagedComponent\n return packagedComponent\n}\n",
28
+ "/*#\n# 4.1 blueprints\n\nOne issue with standard web-components built with xinjs is that building them\n\"sucks in\" the version of `xinjs` you're working with. This isn't a huge problem\nwith monolithic code-bases, but it does prevent components from being loaded\n\"on-the-fly\" from CDNs and composed on the spot and it does make it hard to\n\"tree shake\" component libraries.\n\n```js\nimport { elements, blueprintLoader, blueprint } from 'tosijs'\n\npreview.append(\n blueprintLoader(\n blueprint({\n tag: 'swiss-clock',\n src: 'https://tonioloewald.github.io/xin-clock/dist/blueprint.js?1234',\n blueprintLoaded({creator}) {\n preview.append(creator())\n }\n }),\n )\n)\n```\n\nAnother issue is name-collision. What if two people create a `<tab-selector>` component\nand you want to use both of them? Or you want to switch to a new and better one but\ndon't want to do it everywhere all at once?\n\nWith blueprints, the *consumer* of the component chooses the `tag`, reducing the\nchance of name-collision. (You can consume the same blueprint multiple times,\ngiving each one its own tag.)\n\nTo address these issues, `xinjs` provides a `<xin-loader>` loader component and\na function `makeComponent` that can define a component given a blueprint\nfunction.\n\n## `<xin-loader>`—the blueprint loader\n\n`<xin-loader>` is a simple custom-element provided by `xinjs` for the dynamic loading\nof component **blueprints**. It will load its `<xin-blueprint>`s in parallel.\n\n```\n<xin-loader>\n <xin-blueprint tag=\"swiss-clock\" src=\"https://loewald.com/lib/swiss-clock\"></xin-blueprint>\n</xin-loader>\n<swiss-clock>\n <code style=\"color: var(--brand-color)\">xinjs</code> rules!\n</swiss-clock>\n```\n\n### `<xin-blueprint>` Attributes\n\n- `src` is the url of the `blueprint` javascript module (required)\n- `tag` is the tagName you wish to use. This defaults to the name of the source file if suitable.\n- `property` allows you to load a named exported property from a blueprint module\n (allowing one blueprint to export multiple blueprints). By default, it's `default`.\n- `loaded` is the `XinPackagedComponent` after loading\n\n#### `<xin-blueprint>` Properties\n\n- `blueprintLoaded(package: XinPackagedComponent)` `<xin-blueprint>` when its blueprint is loaded.\n\n#### `<xin-loader>` Properties\n\n- `allLoaded()` is called when all the blueprints have loaded.\n\n## `makeComponent(tag: string, blueprint: XinBlueprint): Promise<XinPackagedCompoent>`\n\n`makeComponent` takes a `tag` of your choice and a `blueprint` and generates\nthe custom-element's `class` and `elementCreator` as its `type` and `creator`\nproperties.\n\nSo, instead of:\n\n import {myThing} from './path/to/my-thing'\n\n document.body.append(myThing())\n\nYou could write:\n\n import { makeComponent } from 'xinjs'\n import myThingBlueprint from './path/to/my-thing-blueprint'\n\n makeComponent('different-tag', myThingBlueprint).then((packaged) => {\n document.body.append(packaged.creator())\n })\n\nThis is a more complex example that loads two components and only generates\nthe test component once everything is ready:\n\n```js\nimport { blueprintLoader, blueprint } from 'tosijs'\n\nlet clockType = null\n\npreview.append(\n blueprintLoader(\n {\n allLoaded() {\n const xinTest = this.querySelector('[tag=\"xin-test\"]').loaded.creator\n preview.append(\n xinTest({\n description: `${clockType.tagName} registered`,\n test() {\n return (\n preview.querySelector(clockType.tagName) && preview.querySelector(clockType.tagName).constructor !==\n HTMLElement\n )\n },\n })\n )\n },\n },\n blueprint({\n tag: 'swiss-clock',\n src: 'https://tonioloewald.github.io/xin-clock/dist/blueprint.js?1234',\n blueprintLoaded({type, creator}) {\n clockType = type\n preview.append(creator())\n },\n }),\n blueprint({\n tag: 'xin-test',\n src: 'https://tonioloewald.github.io/xin-test/dist/blueprint.js',\n })\n )\n)\n```\n\n## `XinBlueprint`\n\n export interface XinFactory {\n Color: typeof Color\n Component: typeof Component\n elements: typeof elements\n svgElements: typeof svgElements\n mathML: typeof mathML\n vars: typeof vars\n varDefault: typeof varDefault\n xin: typeof xin\n boxed: typeof boxed\n xinProxy: typeof xinProxy\n boxedProxy: typeof boxedProxy\n makeComponent: typeof makeComponent\n bind: typeof bind\n on: typeof on\n version: string\n }\n\n export interface XinPackagedComponent {\n type: typeof Component\n creator: ElementCreator\n }\n\n export type XinBlueprint = (\n tag: string,\n module: XinFactory\n ) => XinPackagedComponent\n\n`XinBlueprint` lets you provide a component \"blueprint\", in the form of a function,\nthat can be loaded and turned into an actual component. The beauty of this is that\nunlike an actual component, the blueprint has no special dependencies.\n\nSo instead of defining a component like this:\n\n import { Component, elements, vars, varDefault } from 'xinjs'\n\n const { h2, slot } = elements\n\n export class MyThing extends Component {\n static styleSpec = {\n ':host': {\n color: varDefault.textColor('#222'),\n background: vars.bgColor,\n },\n\n content = () => [\n h2('my thing'),\n slot()\n ]\n }\n }\n\n export const myThing = myThing.elementCreator({\n tag: 'my-thing',\n styleSpec: {\n _bgColor: '#f00'\n }\n })\n\nYou can define a \"blueprint\" like this:\n\n import { XinBlueprint } from 'xinjs'\n\n const blueprint: XinBlueprint = (\n tag,\n { Component, elements, vars, varDefault }\n ) => {\n const {h2, slot} = elements\n\n class MyThing extends Component {\n static styleSpec = {\n ':host': {\n color: varDefault.textColor('#222'),\n background: vars.bgColor,\n },\n\n content = () => [\n h2('my thing'),\n slot()\n ]\n }\n }\n\n return {\n type: MyThing,\n styleSpec: {\n _bgColor: '#f00'\n }\n }\n }\n\nThe blueprint function can be `async`, so you can use async import inside it to pull in dependencies.\n\n> **Note** that in this example the blueprint is a *pure* function (i.e. it has no side-effects).\n> If this blueprint is consumed twice, each will be completely independent. A non-pure blueprint\n> could be implemented such that the different versions of the blueprint share information.\n> E.g. you could maintain a list of all the instances of any version of the blueprint.\n\n*/\n\nimport { Component } from './component'\nimport {\n makeComponent,\n XinBlueprint,\n XinPackagedComponent,\n} from './make-component'\n\nconst loadedBlueprints: { [key: string]: Promise<XinPackagedComponent> } = {}\n\nconst loadModule = (src: string): Promise<any> => import(src)\n\nexport class Blueprint extends Component {\n tag = 'anon-elt'\n src = ''\n property = 'default'\n loaded?: XinPackagedComponent\n blueprintLoaded = (_package: XinPackagedComponent) => {}\n\n async packaged(): Promise<XinPackagedComponent> {\n const { tag, src, property } = this\n const signature = `${tag}.${property}:${src}`\n if (!this.loaded) {\n if (loadedBlueprints[signature] === undefined) {\n loadedBlueprints[signature] = loadModule(src).then((imported) => {\n const blueprint = imported[property] as XinBlueprint\n return makeComponent(tag, blueprint)\n })\n } else {\n console.log(`using cached ${tag} with signature ${signature}`)\n }\n this.loaded = await loadedBlueprints[signature]\n this.blueprintLoaded(this.loaded)\n }\n return this.loaded!\n }\n\n constructor() {\n super()\n\n this.initAttributes('tag', 'src', 'property')\n }\n}\n\nexport const blueprint = Blueprint.elementCreator({\n tag: 'xin-blueprint',\n styleSpec: { ':host': { display: 'none' } },\n})\n\nexport class BlueprintLoader extends Component {\n allLoaded = () => {}\n\n constructor() {\n super()\n }\n\n private async load() {\n const blueprintElements = (\n Array.from(\n this.querySelectorAll(Blueprint.tagName as string)\n ) as Blueprint[]\n ).filter((elt) => elt.src)\n const promises = blueprintElements.map((elt) => elt.packaged())\n await Promise.all(promises)\n this.allLoaded()\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.load()\n }\n}\n\nexport const blueprintLoader = BlueprintLoader.elementCreator({\n tag: 'xin-loader',\n styleSpec: { ':host': { display: 'none' } },\n})\n"
29
29
  ],
30
- "mappings": "qmCAAO,IAAM,EAAW,CACtB,MAAO,GACP,KAAM,EACR,ECEO,SAAS,CAAS,CAAC,EAAyC,CACjE,GAAI,GAAO,MAAQ,OAAO,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