open-index/open-npm huggingface dataset:
npm package: @kdcloudjs/kwc
Description: Kingdee Web Components (KWC)
Latest version: 1.0.0

Kingdee Web Components (KWC) is an enterprise-grade web components foundation for building user interfaces. KWC provides a simple authoring format for UI components, which is compiled into low-level Web Component APIs. The `kwc` package is the main entry point for dependencies.

- Develop components quickly and declaratively using HTML, JavaScript, and CSS.
- Develop accessible components so that everyone can understand and navigate your app.
- Components are encapsulated in Shadow DOM, with the `@kdcloudjs/kwc-synthetic-shadow` package as an optional polyfill for older browsers.

Developing a Kingdee Web Component is this easy:

```ascii
counter
  ├──counter.css
  ├──counter.html
  └──counter.js
```

```html
<!-- counter.html -->
<template>
    <p>Counter: {count}</p>
    <button onclick="{increaseCounter}">Add</button>
</template>
```

```css
/* counter.css */
p {
    font-family: serif;
    font-size: large;
}
```

```javascript
// counter.js
import { KingdeeElement } from '@kdcloudjs/kwc';

export default class Counter extends KingdeeElement {
    count = 0;

    increaseCounter() {
        this.count += 1;
    }
}
```

## Supported Browsers

As of KWC, Microsoft® Internet Explorer® 11 is no longer supported.


## The `kwc` package

This package (`kwc`) is a convenience package that re-exports all packages that might be used for KWC component development. Installing it also installs the core `@kdcloudjs/kwc-*` packages.

For example, to use `@kdcloudjs/kwc-engine-server` from this package, you can do:

```js
import { renderComponent } from 'kwc/engine-server';
```

This is equivalent to:

```js
import { renderComponent } from '@kdcloudjs/kwc-engine-server';
```

## Experimental Packages

The `@kdcloudjs/kwc-ssr-compiler` and `@kdcloudjs/kwc-ssr-runtime` packages are still considered experimental, and may break without notice.
npm package: @kdcloudjs/kwc-babel-plugin-component
Description: Babel plugin to transform a KWC module
Latest version: 1.0.1

# @kdcloudjs/kwc-babel-plugin-component

## Summary

This babel plugin does the following transform:

- Global decorator transform:
    - Transform `@api` decorator to `publicProperties` and `publicMethods` static properties.
    - Transform `@wire` decorator to `wire` static property.
    - Transform `@track` decorator to `track` static property.
- KWC component class sugar syntax:
    - Check for misspelled lifecycle hooks.
    - Import and inject `render` from a collocated template if a component class doesn't already implement a `render` method.
- Optimization:
    - If the compiler inject the default template a component, it will also wire the template style to the component.

## Installation

    npm install babel @kdcloudjs/kwc-babel-plugin-component

## Usage

```js
const babel = require('@babel/core');
const kwcPlugin = require('@kdcloudjs/kwc-babel-plugin-component');

const source = `
import { KingdeeElement } from '@kdcloudjs/kwc';
export default class extends KingdeeElement {}`;

const { code } = babel.transformSync(source, {
    plugins: [
        [
            kwcPlugin,
            {
                /* options */
            },
        ],
    ],
});
```

## Options

- `name` (type: `string`, optional) - name of the component, e.g. `foo` in `x/foo`.
- `namespace` (type: `string`, optional) - namepace of the component, e.g. `x` in `x/foo`.
- `isExplicitImport` (type: `boolean`, optional) - true if this is an explicit import.
- `dynamicImports` (type: `object`, optional) - see below:
    - `loader` (type: `string`, optional) - loader to use at runtime.
    - `strictSpecifier` (type: `boolean`, optional) - true if a strict specifier should be used.
- `instrumentation` (type: `InstrumentationObject`, optional) - instrumentation object to gather metrics and non-error logs for internal use. See the `@kdcloudjs/kwc-errors` package for details on the interface.
- `apiVersion` (type: `number`, optional) - API version to associate with the compiled component.
npm package: @kdcloudjs/kwc-engine-dom
Description: Renders KWC components in a DOM environment.
Latest version: 1.0.1

# @kdcloudjs/kwc-engine-dom

This package can be used to render KWC components as DOM elements in a DOM environment.

## Supported APIs

This package supports the following APIs.

### createElement()

This function creates an KWC component, given a tag name and an KWC constructor.

```js
import { createElement } from '@kdcloudjs/kwc';
import KingdeeHello from 'kingdee/hello';

const element = createElement('kingdee-hello', { is: KingdeeHello });

document.body.appendChild(element);
```

## Experimental APIs

Experimental APIs are subject to change, may be removed at any time, and should be used at your
own risk!

### getComponentConstructor()

This experimental API provides access to the component constructor, given an `HTMLElement`.

### isNodeFromTemplate()

