0.0.32 • Published 11 months ago

@es-labs/esm v0.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Description

Store JS files used by both frontend and backend

  • Use ESM to avoid using webpack for compilation on frontend
  • For backend refer to NodeJS document on how to use ESM in NodeJS (To Elaborate)

Running Script

To run the script use...

node <filename.js>

node csv-utils.js --input-type=module

HTML Custom Elements / Web Components

Useful aliasing for web components

// browser may already have these $ / $$...
const $ = (selector, el = document) => el.querySelector(selector);
const $$ = (selector, el = document) => el.querySelectorAll(selector);

Element.prototype.on = Element.prototype.addEventListener;
// TODO: how to auto unload event listener?

Custom Element (Web Component) Samples

Signature Pad

A component for capturing signature using canvas (component name: vcxwc-sign-pad)

Component file location sign-pad.js

Example Usage in https://github.com/es-labs/vue-antd-template file location src/apps/web-sample/views/Demo/DemoSignPad.vue

Features

  • handle attibutes and properties
  • pass in json attributes as string for canvas context settings
  • css variables
  • handle events
  • interactive with vuejs v-model

Customizable Styles

vcxwc-sign-pad {
  --vcxwc-sign-pad-background-color: #faa;
}

Attributes

  • width
  • height
  • context2d: 2D drawing context settings
  • value (v-model used here, input event is created)

Web Cam

A component for capturing image using webcam (component name: vcxwc-web-cam)

Component file location web-cam.js

Example Usage in https://github.com/es-labs/vue-antd-template file location src/apps/web-sample/views/Demo/DemoWebCam.vue

Features

  • shadowDOM and litDOM
    • css variables
  • shadowDOM
    • slots
    • slotted css and slot styles
    • slot events
    • use to include other css files e.g. bulma, bootstrap
    • interactive with vuejs v-on

CSS Variables

vcxwc-web-cam {
  --vcxwc-web-cam-top: 5%;
  --vcxwc-web-cam-right: 5%;
}

Attributes

  • width
  • height

Slots

  • button-snap
  • button-unsnap

Event Emitted

  • snap

TODO - Using web component inside a web component - its possible

0.0.25

12 months ago

0.0.30

12 months ago

0.0.31

11 months ago

0.0.32

11 months ago

0.0.26

12 months ago

0.0.27

12 months ago

0.0.28

12 months ago

0.0.29

12 months ago

0.0.24

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago