# mx-custom-countdown

> Stencil Component Starter

Latest version **0.2.4** (published 2022-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install mx-custom-countdown
pnpm add mx-custom-countdown
yarn add mx-custom-countdown
bun add mx-custom-countdown
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2022-03-26 |
| First published | 2022-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 289 |
| Maintainers | roswerk |

## Links

- npm: https://www.npmjs.com/package/mx-custom-countdown
- Repository: https://github.com/ionic-team/stencil-component-starter
- Homepage: https://github.com/ionic-team/stencil-component-starter#readme
- Issues: https://github.com/ionic-team/stencil-component-starter/issues
- npm.io page: https://npm.io/package/mx-custom-countdown

## Dependencies (1)

- [@stencil/core](https://npm.io/package/@stencil/core.md) ^2.13.0

## Recent versions

- 0.2.4 (latest) — 2022-03-26
- 0.2.3 — 2022-03-26
- 0.2.2 — 2022-03-26
- 0.2.1 — 2022-03-26
- 0.2.0 — 2022-03-26
- 0.1.6 — 2022-03-26
- 0.1.5 — 2022-03-26
- 0.1.4 — 2022-03-26
- 0.1.3 — 2022-03-25
- 0.1.2 — 2022-03-25
- 0.0.1 — 2022-03-25

## README

# ACME Countdown

## Goal: Create a Countdown timer for ACME Corp as a custom web component.

### Stack: JavaScript, Stencil, HTML, CSS

#### Breakdown:

1. Define requirements<br>
   1.1 - Web Component needs to recieve Countdown-Name and Countdown-Time in SECONDS.<br>
   Adittional: Create a finish custom message.<br>
   1.2 - Seconds need to be translated to Hours/Minutes/Seconds.<br>
   1.3 - Timer needs a count-down logic.<br>
   1.4 - Give some style! UI is important.<br>
   1.5 - Give some pre-defined customization! Developers UX is also important.<br>

2. Create Stencil project.
3. Create count-down logic.
4. Give your code some styling love and final touches.
5. Refactor.

#### Additional Info on 1.6

Available Tags:<br>
name="Launch Time" -> Title to be shown above Timer<br>
seconds="10000" -> Time of coutdown in Seconds<br>
final-message="Liftoff!" -> Message to be displayed once time is off<br>
custom-style="nasa" -> Custom Styles: Try "nasa" (white bkg), "spacex" (black bkg) or "acme" (red bkg)<br>
logo="nasa" -> predefined logo: Try "nasa", "spacex" or "acme" -> can be customized by importing a PNG file into the assets folder<br>

Publish Package in NPM:

1. Set account
2. Build component
3. Publish

## In order to get the Package run: npm install mx-custom-countdown

### In order to use the web-components:

#### React ->

1. Install package
2. Go to index.js and add the following imports:
   import {defineCustomElements} from "mx-custom-countdown/loader";

At the end of your file add:

defineCustomElements(window);

3. Go to the file you want to use the component on and use it as you wish. Ex:

<acme-countdown></acme-countdown>

possible properties:

seconds="10"<br>
name="Launch"<br>
final-message="Lift off"<br>
custom-style="spacex" (possible combinations: nasa (white), spacex (black), acme(red))<br>
logo="spacex" (possible: nasa, spacex, acme)<br>

#### Angular:

1. Install package
2. Go to app.module.ts and add:
   import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"

on ngModule:

@NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})

Afterwards you need to register the elements like this (similar to React):

On main.ts:

import {defineCustomElements} from "mx-custom-countdown/loader";

defineCustomElements(window);

---

##### Stencil Component Starter

This is a starter project for building a standalone Web Component using Stencil.

Stencil is also great for building entire apps. For that, use the [stencil-app-starter](https://github.com/ionic-team/stencil-app-starter) instead.

##### Stencil

Stencil is a compiler for building fast web apps using Web Components.

Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.

Stencil components are just Web Components, so they work in any major framework or with no framework at all.

###### Getting Started

To start building a new web component using Stencil, clone this repo to a new directory:

```bash
git clone https://github.com/ionic-team/stencil-component-starter.git my-component
cd my-component
git remote rm origin
```

and run:

```bash
npm install
npm start
```

To build the component for production, run:

```bash
npm run build
```

To run the unit tests for the components, run:

```bash
npm test
```

Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).

###### Naming Components

When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!

Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix `ion`.

###### Using this component

There are three strategies we recommend for using web components built with Stencil.

The first step for all three of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).

###### Script tag

- Put a script tag similar to this `<script type='module' src='https://unpkg.com/my-component@0.0.1/dist/my-component.esm.js'></script>` in the head of your index.html
- Then you can use the element anywhere in your template, JSX, html etc

###### Node Modules

- Run `npm install my-component --save`
- Put a script tag similar to this `<script type='module' src='node_modules/my-component/dist/my-component.esm.js'></script>` in the head of your index.html
- Then you can use the element anywhere in your template, JSX, html etc

###### In a stencil-starter app

- Run `npm install my-component --save`
- Add an import to the npm packages `import my-component;`
- Then you can use the element anywhere in your template, JSX, html etc

---
_Source: https://npm.io/package/mx-custom-countdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
