Skip to content

Instantly share code, notes, and snippets.

@JanMiksovsky
JanMiksovsky / realTemplate.html
Created October 2, 2015 21:49
Create a Polymer element using a real <template>, not a <dom-module>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="import" href="../components/polymer/polymer.html">
<template id="test-element">
Hello, <content></content>.
</template>
@JanMiksovsky
JanMiksovsky / portStatus.dot
Last active August 22, 2016 16:38
Component porting status
digraph G {
// Dependency graph of Paper/Iron elements
//
// solid (default) lines = dependency
// sotted lines = devDependency
//
// green = generally works under Polymer 2.0: unit tests pass, demo looks reasonable (except for styling)
// yellow = some porting work has been done
// gray = porting status unknown or not begun
@JanMiksovsky
JanMiksovsky / index.html
Created December 3, 2018 21:54
Styling sugar example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Custom styling example</title>
<style id="customButtonStyle">
#inner {
background: white;
@JanMiksovsky
JanMiksovsky / styleableCarousel.html
Last active April 26, 2019 01:56
Hypothetical styleable carousel component showing custom parts and custom pseudo-classes
<html>
<head>
<title>Styling a part in combination with a custom pseudo-class</title>
<script type="module">
// This code sample shows a hypothetical styleable carousel component
// modeled after https://component.kitchen/elix/Carousel.
//
// This shows two related web component features which are desired:
//
@JanMiksovsky
JanMiksovsky / carousel.html
Created July 13, 2020 23:25
Elix Carousel with closed shadow root
@JanMiksovsky
JanMiksovsky / StoryBrowser.js
Created October 27, 2020 00:10
Lightweight demo/story browser web component in plain JavaScript, no dependencies
/**
* Lightweight demo/story browser in plain JavaScript, no dependencies.
*/
// Semi-private fields stored via Symbol keys on an element instance.
const defaultPathKey = Symbol();
const linksKey = Symbol();
const pathKey = Symbol();
// The template for the component's shadow tree.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<script
type="module"
src="https://cdn.jsdelivr.net/gh/elix/elix@main/define/ListComboBox.js"
></script>
@JanMiksovsky
JanMiksovsky / elementReferences.md
Created February 10, 2021 19:16
Exploring indirect AOM element references to bridge light/shadow DOM

Indirect ARIA element references

This illustrates the possibility of indirecting AOM element references so that they work across shadows. The main ideas are:

  1. Use custom element code to coordinate references light DOM and shadow DOM.
  2. Ensure that AOM references can be indirected: if element A references B for a label, and B references C for a label, then A ends up getting its label from C.
  3. Let the custom element host serve as an indirection point between the light and shadow DOM.
  4. Define fallback AOM properties on elementInternals that are used if the corresponding properties are not set on the host. This lets a host reference elements in its own shadow without exposing those references.

Adapting a combo box example from Alice Boxhall.

@JanMiksovsky
JanMiksovsky / site.yaml
Created September 6, 2022 23:39
Simple toy site packaged as a YAML file
index.html: |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<h1>Home page</h1>
@JanMiksovsky
JanMiksovsky / index.html = this().ori
Last active October 18, 2022 23:20
A trivial site using data and templates
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Reviews</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
<h1>Reviews</h1>
<div class="cards">