This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

25
node_modules/riot/LICENSE.txt generated vendored Normal file
View File

@@ -0,0 +1,25 @@
The MIT License (MIT)
Copyright (c) 2015-present
Originally created by Muut Inc.
Actively maintained by:
- Gianluca Guarini https://github.com/GianlucaGuarini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

258
node_modules/riot/README.md generated vendored Normal file
View File

@@ -0,0 +1,258 @@
[![Riot logo](https://riot.js.org/img/logo/riot-logo.svg)](https://riot.js.org)
## Simple and elegant component-based UI library
[![Build Status][ci-image]][ci-url]
[![MIT License][license-image]][license-url]
[![Join the discord community channel][discord-image]][discord-url]
[![Join the chat (ja) at https://riot-jp-slackin.herokuapp.com/][slack-ja-image]][slack-ja-url]
[![OpenCollective Backers][backer-badge]][backer-url] [![OpenCollective Sponsors][sponsor-badge]][sponsor-url]
[![NPM version][npm-version-image]][npm-url]
[![NPM downloads][npm-downloads-image]][npm-url]
[![jsDelivr Hits][jsdelivr-image]][jsdelivr-url]
[![Coverage Status][coverage-image]][coverage-url]
![Riot Size][lib-size]
[![Code Quality][codeclimate-image]][codeclimate-url]
[![Sauce Test Status][saucelabs-image]][saucelabs-url]
### Custom components • Concise syntax • Simple API • Tiny Size
Riot brings custom components to all modern browsers. It is designed to offer you everything you wished the native web components API provided.
#### Tag definition
```html
<timer>
<p>Seconds Elapsed: { state.time }</p>
<script>
export default {
tick() {
this.update({ time: ++this.state.time })
},
onBeforeMount(props) {
// create the component initial state
this.state = {
time: props.start
}
this.timer = setInterval(this.tick, 1000)
},
onUnmounted() {
clearInterval(this.timer)
}
}
</script>
</timer>
```
[Open this example on Plunker](https://riot.js.org/examples/plunker/?app=timer)
#### Mounting
```javascript
// mount the timer with its initial props
riot.mount('timer', { start: 0 })
```
#### Nesting
Custom components let you build complex views with HTML.
```html
<timetable>
<timer start="0"></timer>
<timer start="10"></timer>
<timer start="20"></timer>
</timetable>
```
HTML syntax is the de facto language on the web and it's designed for building user interfaces. The syntax is explicit, nesting is inherent to the language and attributes offer a clean way to provide options for custom tags.
### Performant and predictable
- Absolutely the smallest possible amount of DOM updates and reflows.
- Fast expressions bindings instead of virtual DOM memory performance issues and drawbacks.
- One way data flow: updates and unmounts are propagated downwards from parent to children.
- No "magic" or "smart" reactive properties or hooks
- Expressions are pre-compiled and cached for high performance.
- Lifecycle methods for more control.
### Close to standards
- No proprietary event system.
- Future proof thanks to the javascript module syntax.
- The rendered DOM can be freely manipulated with other tools.
- No extra HTML root elements, `data-` attributes or fancy custom attributes.
- No new syntax to learn.
- Plays well with any frontend framework.
### Use your dearest language and tools
- Create components with CoffeeScript, Jade, LiveScript, Typescript, ES6 or [any pre-processor](https://riot.js.org/compiler/#pre-processors) you want.
- Build with [@riotjs/cli](https://github.com/riot/cli), [webpack](https://github.com/riot/webpack-loader), [Rollup](https://github.com/riot/rollup-plugin-riot), [parcel](https://github.com/riot/parcel-plugin-riot), [Browserify](https://github.com/riot/riotify).
- Test however you like; you can [load your riot tags directly in node](https://github.com/riot/ssr#render---to-render-only-markup)
### Powerful and modular ecosystem
The Riot.js ecosystem is completely modular, it's designed to let you pick only the stuff you really need:
- [@riotjs/cli](https://github.com/riot/cli) - CLI to locally compile your tags to javascript
- [@riotjs/ssr](https://github.com/riot/ssr) - Super simple server side rendering
- [@riotjs/hydrate](https://github.com/riot/hydrate) - Hydration strategy for your SPA
- [@riotjs/route](https://github.com/riot/route) - Isomorphic router
- [@riotjs/lazy](https://github.com/riot/lazy) - Lazy components loader
- [@riotjs/hot-reload](https://github.com/riot/hot-reload) - Live reload plugin
- [@riotjs/compiler](https://github.com/riot/compiler) - Advanced tags compiler
- [@riotjs/parser](https://github.com/riot/parser) - HTML parser
- [@riotjs/dom-bindings](https://github.com/riot/dom-bindings) - Expressions based template engine
- [@riotjs/custom-elements](https://github.com/riot/custom-elements) - native custom elements implementation
### CDN hosting
- [unpkg](https://unpkg.com/riot/riot.js)
- [jsDelivr](https://www.jsdelivr.com/projects/riot)
- [cdnjs](https://cdnjs.com/libraries/riot)
### How to contribute
If you are reading this it's already a good sign and I am thankful for it! I try my best working as much as I can on riot but your help is always appreciated.
If you want to contribute to riot helping the project maintenance please check first the list of [open issues](https://github.com/riot/riot/issues) to understand whether there is a task where you could help.
Riot is mainly developed on UNIX systems so you will be able to run all the commands necessary to build and test the library using our [Makefile](Makefile). If you are on a Microsoft machine it could be harder to set up your development environment properly.
Following the steps below you should be able to properly submit your patch to the project
#### 1) Clone the repo and browse to the riot folder
```shell
$ git clone git@github.com:riot/riot.git && cd riot
```
#### 2) Set up your git branch
```shell
$ git checkout -b feature/my-awesome-patch
```
#### 3) Install the npm dependencies
```shell
$ npm i
```
#### 4) Build and test riot using the Makefile
```shell
# To build and test riot
$ make riot
# To build without testing
$ make raw
```
#### 5) Pull request only against the `dev` branch making sure you have read [our pull request template](.github/PULL_REQUEST_TEMPLATE.md)
#### 6) Be patient
### Credits
Riot is actively maintained with :heart: by:
<table>
<tbody>
<tr>
<td valign="top">
<img width="125" height="125" src="https://github.com/GianlucaGuarini.png?s=125?s=125">
<br>
<a href="https://github.com/GianlucaGuarini">Gianluca Guarini</a>
</td>
</tr>
</tbody>
</table>
Many thanks to all smart people from all over the world who helped improving it.
## Official Website
https://riot.js.org
## Backers
Support us with a monthly donation and help us continue our activities. [Become a backer][support-url]
[![Backers][backers-image]][support-url]
## Sponsors
Become a sponsor to get your logo on our README. [Become a sponsor][support-url]
[![Sponsors][sponsors-image]][support-url]
## Thanks
Special thanks to Browserstack and JetBrains for their support
<table cellpadding="8">
<tr>
<td>
<a href='https://www.jetbrains.com/?from=riotjs'>
<img width='70px' src="https://cdn.worldvectorlogo.com/logos/jetbrains-1.svg" alt="jetbrains">
</a>
</td>
<td>
<a href='https://www.browserstack.com/?from=riotjs'>
<img width='70px' src="https://cdn.worldvectorlogo.com/logos/browserstack.svg" alt="browser stack">
</a>
</td>
</tr>
</table>
[ci-image]:https://img.shields.io/github/workflow/status/riot/riot/test?style=flat-square
[ci-url]:https://github.com/riot/riot/actions
[license-image]:https://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
[license-url]:LICENSE.txt
[npm-version-image]:https://img.shields.io/npm/v/riot.svg?style=flat-square
[npm-downloads-image]:https://img.shields.io/npm/dm/riot.svg?style=flat-square
[npm-url]:https://npmjs.org/package/riot
[coverage-image]:https://img.shields.io/coveralls/riot/riot/dev.svg?style=flat-square
[coverage-url]:https://coveralls.io/r/riot/riot?branch=dev
[saucelabs-image]:https://saucelabs.com/browser-matrix/testsriotjs.svg?1
[saucelabs-url]:https://saucelabs.com/u/testsriotjs
[discord-url]:https://discord.gg/PagXe5Y
[discord-image]:https://img.shields.io/badge/DISCORD-JOIN_CHANNEL_%E2%86%92-7289da.svg?style=flat-square
[slack-ja-image]:https://img.shields.io/badge/SLACK_(ja)-JOIN_CHAT_%E2%86%92-551a8b.svg?style=flat-square
[slack-ja-url]:https://riot-jp-slackin.herokuapp.com/
[codeclimate-image]:https://api.codeclimate.com/v1/badges/b81ddf3c77e8189876da/maintainability
[codeclimate-url]:https://codeclimate.com/github/riot/riot
[donations-campaign-url]:https://pledgie.com/campaigns/31139
[donations-campaign-image]:https://pledgie.com/campaigns/31139.png?skin_name=chrome
[jsdelivr-image]: https://data.jsdelivr.com/v1/package/npm/riot/badge
[jsdelivr-url]: https://www.jsdelivr.com/package/npm/riot
[backer-url]: #backers
[backer-badge]: https://opencollective.com/riot/backers/badge.svg?color=blue
[sponsor-url]: #sponsors
[sponsor-badge]: https://opencollective.com/riot/sponsors/badge.svg?color=blue
[support-url]: https://opencollective.com/riot#support
[lib-size]: https://img.badgesize.io/https://unpkg.com/riot/riot.min.js?compression=gzip
[backers-image]: https://opencollective.com/riot/backers.svg
[sponsors-image]: https://opencollective.com/riot/sponsors.svg

21
node_modules/riot/esm/api/__.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
/* Riot WIP, @license MIT */
import { template, createBinding, createExpression, bindingTypes, expressionTypes } from '@riotjs/dom-bindings';
import { DOM_COMPONENT_INSTANCE_PROPERTY, PARENT_KEY_SYMBOL } from '@riotjs/util';
import cssManager from '../core/css-manager.js';
const __ = {
cssManager,
DOMBindings: {
template,
createBinding,
createExpression,
bindingTypes,
expressionTypes
},
globals: {
DOM_COMPONENT_INSTANCE_PROPERTY,
PARENT_KEY_SYMBOL
}
};
export { __ };

26
node_modules/riot/esm/api/component.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/* Riot WIP, @license MIT */
import compose from 'cumpa';
import { createComponentFromWrapper } from '../core/create-component-from-wrapper.js';
/**
* Helper method to create component without relying on the registered ones
* @param {Object} implementation - component implementation
* @returns {Function} function that will allow you to mount a riot component on a DOM node
*/
function component(implementation) {
return function (el, props, _temp) {
let {
slots,
attributes,
parentScope
} = _temp === void 0 ? {} : _temp;
return compose(c => c.mount(el, parentScope), c => c({
props,
slots,
attributes
}), createComponentFromWrapper)(implementation);
};
}
export { component };

17
node_modules/riot/esm/api/install.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/* Riot WIP, @license MIT */
import { isFunction, panic, PLUGINS_SET } from '@riotjs/util';
/**
* Define a riot plugin
* @param {Function} plugin - function that will receive all the components created
* @returns {Set} the set containing all the plugins installed
*/
function install(plugin) {
if (!isFunction(plugin)) panic('Plugins must be of type function');
if (PLUGINS_SET.has(plugin)) panic('This plugin was already installed');
PLUGINS_SET.add(plugin);
return PLUGINS_SET;
}
export { install };

17
node_modules/riot/esm/api/mount.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/* Riot WIP, @license MIT */
import $ from 'bianco.query';
import { mountComponent } from '../core/mount-component.js';
/**
* Mounting function that will work only for the components that were globally registered
* @param {string|HTMLElement} selector - query for the selection or a DOM element
* @param {Object} initialProps - the initial component properties
* @param {string} name - optional component name
* @returns {Array} list of riot components
*/
function mount(selector, initialProps, name) {
return $(selector).map(element => mountComponent(element, initialProps, name));
}
export { mount };

16
node_modules/riot/esm/api/pure.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/* Riot WIP, @license MIT */
import { isFunction, panic, IS_PURE_SYMBOL } from '@riotjs/util';
/**
* Lift a riot component Interface into a pure riot object
* @param {Function} func - RiotPureComponent factory function
* @returns {Function} the lifted original function received as argument
*/
function pure(func) {
if (!isFunction(func)) panic('riot.pure accepts only arguments of type "function"');
func[IS_PURE_SYMBOL] = true;
return func;
}
export { pure };

28
node_modules/riot/esm/api/register.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
/* Riot WIP, @license MIT */
import { COMPONENTS_IMPLEMENTATION_MAP, panic } from '@riotjs/util';
import { createComponentFromWrapper } from '../core/create-component-from-wrapper.js';
/**
* Register a custom tag by name
* @param {string} name - component name
* @param {Object} implementation - tag implementation
* @returns {Map} map containing all the components implementations
*/
function register(name, _ref) {
let {
css,
template,
exports
} = _ref;
if (COMPONENTS_IMPLEMENTATION_MAP.has(name)) panic(`The component "${name}" was already registered`);
COMPONENTS_IMPLEMENTATION_MAP.set(name, createComponentFromWrapper({
name,
css,
template,
exports
}));
return COMPONENTS_IMPLEMENTATION_MAP;
}
export { register };

16
node_modules/riot/esm/api/uninstall.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/* Riot WIP, @license MIT */
import { PLUGINS_SET, panic } from '@riotjs/util';
/**
* Uninstall a riot plugin
* @param {Function} plugin - plugin previously installed
* @returns {Set} the set containing all the plugins installed
*/
function uninstall(plugin) {
if (!PLUGINS_SET.has(plugin)) panic('This plugin was never installed');
PLUGINS_SET.delete(plugin);
return PLUGINS_SET;
}
export { uninstall };

22
node_modules/riot/esm/api/unmount.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/* Riot WIP, @license MIT */
import $ from 'bianco.query';
import { DOM_COMPONENT_INSTANCE_PROPERTY } from '@riotjs/util';
/**
* Sweet unmounting helper function for the DOM node mounted manually by the user
* @param {string|HTMLElement} selector - query for the selection or a DOM element
* @param {boolean|null} keepRootElement - if true keep the root element
* @returns {Array} list of nodes unmounted
*/
function unmount(selector, keepRootElement) {
return $(selector).map(element => {
if (element[DOM_COMPONENT_INSTANCE_PROPERTY]) {
element[DOM_COMPONENT_INSTANCE_PROPERTY].unmount(keepRootElement);
}
return element;
});
}
export { unmount };

18
node_modules/riot/esm/api/unregister.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/* Riot WIP, @license MIT */
import { COMPONENTS_IMPLEMENTATION_MAP, panic } from '@riotjs/util';
import cssManager from '../core/css-manager.js';
/**
* Unregister a riot web component
* @param {string} name - component name
* @returns {Map} map containing all the components implementations
*/
function unregister(name) {
if (!COMPONENTS_IMPLEMENTATION_MAP.has(name)) panic(`The component "${name}" was never registered`);
COMPONENTS_IMPLEMENTATION_MAP.delete(name);
cssManager.remove(name);
return COMPONENTS_IMPLEMENTATION_MAP;
}
export { unregister };

5
node_modules/riot/esm/api/version.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/* Riot WIP, @license MIT */
/** @type {string} current riot version */
const version = 'WIP';
export { version };

11
node_modules/riot/esm/api/with-types.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/* Riot WIP, @license MIT */
/**
* no-op function needed to add the proper types to your component via typescript
* @param {Function|Object} component - component default export
* @returns {Function|Object} returns exactly what it has received
*/
/* istanbul ignore next */
const withTypes = component => component;
export { withTypes };

19
node_modules/riot/esm/core/add-css-hook.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/* Riot WIP, @license MIT */
import { IS_DIRECTIVE } from '@riotjs/util';
import { getName } from '../utils/dom.js';
import { set } from 'bianco.attr';
/**
* Add eventually the "is" attribute to link this DOM node to its css
* @param {HTMLElement} element - target root node
* @param {string} name - name of the component mounted
* @returns {undefined} it's a void function
*/
function addCssHook(element, name) {
if (getName(element) !== name) {
set(element, IS_DIRECTIVE, name);
}
}
export { addCssHook };

View File

@@ -0,0 +1,13 @@
/* Riot WIP, @license MIT */
import { DOM_COMPONENT_INSTANCE_PROPERTY } from '@riotjs/util';
/**
* Bind a DOM node to its component object
* @param {HTMLElement} node - html node mounted
* @param {Object} component - Riot.js component object
* @returns {Object} the component object received as second argument
*/
const bindDOMNodeToComponentInstance = (node, component) => node[DOM_COMPONENT_INSTANCE_PROPERTY] = component;
export { bindDOMNodeToComponentInstance };

16
node_modules/riot/esm/core/component-dom-selectors.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/* Riot WIP, @license MIT */
import $ from 'bianco.query';
const COMPONENT_DOM_SELECTORS = Object.freeze({
// component helpers
$(selector) {
return $(selector, this.root)[0];
},
$$(selector) {
return $(selector, this.root);
}
});
export { COMPONENT_DOM_SELECTORS };

View File

@@ -0,0 +1,14 @@
/* Riot WIP, @license MIT */
import { SHOULD_UPDATE_KEY, noop, ON_BEFORE_MOUNT_KEY, ON_MOUNTED_KEY, ON_BEFORE_UPDATE_KEY, ON_UPDATED_KEY, ON_BEFORE_UNMOUNT_KEY, ON_UNMOUNTED_KEY } from '@riotjs/util';
const COMPONENT_LIFECYCLE_METHODS = Object.freeze({
[SHOULD_UPDATE_KEY]: noop,
[ON_BEFORE_MOUNT_KEY]: noop,
[ON_MOUNTED_KEY]: noop,
[ON_BEFORE_UPDATE_KEY]: noop,
[ON_UPDATED_KEY]: noop,
[ON_BEFORE_UNMOUNT_KEY]: noop,
[ON_UNMOUNTED_KEY]: noop
});
export { COMPONENT_LIFECYCLE_METHODS };

View File

@@ -0,0 +1,24 @@
/* Riot WIP, @license MIT */
import { template, expressionTypes, bindingTypes } from '@riotjs/dom-bindings';
import { COMPONENTS_IMPLEMENTATION_MAP } from '@riotjs/util';
import { createChildrenComponentsObject } from './create-children-components-object.js';
import { memoizedCreateComponentFromWrapper } from './create-component-from-wrapper.js';
/**
* Factory function to create the component templates only once
* @param {Function} template - component template creation function
* @param {RiotComponentWrapper} componentWrapper - riot compiler generated object
* @returns {TemplateChunk} template chunk object
*/
function componentTemplateFactory(template$1, componentWrapper) {
const components = createChildrenComponentsObject(componentWrapper.exports ? componentWrapper.exports.components : {});
return template$1(template, expressionTypes, bindingTypes, name => {
// improve support for recursive components
if (name === componentWrapper.name) return memoizedCreateComponentFromWrapper(componentWrapper); // return the registered components
return components[name] || COMPONENTS_IMPLEMENTATION_MAP.get(name);
});
}
export { componentTemplateFactory };

15
node_modules/riot/esm/core/compute-component-state.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/* Riot WIP, @license MIT */
import { callOrAssign } from '@riotjs/util';
/**
* Compute the component current state merging it with its previous state
* @param {Object} oldState - previous state object
* @param {Object} newState - new state given to the `update` call
* @returns {Object} new object state
*/
function computeComponentState(oldState, newState) {
return Object.assign({}, oldState, callOrAssign(newState));
}
export { computeComponentState };

19
node_modules/riot/esm/core/compute-initial-props.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/* Riot WIP, @license MIT */
import { DOMattributesToObject, callOrAssign } from '@riotjs/util';
/**
* Evaluate the component properties either from its real attributes or from its initial user properties
* @param {HTMLElement} element - component root
* @param {Object} initialProps - initial props
* @returns {Object} component props key value pairs
*/
function computeInitialProps(element, initialProps) {
if (initialProps === void 0) {
initialProps = {};
}
return Object.assign({}, DOMattributesToObject(element), callOrAssign(initialProps));
}
export { computeInitialProps };

View File

@@ -0,0 +1,27 @@
/* Riot WIP, @license MIT */
import { createCoreAPIMethods } from './create-core-api-methods.js';
import { createExpression } from '@riotjs/dom-bindings';
/**
* Create the bindings to update the component attributes
* @param {HTMLElement} node - node where we will bind the expressions
* @param {Array} attributes - list of attribute bindings
* @returns {TemplateChunk} - template bindings object
*/
function createAttributeBindings(node, attributes) {
if (attributes === void 0) {
attributes = [];
}
const expressions = attributes.map(a => createExpression(node, a));
const binding = {};
return Object.assign(binding, Object.assign({
expressions
}, createCoreAPIMethods(method => scope => {
expressions.forEach(e => e[method](scope));
return binding;
})));
}
export { createAttributeBindings };

View File

@@ -0,0 +1,23 @@
/* Riot WIP, @license MIT */
import { callOrAssign, camelToDashCase } from '@riotjs/util';
import { createComponentFromWrapper } from './create-component-from-wrapper.js';
/**
* Create the subcomponents that can be included inside a tag in runtime
* @param {Object} components - components imported in runtime
* @returns {Object} all the components transformed into Riot.Component factory functions
*/
function createChildrenComponentsObject(components) {
if (components === void 0) {
components = {};
}
return Object.entries(callOrAssign(components)).reduce((acc, _ref) => {
let [key, value] = _ref;
acc[camelToDashCase(key)] = createComponentFromWrapper(value);
return acc;
}, {});
}
export { createChildrenComponentsObject };

View File

@@ -0,0 +1,79 @@
/* Riot WIP, @license MIT */
import { IS_PURE_SYMBOL, callOrAssign, memoize } from '@riotjs/util';
import { MOCKED_TEMPLATE_INTERFACE } from './mocked-template-interface.js';
import { componentTemplateFactory } from './component-template-factory.js';
import { createPureComponent } from './create-pure-component.js';
import { instantiateComponent } from './instantiate-component.js';
/**
* Create the component interface needed for the @riotjs/dom-bindings tag bindings
* @param {RiotComponentWrapper} componentWrapper - riot compiler generated object
* @param {string} componentWrapper.css - component css
* @param {Function} componentWrapper.template - function that will return the dom-bindings template function
* @param {Object} componentWrapper.exports - component interface
* @param {string} componentWrapper.name - component name
* @returns {Object} component like interface
*/
function createComponentFromWrapper(componentWrapper) {
const {
css,
template,
exports,
name
} = componentWrapper;
const templateFn = template ? componentTemplateFactory(template, componentWrapper) : MOCKED_TEMPLATE_INTERFACE;
return _ref => {
let {
slots,
attributes,
props
} = _ref;
// pure components rendering will be managed by the end user
if (exports && exports[IS_PURE_SYMBOL]) return createPureComponent(exports, {
slots,
attributes,
props,
css,
template
});
const componentAPI = callOrAssign(exports) || {};
const component = instantiateComponent({
css,
template: templateFn,
componentAPI,
name
})({
slots,
attributes,
props
}); // notice that for the components created via tag binding
// we need to invert the mount (state/parentScope) arguments
// the template bindings will only forward the parentScope updates
// and never deal with the component state
return {
mount(element, parentScope, state) {
return component.mount(element, state, parentScope);
},
update(parentScope, state) {
return component.update(state, parentScope);
},
unmount(preserveRoot) {
return component.unmount(preserveRoot);
}
};
};
}
/**
* Performance optimization for the recursive components
* @param {RiotComponentWrapper} componentWrapper - riot compiler generated object
* @returns {Object} component like interface
*/
const memoizedCreateComponentFromWrapper = memoize(createComponentFromWrapper);
export { createComponentFromWrapper, memoizedCreateComponentFromWrapper };

17
node_modules/riot/esm/core/create-core-api-methods.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/* Riot WIP, @license MIT */
import { MOUNT_METHOD_KEY, UPDATE_METHOD_KEY, UNMOUNT_METHOD_KEY } from '@riotjs/util';
/**
* Wrap the Riot.js core API methods using a mapping function
* @param {Function} mapFunction - lifting function
* @returns {Object} an object having the { mount, update, unmount } functions
*/
function createCoreAPIMethods(mapFunction) {
return [MOUNT_METHOD_KEY, UPDATE_METHOD_KEY, UNMOUNT_METHOD_KEY].reduce((acc, method) => {
acc[method] = mapFunction(method);
return acc;
}, {});
}
export { createCoreAPIMethods };

52
node_modules/riot/esm/core/create-pure-component.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
/* Riot WIP, @license MIT */
import { panic, defineDefaults, MOUNT_METHOD_KEY, defineProperty, IS_PURE_SYMBOL } from '@riotjs/util';
import { PURE_COMPONENT_API } from './pure-component-api.js';
import { bindDOMNodeToComponentInstance } from './bind-dom-node-to-component-instance.js';
import { createCoreAPIMethods } from './create-core-api-methods.js';
/**
* Create a pure component
* @param {Function} pureFactoryFunction - pure component factory function
* @param {Array} options.slots - component slots
* @param {Array} options.attributes - component attributes
* @param {Array} options.template - template factory function
* @param {Array} options.template - template factory function
* @param {any} options.props - initial component properties
* @returns {Object} pure component object
*/
function createPureComponent(pureFactoryFunction, _ref) {
let {
slots,
attributes,
props,
css,
template
} = _ref;
if (template) panic('Pure components can not have html');
if (css) panic('Pure components do not have css');
const component = defineDefaults(pureFactoryFunction({
slots,
attributes,
props
}), PURE_COMPONENT_API);
return createCoreAPIMethods(method => function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// intercept the mount calls to bind the DOM node to the pure object created
// see also https://github.com/riot/riot/issues/2806
if (method === MOUNT_METHOD_KEY) {
const [element] = args; // mark this node as pure element
defineProperty(element, IS_PURE_SYMBOL, true);
bindDOMNodeToComponentInstance(element, component);
}
component[method](...args);
return component;
});
}
export { createPureComponent };

73
node_modules/riot/esm/core/css-manager.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
/* Riot WIP, @license MIT */
import $ from 'bianco.query';
import { set } from 'bianco.attr';
const CSS_BY_NAME = new Map();
const STYLE_NODE_SELECTOR = 'style[riot]'; // memoized curried function
const getStyleNode = (style => {
return () => {
// lazy evaluation:
// if this function was already called before
// we return its cached result
if (style) return style; // create a new style element or use an existing one
// and cache it internally
style = $(STYLE_NODE_SELECTOR)[0] || document.createElement('style');
set(style, 'type', 'text/css');
/* istanbul ignore next */
if (!style.parentNode) document.head.appendChild(style);
return style;
};
})();
/**
* Object that will be used to inject and manage the css of every tag instance
*/
const cssManager = {
CSS_BY_NAME,
/**
* Save a tag style to be later injected into DOM
* @param { string } name - if it's passed we will map the css to a tagname
* @param { string } css - css string
* @returns {Object} self
*/
add(name, css) {
if (!CSS_BY_NAME.has(name)) {
CSS_BY_NAME.set(name, css);
this.inject();
}
return this;
},
/**
* Inject all previously saved tag styles into DOM
* innerHTML seems slow: http://jsperf.com/riot-insert-style
* @returns {Object} self
*/
inject() {
getStyleNode().innerHTML = [...CSS_BY_NAME.values()].join('\n');
return this;
},
/**
* Remove a tag style from the DOM
* @param {string} name a registered tagname
* @returns {Object} self
*/
remove(name) {
if (CSS_BY_NAME.has(name)) {
CSS_BY_NAME.delete(name);
this.inject();
}
return this;
}
};
export { CSS_BY_NAME, STYLE_NODE_SELECTOR, cssManager as default };

40
node_modules/riot/esm/core/instantiate-component.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
/* Riot WIP, @license MIT */
import { defineProperties, defineDefaults, PROPS_KEY, STATE_KEY, SLOTS_KEY, ROOT_KEY } from '@riotjs/util';
import { COMPONENT_DOM_SELECTORS } from './component-dom-selectors.js';
import { COMPONENT_LIFECYCLE_METHODS } from './component-lifecycle-methods.js';
import cssManager from './css-manager.js';
import curry from 'curri';
import { manageComponentLifecycle } from './manage-component-lifecycle.js';
/**
* Component definition function
* @param {Object} implementation - the component implementation will be generated via compiler
* @param {Object} component - the component initial properties
* @returns {Object} a new component implementation object
*/
function instantiateComponent(_ref) {
let {
css,
template,
componentAPI,
name
} = _ref;
// add the component css into the DOM
if (css && name) cssManager.add(name, css);
return curry(manageComponentLifecycle)(defineProperties( // set the component defaults without overriding the original component API
defineDefaults(componentAPI, Object.assign({}, COMPONENT_LIFECYCLE_METHODS, {
[PROPS_KEY]: {},
[STATE_KEY]: {}
})), Object.assign({
// defined during the component creation
[SLOTS_KEY]: null,
[ROOT_KEY]: null
}, COMPONENT_DOM_SELECTORS, {
name,
css,
template
})));
}
export { instantiateComponent };

View File

@@ -0,0 +1,93 @@
/* Riot WIP, @license MIT */
import { autobindMethods, defineProperties, isObject, defineProperty, IS_PURE_SYMBOL, PARENT_KEY_SYMBOL, ATTRIBUTES_KEY_SYMBOL, PROPS_KEY, evaluateAttributeExpressions, STATE_KEY, TEMPLATE_KEY_SYMBOL, ROOT_KEY, SLOTS_KEY, ON_BEFORE_MOUNT_KEY, ON_MOUNTED_KEY, SHOULD_UPDATE_KEY, ON_BEFORE_UPDATE_KEY, IS_COMPONENT_UPDATING, ON_UPDATED_KEY, ON_BEFORE_UNMOUNT_KEY, ON_UNMOUNTED_KEY, isFunction } from '@riotjs/util';
import { addCssHook } from './add-css-hook.js';
import { bindDOMNodeToComponentInstance } from './bind-dom-node-to-component-instance.js';
import { computeComponentState } from './compute-component-state.js';
import { computeInitialProps } from './compute-initial-props.js';
import { createAttributeBindings } from './create-attribute-bindings.js';
import { runPlugins } from './run-plugins.js';
/**
* Component creation factory function that will enhance the user provided API
* @param {Object} component - a component implementation previously defined
* @param {Array} options.slots - component slots generated via riot compiler
* @param {Array} options.attributes - attribute expressions generated via riot compiler
* @returns {Riot.Component} a riot component instance
*/
function manageComponentLifecycle(component, _ref) {
let {
slots,
attributes,
props
} = _ref;
return autobindMethods(runPlugins(defineProperties(isObject(component) ? Object.create(component) : component, {
mount(element, state, parentScope) {
if (state === void 0) {
state = {};
}
// any element mounted passing through this function can't be a pure component
defineProperty(element, IS_PURE_SYMBOL, false);
this[PARENT_KEY_SYMBOL] = parentScope;
this[ATTRIBUTES_KEY_SYMBOL] = createAttributeBindings(element, attributes).mount(parentScope);
defineProperty(this, PROPS_KEY, Object.freeze(Object.assign({}, computeInitialProps(element, props), evaluateAttributeExpressions(this[ATTRIBUTES_KEY_SYMBOL].expressions))));
this[STATE_KEY] = computeComponentState(this[STATE_KEY], state);
this[TEMPLATE_KEY_SYMBOL] = this.template.createDOM(element).clone(); // link this object to the DOM node
bindDOMNodeToComponentInstance(element, this); // add eventually the 'is' attribute
component.name && addCssHook(element, component.name); // define the root element
defineProperty(this, ROOT_KEY, element); // define the slots array
defineProperty(this, SLOTS_KEY, slots); // before mount lifecycle event
this[ON_BEFORE_MOUNT_KEY](this[PROPS_KEY], this[STATE_KEY]); // mount the template
this[TEMPLATE_KEY_SYMBOL].mount(element, this, parentScope);
this[ON_MOUNTED_KEY](this[PROPS_KEY], this[STATE_KEY]);
return this;
},
update(state, parentScope) {
if (state === void 0) {
state = {};
}
if (parentScope) {
this[PARENT_KEY_SYMBOL] = parentScope;
this[ATTRIBUTES_KEY_SYMBOL].update(parentScope);
}
const newProps = evaluateAttributeExpressions(this[ATTRIBUTES_KEY_SYMBOL].expressions);
if (this[SHOULD_UPDATE_KEY](newProps, this[PROPS_KEY]) === false) return;
defineProperty(this, PROPS_KEY, Object.freeze(Object.assign({}, this[PROPS_KEY], newProps)));
this[STATE_KEY] = computeComponentState(this[STATE_KEY], state);
this[ON_BEFORE_UPDATE_KEY](this[PROPS_KEY], this[STATE_KEY]); // avoiding recursive updates
// see also https://github.com/riot/riot/issues/2895
if (!this[IS_COMPONENT_UPDATING]) {
this[IS_COMPONENT_UPDATING] = true;
this[TEMPLATE_KEY_SYMBOL].update(this, this[PARENT_KEY_SYMBOL]);
}
this[ON_UPDATED_KEY](this[PROPS_KEY], this[STATE_KEY]);
this[IS_COMPONENT_UPDATING] = false;
return this;
},
unmount(preserveRoot) {
this[ON_BEFORE_UNMOUNT_KEY](this[PROPS_KEY], this[STATE_KEY]);
this[ATTRIBUTES_KEY_SYMBOL].unmount(); // if the preserveRoot is null the template html will be left untouched
// in that case the DOM cleanup will happen differently from a parent node
this[TEMPLATE_KEY_SYMBOL].unmount(this, this[PARENT_KEY_SYMBOL], preserveRoot === null ? null : !preserveRoot);
this[ON_UNMOUNTED_KEY](this[PROPS_KEY], this[STATE_KEY]);
return this;
}
})), Object.keys(component).filter(prop => isFunction(component[prop])));
}
export { manageComponentLifecycle };

View File

@@ -0,0 +1,10 @@
/* Riot WIP, @license MIT */
import { PURE_COMPONENT_API } from './pure-component-api.js';
import { noop } from '@riotjs/util';
const MOCKED_TEMPLATE_INTERFACE = Object.assign({}, PURE_COMPONENT_API, {
clone: noop,
createDOM: noop
});
export { MOCKED_TEMPLATE_INTERFACE };

24
node_modules/riot/esm/core/mount-component.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
/* Riot WIP, @license MIT */
import { COMPONENTS_IMPLEMENTATION_MAP, panic } from '@riotjs/util';
import { getName } from '../utils/dom.js';
/**
* Component initialization function starting from a DOM node
* @param {HTMLElement} element - element to upgrade
* @param {Object} initialProps - initial component properties
* @param {string} componentName - component id
* @param {Array} slots - component slots
* @returns {Object} a new component instance bound to a DOM node
*/
function mountComponent(element, initialProps, componentName, slots) {
const name = componentName || getName(element);
if (!COMPONENTS_IMPLEMENTATION_MAP.has(name)) panic(`The component named "${name}" was never registered`);
const component = COMPONENTS_IMPLEMENTATION_MAP.get(name)({
props: initialProps,
slots
});
return component.mount(element);
}
export { mountComponent };

10
node_modules/riot/esm/core/pure-component-api.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/* Riot WIP, @license MIT */
import { MOUNT_METHOD_KEY, noop, UPDATE_METHOD_KEY, UNMOUNT_METHOD_KEY } from '@riotjs/util';
const PURE_COMPONENT_API = Object.freeze({
[MOUNT_METHOD_KEY]: noop,
[UPDATE_METHOD_KEY]: noop,
[UNMOUNT_METHOD_KEY]: noop
});
export { PURE_COMPONENT_API };

14
node_modules/riot/esm/core/run-plugins.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/* Riot WIP, @license MIT */
import { PLUGINS_SET } from '@riotjs/util';
/**
* Run the component instance through all the plugins set by the user
* @param {Object} component - component instance
* @returns {Object} the component enhanced by the plugins
*/
function runPlugins(component) {
return [...PLUGINS_SET].reduce((c, fn) => fn(c) || c, component);
}
export { runPlugins };

12
node_modules/riot/esm/riot.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/* Riot WIP, @license MIT */
export { register } from './api/register.js';
export { unregister } from './api/unregister.js';
export { mount } from './api/mount.js';
export { unmount } from './api/unmount.js';
export { install } from './api/install.js';
export { uninstall } from './api/uninstall.js';
export { component } from './api/component.js';
export { pure } from './api/pure.js';
export { withTypes } from './api/with-types.js';
export { version } from './api/version.js';
export { __ } from './api/__.js';

15
node_modules/riot/esm/utils/dom.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/* Riot WIP, @license MIT */
import { IS_DIRECTIVE } from '@riotjs/util';
import { get } from 'bianco.attr';
/**
* Get the tag name of any DOM node
* @param {HTMLElement} element - DOM node we want to inspect
* @returns {string} name to identify this dom node in riot
*/
function getName(element) {
return get(element, IS_DIRECTIVE) || element.tagName.toLowerCase();
}
export { getName };

86
node_modules/riot/package.json generated vendored Normal file
View File

@@ -0,0 +1,86 @@
{
"name": "riot",
"version": "7.0.3",
"description": "Simple and elegant component-based UI library",
"homepage": "https://riot.js.org/",
"repository": "riot/riot",
"author": "Gianluca Guarini <gianluca.guarini@gmail.com> (https://gianlucaguarini.com)",
"license": "MIT",
"sideEffects": false,
"engines": {
"node": ">=12.0.0"
},
"scripts": {
"test": "make riot"
},
"keywords": [
"custom tags",
"custom elements",
"web components",
"virtual dom",
"shadow dom",
"minimal",
"minimalist",
"client-side",
"framework",
"declarative",
"templating",
"template",
"data binding",
"mvc",
"model",
"view",
"controller",
"riotjs",
"riot.js"
],
"dependencies": {
"@riotjs/compiler": "^6.3.2",
"@riotjs/dom-bindings": "6.0.4",
"@riotjs/util": "^2.1.1",
"bianco.attr": "^1.1.1",
"bianco.query": "^1.1.4",
"cumpa": "^1.0.1",
"curri": "^1.0.1"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@riotjs/babel-preset": "1.0.0",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"babel-plugin-istanbul": "^6.1.1",
"chai": "^4.3.6",
"core-js": "^3.24.1",
"eslint": "^8.22.0",
"eslint-config-riot": "^3.0.0",
"jsdom": "20.0.0",
"jsdom-global": "3.0.2",
"karma": "^6.4.0",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage": "^2.2.0",
"karma-mocha": "^2.0.1",
"karma-rollup-preprocessor": "^7.0.8",
"karma-sauce-launcher": "^4.3.6",
"mocha": "^10.0.0",
"rollup": "^2.78.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-riot": "^6.0.0",
"sinon": "^14.0.0",
"sinon-chai": "^3.7.0",
"terser": "^5.14.2",
"typescript": "^4.7.4"
},
"files": [
"esm",
"riot.js",
"riot.d.ts",
"riot.min.js",
"riot+compiler.js",
"riot+compiler.min.js"
],
"main": "riot.js",
"module": "esm/riot.js",
"jsnext:main": "esm/riot.js",
"types": "./riot.d.ts"
}

5487
node_modules/riot/riot+compiler.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/riot/riot+compiler.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

131
node_modules/riot/riot.d.ts generated vendored Normal file
View File

@@ -0,0 +1,131 @@
import {
SlotBindingData,
TemplateChunk,
BindingData,
AttributeExpressionData,
ExpressionType,
BindingType
} from '@riotjs/dom-bindings'
// Internal Types and shortcuts
export type RegisteredComponentsMap = Map<string, () => RiotComponent>
export type ComponentEnhancer = <Props = any, State = any>(component: RiotComponent<Props, State>) => RiotComponent<Props, State>
export type InstalledPluginsSet = Set<ComponentEnhancer>
export type RiotComponentsMap = {
[key: string]: RiotComponentWrapper
}
export type AutobindObjectMethods<Object, This> = {
[K in keyof Object]: Object[K] extends (...args: any) => any ? (this: This, ...args: Parameters<Object[K]>) => ReturnType<Object[K]> : Object[K]
}
export interface RiotComponent<Props = any, State = any> {
// automatically generated on any component instance
readonly props: Props
readonly root: HTMLElement
readonly name?: string
readonly slots: SlotBindingData[]
// mutable state property
state: State
// optional alias to map the children component names
components?: RiotComponentsMap
mount(
element: HTMLElement,
initialState?: State,
parentScope?: object
): RiotComponent<Props, State>
update(
newState?: Partial<State>,
parentScope?: object
): RiotComponent<Props, State>
unmount(keepRootElement?: boolean): RiotComponent<Props, State>
// Helpers
$(selector: string): Element | null
$$(selector: string): Element[]
// state handling methods
shouldUpdate?(newProps: Props, oldProps: Props): boolean
// lifecycle methods
onBeforeMount?(props: Props, state: State): void
onMounted?(props: Props, state: State): void
onBeforeUpdate?(props: Props, state: State): void
onUpdated?(props: Props, state: State): void
onBeforeUnmount?(props: Props, state: State): void
onUnmounted?(props: Props, state: State): void
}
// The Riot component object without the internals
// The internal attributes will be handled by the framework
export type RiotComponentWithoutInternals<Component extends RiotComponent> = Omit<Component, 'props' | 'root' | 'name' | 'slots' | 'mount' | 'update' | 'unmount' | '$' | '$$'>
export type RiotComponentWithoutInternalsAndInitialState<Component extends RiotComponent> = Omit<RiotComponentWithoutInternals<Component>, 'state'>
// Riot Pure Component interface that should be used together with riot.pure
export interface RiotPureComponent<Context = object> {
mount(
element: HTMLElement,
context?: Context,
): RiotPureComponent<Context>
update(
context?: Context,
): RiotPureComponent<Context>
unmount(keepRootElement: boolean): RiotPureComponent<Context>
}
export interface PureComponentFactoryFunction<InitialProps = any, Context = any> {
({
slots,
attributes,
props
}: { slots?: SlotBindingData<Context>[], attributes?: AttributeExpressionData<Context>[], props?: InitialProps; }): RiotPureComponent<Context>
}
// This object interface is created anytime a riot file will be compiled into javascript
export interface RiotComponentWrapper<Component = RiotComponent> {
readonly css?: string | null
readonly exports?: RiotComponentFactoryFunction<Component> | Component | null
readonly name?: string | null
template?(
template: (template: string, bindings?: BindingData<Component>[]) => TemplateChunk<Component>,
expressionTypes: Record<keyof typeof ExpressionType, number>,
bindingTypes: Record<keyof typeof BindingType, number>,
getComponent: (componentName: string) => any
): TemplateChunk<Component> | null
}
// Interface for components factory functions
export interface RiotComponentFactoryFunction<Component> {
(): Component
components?: RiotComponentsMap
}
// Riot public API
export function register<Props, State>(componentName: string, wrapper: RiotComponentWrapper<RiotComponent<Props, State>>): RegisteredComponentsMap
export function unregister(componentName: string): RegisteredComponentsMap
export function mount<Props, State>(selector: string | HTMLElement, initialProps?: Props, componentName?: string): RiotComponent<Props, State>[]
export function unmount(selector: string | HTMLElement, keepRootElement?: boolean): HTMLElement[]
export function install(plugin: ComponentEnhancer): InstalledPluginsSet
export function uninstall(plugin: ComponentEnhancer): InstalledPluginsSet
export function component<Props, State, Component = RiotComponent<Props, State>>(wrapper: RiotComponentWrapper<Component>): (
el: HTMLElement,
initialProps?: Props,
meta?: { slots: SlotBindingData[]; attributes: AttributeExpressionData[]; parentScope: any; }
) => Component
export function pure<InitialProps = any, Context = any, FactoryFunction = PureComponentFactoryFunction<InitialProps, Context>>(func: FactoryFunction): FactoryFunction
export const version: string
// typescript specific methods
export function withTypes<Component extends RiotComponent,
ComponentFactory = RiotComponentFactoryFunction<AutobindObjectMethods<RiotComponentWithoutInternals<Component>, Component>>
>(fn: ComponentFactory): () => Component
export function withTypes<Component extends RiotComponent,
ComponentFactory = RiotComponentFactoryFunction<AutobindObjectMethods<RiotComponentWithoutInternalsAndInitialState<Component>, Component>>
>(fn: ComponentFactory): () => Component
export function withTypes<Component extends RiotComponent, ComponentObjectWithInitialState = RiotComponentWithoutInternals<Component>>(component: AutobindObjectMethods<ComponentObjectWithInitialState, Component>): Component
export function withTypes<Component extends RiotComponent, ComponentObjectWithoutInitialState = RiotComponentWithoutInternalsAndInitialState<Component>>(component: AutobindObjectMethods<ComponentObjectWithoutInitialState, Component>): Component

2445
node_modules/riot/riot.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/riot/riot.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long