包详细信息

ndf-elements

nfreear20MIT1.7.1

My collection of useful custom elements.

ndf-web-components, my-elements, my, my-map

自述文件

Node.js CI NPM package

My Elements

A collection of useful custom elements (Web Components).

Rationale

  • Some experimental, particularly <my-page>, <my-nav> which are probably not for production !!
  • Should be usable with or without a build system, minimalist,
  • Accessible and usable for end-users - use WAI-ARIA where appropriate!
  • Simple for developers to try out,
  • ES6 classes in JS files (with associated HTML + CSS in <template> in .tpl.html files - DEPRECATED),
  • Self-contained where possible - SVG icons embedded in <template>, except <my-map> (Leaflet.js)
  • Use shadow DOM where possible - see notes on forms (below?)
  • A playground, plus some components that I will use in my blog etc.
  • Demo page, per component (almost?!),
  • semistandard linting, etc.

About Web Components.

See also: web-vitals-element.

Usage

Available on Unpkg and Skypack CDNs. Note, templates can't currently be accessed from Skypack.

<my-skip-link></my-skip-link>


<my-options template-host="unpkg.com"></my-options>

<script src="https://cdn.skypack.dev/ndf-elements?min"
  type="module" async crossorigin
></script>

Dynamic import

Dynamically import just the custom elements you want, using an importmap.

HTML:

<my-live-bridge event="click" message="Hello world!">
  <p aria-live="polite"></p>

  <p><button>Click me!</button></p>
</my-live-bridge>

<script type="importmap">
{
  "imports": {
    "my-elements": "https://unpkg.com/ndf-elements@^1/i.js"
  },
  "myElements": {
    "use": [ "my-live-bridge", "my-dev-warning" ]
  }
}
</script>

<script type="module"> import 'my-elements'; </script>

Legacy custom import

Dynamically import just the custom elements you want.

import customImport from 'https://unpkg.com/ndf-elements@^1/custom.js';

const MOD = await customImport('my-star-rating, my-skip-link');

Then:

<my-skip-link></my-skip-link>

<my-star-rating></my-star-rating>

License

  • License: MIT.

"A fast, global content delivery network for everything on npm"

"A JavaScript Delivery Network for modern web apps"

更新日志

Version 1.7.0

  • Release: 16-Mar-2025,
  • Fix: remove calls to static define() function - tree shaking/bundling (#50)
  • Fix: new MyMinElement minimal base class (#50)
  • Fix: web.js - for direct browser user. Imports all custom elements, including dynamic-import ones (#50)
  • Fix: new index.js - for build tools/bundlers (#50)
  • Fix: fix src/build/feed and MyFeedElement javascript
  • New entry point i.js - dynamically load custom elements via importmap (#48)

New custom elements:

  • <my-live-bridge> (#51)
  • <my-element-filter> (#49)
  • <my-input> (#49)
  • <my-codepen-button> (#47)
  • <my-dev-warning> (#46)
  • <my-paste-target> (#45)

Version 1.6.0

  • Release: 28-Oct-2023,
  • First release of @nfreear/my-map (#42)
  • Mono-repo hybrid (#42)
  • Updates to <my-map> (#40)
  • <my-map> - support child <marker> elements (#44)
  • New entry point my.js?my-elem - dynamically import custom elements via URL query parameter (#43)
  • <my-math> (#41)
  • Etc.

Version 1.5.0

Version 1.2.0

  • Date: 15-April-2022,
  • Rename package from ndf-web-components to ndf-elements (#20)

Version 1.1.0

  • Date: 30-March-2022,
  • Add customImport() method (#9)
  • Fix import order (#8)
  • Add leafletViaCdn(), rainbowViaCdn() … methods (#3)
  • Documentation (#15)
  • Accessibility fixes (#11)

New custom elements:

  • <my-atbar-button>
  • <my-bookmarklet>
  • <my-code>
  • <my-font>
  • <my-search>
  • <my-text-to-speech>

Version 1.0.0

  • Date: 09-January-2022,
  • First publish to Npmjs.com

← Readme