Skip to content

Commit 380f454

Browse files
committed
Adds scaffolding files for uui-copy
npm run new-package
1 parent 207119e commit 380f454

File tree

10 files changed

+184
-0
lines changed

10 files changed

+184
-0
lines changed

package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uui-copy/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# uui-copy
2+
3+
![npm](https://img.shields.io/npm/v/@umbraco-ui/uui-copy?logoColor=%231B264F)
4+
5+
Umbraco style copy component.
6+
7+
## Installation
8+
9+
### ES imports
10+
11+
```zsh
12+
npm i @umbraco-ui/uui-copy
13+
```
14+
15+
Import the registration of `<uui-copy>` via:
16+
17+
```javascript
18+
import '@umbraco-ui/uui-copy';
19+
```
20+
21+
When looking to leverage the `UUICopyElement` base class as a type and/or for extension purposes, do so via:
22+
23+
```javascript
24+
import { UUICopyElement } from '@umbraco-ui/uui-copy';
25+
```
26+
27+
## Usage
28+
29+
```html
30+
<uui-copy></uui-copy>
31+
```

packages/uui-copy/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './uui-copy.element';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
2+
import { css, html, LitElement } from 'lit';
3+
4+
/**
5+
* @element uui-copy
6+
*/
7+
@defineElement('uui-copy')
8+
export class UUICopyElement extends LitElement {
9+
static styles = [
10+
css`
11+
:host {
12+
/* Styles goes here */
13+
}
14+
`,
15+
];
16+
17+
render(){
18+
return html`
19+
Markup goes here
20+
`;
21+
}
22+
}
23+
24+
declare global {
25+
interface HTMLElementTagNameMap {
26+
'uui-copy': UUICopyElement;
27+
}
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { Meta, StoryObj } from '@storybook/web-components';
2+
3+
import './uui-copy.element';
4+
import type { UUICopyElement } from './uui-copy.element';
5+
import readme from '../README.md?raw';
6+
7+
const meta: Meta<UUICopyElement> = {
8+
id: 'uui-copy',
9+
title: 'Copy',
10+
component: 'uui-copy',
11+
parameters: {
12+
readme: { markdown: readme },
13+
docs: {
14+
source: {
15+
code: `<uui-copy></uui-copy>`,
16+
},
17+
},
18+
},
19+
};
20+
21+
export default meta;
22+
type Story = StoryObj<UUICopyElement>;
23+
24+
export const Overview: Story = {};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { html, fixture, expect } from '@open-wc/testing';
2+
import { UUICopyElement } from './uui-copy.element';
3+
4+
describe('UUICopyElement', () => {
5+
let element: UUICopyElement;
6+
7+
beforeEach(async () => {
8+
element = await fixture(
9+
html` <uui-copy></uui-copy> `
10+
);
11+
});
12+
13+
it('is defined with its own instance', () => {
14+
expect(element).to.be.instanceOf(UUICopyElement);
15+
});
16+
17+
it('passes the a11y audit', async () => {
18+
await expect(element).shadowDom.to.be.accessible();
19+
});
20+
});

packages/uui-copy/package.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "@umbraco-ui/uui-copy",
3+
"version": "0.0.0",
4+
"license": "MIT",
5+
"keywords": [
6+
"Umbraco",
7+
"Custom elements",
8+
"Web components",
9+
"UI",
10+
"Lit",
11+
"Copy"
12+
],
13+
"description": "Umbraco UI copy component",
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/umbraco/Umbraco.UI.git",
17+
"directory": "packages/uui-copy"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/umbraco/Umbraco.UI/issues"
21+
},
22+
"main": "./lib/index.js",
23+
"module": "./lib/index.js",
24+
"types": "./lib/index.d.ts",
25+
"type": "module",
26+
"customElements": "custom-elements.json",
27+
"files": [
28+
"lib/**/*.d.ts",
29+
"lib/**/*.js",
30+
"custom-elements.json"
31+
],
32+
"dependencies": {
33+
"@umbraco-ui/uui-base": "1.12.2"
34+
},
35+
"scripts": {
36+
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
37+
"clean": "tsc --build --clean && rimraf -g dist lib/*.js lib/**/*.js *.tgz lib/**/*.d.ts custom-elements.json",
38+
"analyze": "web-component-analyzer **/*.element.ts --outFile custom-elements.json"
39+
},
40+
"publishConfig": {
41+
"access": "public"
42+
},
43+
"homepage": "https://uui.umbraco.com/?path=/story/uui-copy"
44+
}

packages/uui-copy/rollup.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { UUIProdConfig } from '../rollup-package.config.mjs';
2+
3+
export default UUIProdConfig({
4+
entryPoints: ['index']
5+
});

packages/uui-copy/tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Don't edit this file directly. It is generated by /scripts/generate-ts-config.js
2+
3+
{
4+
"extends": "../../tsconfig.json",
5+
"compilerOptions": {
6+
"outDir": "./lib",
7+
"rootDir": "./lib",
8+
"composite": true
9+
},
10+
"include": ["./**/*.ts"],
11+
"exclude": ["./**/*.test.ts", "./**/*.story.ts"],
12+
"references": [
13+
{
14+
"path": "../uui-base"
15+
}
16+
]
17+
}

packages/uui/lib/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,5 @@ export * from '@umbraco-ui/uui-toast-notification-layout/lib';
8080
export * from '@umbraco-ui/uui-toast-notification/lib';
8181
export * from '@umbraco-ui/uui-toggle/lib';
8282
export * from '@umbraco-ui/uui-visually-hidden/lib';
83+
84+
export * from '@umbraco-ui/uui-copy/lib/index.js';

0 commit comments

Comments
 (0)