This experimental API enables the detection of whether a node was rendered from an KWC template.
npm package: @kdcloudjs/kwc-engine-server
Description: Renders KWC components in a server environment.
Latest version: 1.0.1

# @kdcloudjs/kwc-engine-server

WARNING: This is an experimental package. It is subject to change, may be removed at any time,
and should be used at your own risk!

This package can be used to render KWC components as strings in a server environment.

## Supported APIs

This package supports the following APIs.

### renderComponent()

This function renders a string-representation of a serialized component tree, given a tag name
and an KWC constructor.
```js
import { renderComponent } from '@kdcloudjs/kwc-engine-server';
import KingdeeHello from 'kingdee/hello';

const componentProps = {};
const serialized = renderComponent('kingdee-hello', KingdeeHello, componentProps);
```
npm package: @kdcloudjs/kwc-features
Description: KWC Features Flags
Latest version: 1.0.1

# @kdcloudjs/kwc-features

Runtime flags can be enabled or disabled by setting a boolean value for that
flag in `globalThis.kwcRuntimeFlags`, e.g.:

```js
kwcRuntimeFlags.ENABLE_SOME_FEATURE = true;
```

If the flag is not explicitly
set, the feature is disabled by default. The `kwcRuntimeFlags` object
must appear before the engine is initialized and should be defined at the
application layer.

Internally, KWC will reference runtime flags like so:

```js
if (kwcRuntimeFlags.ENABLE_SOME_FEATURE) {
    // etc.
}
```

This makes it possible for consumers to replace these flags at compile time, using something like [Rollup's `@rollup/plugin-replace`](https://www.npmjs.com/package/@rollup/plugin-replace) or [ESBuild's `define`](https://esbuild.github.io/api/#define).

Note that `@kdcloudjs/kwc-features` is an internal package used by KWC and (most likely) should not be directly used by consumers.
npm package: @kdcloudjs/kwc-rollup-plugin
Description: Rollup plugin to compile KWC
Latest version: 1.0.1

# @kdcloudjs/kwc-rollup-plugin

Rollup plugin to compile KWC

## Installation

```sh
yarn add --dev @kdcloudjs/kwc-rollup-plugin
```

## Usage

```js
// rollup.config.js
import kwc from '@kdcloudjs/kwc-rollup-plugin';

export default {
    input: './src/main.js',
    plugins: [kwc()],
};
```

## Options

- `include` (type: `string | string[]`, default: `null`) - A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should transform on. By default all files are targeted.
- `exclude` (type: `string | string[]`, default: `null`) - A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should not transform. By default no files are ignored.
- `rootDir` (type: `string`, default: rollup `input` directory) - The KWC root module directory.
- `sourcemap` (type: `boolean`, default: `false`) - If `true` the plugin will produce source maps.
- `modules` (type: `ModuleRecord[]`, default: `[]`) - The module resolution overrides passed to the `@kdcloudjs/kwc-module-resolver`.
- `stylesheetConfig` (type: `object`, default: `{}`) - Deprecated. Ignored by compiler.
- `preserveHtmlComments` (type: `boolean`, default: `false`) - The configuration to pass to the `@kdcloudjs/kwc-template-compiler`.
- `experimentalDynamicComponent` (type: `DynamicImportConfig`, default: `null`) - The configuration to pass to `@kdcloudjs/kwc-compiler`.
- `experimentalDynamicDirective` (type: `boolean`, default: `false`) - The configuration to pass to `@kdcloudjs/kwc-template-compiler` to enable deprecated dynamic components.
- `enableDynamicComponents` (type: `boolean`, default: `false`) - The configuration to pass to `@kdcloudjs/kwc-template-compiler` to enable dynamic components.
- `enableLightningWebSecurityTransforms` (type: `boolean`, default: `false`) - The configuration to pass to `@kdcloudjs/kwc-compiler`.
- `enableKwcSpread` (type: `boolean`, default: `false`) - The configuration to pass to the `@kdcloudjs/kwc-template-compiler`.
- `enableKwcOn` (type: `boolean`, default: `false`) - The configuration to pass to the `@kdcloudjs/kwc-template-compiler`.
- `disableSyntheticShadowSupport` (type: `boolean`, default: `false`) - Set to true if synthetic shadow DOM support is not needed, which can result in smaller output.
- `apiVersion` (type: `number`, default: `undefined`) - Set to a valid API version such as 58, 59, etc. This will be overriden if the component itself overrides the version with a `*.js-meta.xml` file.
- `enableStaticContentOptimization` (type: `boolean`, optional) - True if the static content optimization should be enabled. Passed to `@kdcloudjs/kwc-template-compiler`. True by default.
- `targetSSR` (type: `boolean`) - Utilize the experimental SSR compilation mode. False by default. Do not use unless you know what you're doing.
- `ssrMode` (type: `string`): The variety of SSR code that should be generated when using experimental SSR compilation mode. Should be one of `sync`, `async` or `asyncYield`.