@webqit/oohtml 2.1.55-0 → 2.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -153
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[![bundle][bundle-src]][bundle-href]
|
|
6
6
|
[![License][license-src]][license-href]
|
|
7
7
|
|
|
8
|
-
**[Overview](#
|
|
8
|
+
**[Overview](#overview) • [Modular HTML](#modular-html) • [HTML Imports](#html-imports) • [Reactive HTML](#reactive-html) • [Polyfill](#polyfill) • [Examples](#examples) • [License](#license)**
|
|
9
9
|
|
|
10
10
|
Object-Oriented HTML (OOHTML) is a set of language features for authoring modular, reusable markup, and for translating that to functional DOM-level objects! Everything comes together as a delightful holistic component architecture for the modern UI!
|
|
11
11
|
|
|
@@ -25,7 +25,7 @@ This project is a proposal for a new standards work that revisits much of the ol
|
|
|
25
25
|
|
|
26
26
|
</details>
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Overview
|
|
29
29
|
|
|
30
30
|
OOHTML comes in three sets of features, and the following is an overview. A more detailed documentation for OOHTML is underway in the [project wiki](https://github.com/webqit/oohtml/wiki).
|
|
31
31
|
|
|
@@ -36,7 +36,7 @@ OOHTML comes in three sets of features, and the following is an overview. A more
|
|
|
36
36
|
|
|
37
37
|
> **Note** This is documentation for `OOHTML@2.x`. (Looking for [`OOHTML@1.x`](https://github.com/webqit/oohtml/tree/v1.10.4)?)
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
## Modular HTML
|
|
40
40
|
|
|
41
41
|
The first set of features covers authoring objects with self-contained structure, styling and *scripting*! This simply gets identifiers, style sheets and scripts to serve *at the object level* exactly as they do *at the document (object) level*.
|
|
42
42
|
|
|
@@ -86,7 +86,7 @@ let { styleSheets, scripts } = user; // APIs that are analogous to the document.
|
|
|
86
86
|
|
|
87
87
|
└ [Modular HTML concepts](#)
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
## HTML Imports
|
|
90
90
|
|
|
91
91
|
The next set of features covers *templating and reusing objects* - in both *declarative* and *programmatic* terms! It extends the language with the *module identifier* attribute `def`, and introduces a complementary new `<import>` element, and has everything working together as a real-time module system.
|
|
92
92
|
|
|
@@ -365,7 +365,7 @@ document.querySelector('div').import('#fragment2', divElement => {
|
|
|
365
365
|
|
|
366
366
|
└ [HTML Imports concepts](#)
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
## Reactive HTML
|
|
369
369
|
|
|
370
370
|
The last set of features covers the concept of "state", "bindings", and "reactivity" for those objects at the DOM level - in the most exciting form of the terms and as an upgrade path! This comes factored into the design as something intrinsic to the problem.
|
|
371
371
|
|
|
@@ -478,14 +478,160 @@ Observer.set(element, 'liveProperty'); // Live expressions rerun
|
|
|
478
478
|
|
|
479
479
|
└ [Reactive HTML concepts](#)
|
|
480
480
|
|
|
481
|
-
|
|
481
|
+
## Polyfill
|
|
482
482
|
|
|
483
|
-
|
|
483
|
+
OOHTML is being developed as something to be used today - via a polyfill.
|
|
484
484
|
|
|
485
|
-
|
|
485
|
+
<details><summary>Load from a CDN<br>
|
|
486
|
+
└───────── <a href="https://bundlephobia.com/result?p=@webqit/oohtml"><img align="right" src="https://img.shields.io/bundlephobia/minzip/@webqit/oohtml?label=&style=flat&colorB=black"></a></summary>
|
|
487
|
+
|
|
488
|
+
```html
|
|
489
|
+
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
└ This is to be placed early on in the document and should be a classic script without any `defer` or `async` directives!
|
|
493
|
+
|
|
494
|
+
<details><summary>Want Async Loading?</summary>
|
|
495
|
+
|
|
496
|
+
If you must load the script "async", one little trade-off has to be made for `<script scoped>` and `<script stateful>` elements to have them ignored by the browser until the polyfill comes picking them up: *employing a custom MIME type in place of the standard `text/javascript` and `module` types*, in which case, a `<meta name="scoped-js">` element is used to configure the polyfill to honor the custom MIME type:
|
|
497
|
+
|
|
498
|
+
```html
|
|
499
|
+
<head>
|
|
500
|
+
<meta name="scoped-js" content="script.mimeType=some-mime">
|
|
501
|
+
<script async src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
502
|
+
</head>
|
|
503
|
+
<body>
|
|
504
|
+
<script type="some-mime" scoped>
|
|
505
|
+
console.log(this); // body
|
|
506
|
+
</script>
|
|
507
|
+
</body>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
The custom MIME type strategy also comes in as a "fix" for when in a browser or other runtime where the polyfill is not able to intercept `<script scoped>` and `<script stateful>` elements ahead of the runtime - e.g. where...
|
|
511
|
+
|
|
512
|
+
```html
|
|
513
|
+
<body>
|
|
514
|
+
<script scoped>
|
|
515
|
+
console.log(this); // body
|
|
516
|
+
</script>
|
|
517
|
+
</body>
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
...still gives the `window` object in the console.
|
|
521
|
+
|
|
522
|
+
</details>
|
|
523
|
+
|
|
524
|
+
For the Scoped Styles feature, you'd also need something like the [samthor/scoped](https://github.com/samthor/scoped) polyfill (more details below):
|
|
525
|
+
|
|
526
|
+
```html
|
|
527
|
+
<head>
|
|
528
|
+
<script src="https://unpkg.com/style-scoped/scoped.min.js"></script>
|
|
529
|
+
</head>
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
</details>
|
|
533
|
+
|
|
534
|
+
<details><summary>Extended usage concepts</summary>
|
|
535
|
+
|
|
536
|
+
To use the polyfill on server-side DOM instances as made possible by libraries like [jsdom](https://github.com/jsdom/jsdom), simply install and initialize the library `@webqit/oohtml` with the DOM instance:
|
|
537
|
+
|
|
538
|
+
```bash
|
|
539
|
+
npm i @webqit/oohtml
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
```js
|
|
543
|
+
// Import
|
|
544
|
+
import init from '@webqit/oohtml';
|
|
545
|
+
|
|
546
|
+
// Initialize the lib
|
|
547
|
+
init.call( window[, options = {} ]);
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
But all things "SSR" for OOHTML are best left to the [`@webqit/oohtml-ssr`](https://github.com/webqit/oohtml-ssr) package!
|
|
551
|
+
|
|
552
|
+
Also, if you'll be going ahead to build a real app to see OOHTML in action, you may want to consider also using:
|
|
553
|
+
|
|
554
|
+
+ the [`@webqit/oohtml-cli`](https://github.com/webqit/oohtml-cli) package for operating a file-based templating system.
|
|
555
|
+
|
|
556
|
+
+ the modest, OOHTML-based [Webflo](https://github.com/webqit/webflo) framework to greatly streamline your application development process!
|
|
557
|
+
|
|
558
|
+
</details>
|
|
559
|
+
|
|
560
|
+
<details><summary>Implementation Notes</summary>
|
|
561
|
+
|
|
562
|
+
+ **Scoped/Stateful Scripts**. This feature is an extension of [Stateful JS](https://github.com/webqit/stateful-js). The default OOHTML build is based on the [Stateful JS Lite APIs](https://github.com/webqit/stateful-js#stateful-js-lite) and this means that `<script stateful></script>` and `<script scoped></script>` elements are parsed "asynchronously", in the same timing as `<script type="module"></script>`!
|
|
563
|
+
|
|
564
|
+
This timing works perfectly generally, but if you have a requirment to have classic scripts follow their [native synchronous timing](https://html.spec.whatwg.org/multipage/parsing.html#scripts-that-modify-the-page-as-it-is-being-parsed), then you need to the *realtime* OOHTML build:
|
|
565
|
+
|
|
566
|
+
```html
|
|
567
|
+
<head>
|
|
568
|
+
<script src="https://unpkg.com/@webqit/oohtml/dist/main.realtime.js"></script>
|
|
569
|
+
</head>
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
+ **Scoped CSS**. This feature is only in "concept" implementation and doesn't work right now as is. The current implementation simply wraps `<style scoped>` blocks in an `@scope {}` block - which itself isn't supported in any browser. To try this "concept" implementation, set the `style.strategy` config to `@scope`:
|
|
573
|
+
|
|
574
|
+
```html
|
|
575
|
+
<head>
|
|
576
|
+
<meta name="scoped-css" content="style.strategy=@scope"> <!-- Must come before the polyfil -->
|
|
577
|
+
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
578
|
+
<head>
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Now the following `<style scoped>`...
|
|
582
|
+
|
|
583
|
+
```html
|
|
584
|
+
<style scoped>
|
|
585
|
+
h2 { color: red; }
|
|
586
|
+
</style>
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
...will be wrapped to something like:
|
|
590
|
+
|
|
591
|
+
```html
|
|
592
|
+
<style ref="scoped8eff" scoped>
|
|
593
|
+
@scope from (:has(> style[ref="scoped8eff"])) {
|
|
594
|
+
h2 { color: red; }
|
|
595
|
+
}
|
|
596
|
+
</style>
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
A working implementation may be coming soon, but in the meantime, you could try one of the polyfills for `<style scoped>` out there; e.g. [samthor/scoped](https://github.com/samthor/scoped):
|
|
600
|
+
|
|
601
|
+
```html
|
|
602
|
+
<script src="https://unpkg.com/style-scoped/scoped.min.js"></script>
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
+ **HTML Imports**. The attribute names for exposing reusable modules and for referencing them - the `def` and `ref` keywords, respectively - aren't finalized. While the principle of operation remains, these attributes may be renamed in subsequent iterations. But the polyfill is designed to always defer to any syntax that has been explicitly specified using a meta tag. Here's an example:
|
|
606
|
+
|
|
607
|
+
```html
|
|
608
|
+
<head>
|
|
609
|
+
<meta name="html-imports" content="template.attr.moduledef=def; template.attr.fragmentdef=def; import.attr.moduleref=ref;"> <!-- Must come before the polyfil -->
|
|
610
|
+
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
611
|
+
<head>
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Now, even when the default attribute names change, your `def` and `ref` implementation will still work:
|
|
615
|
+
|
|
616
|
+
</details>
|
|
617
|
+
|
|
618
|
+
## Examples
|
|
619
|
+
|
|
620
|
+
Here are a few examples in the wide range of use cases these features cover.
|
|
621
|
+
|
|
622
|
+
+ [Example 1: *Single Page Application*](#example-1-single-page-application)
|
|
623
|
+
+ [Example 2: *Multi-Level Namespacing*](#example-2-multi-level-namespacing)
|
|
624
|
+
+ [Example 3: *Dynamic Shadow DOM*](#example-3-dynamic-shadow-dom)
|
|
625
|
+
+ [Example 4: *List Items*](#example-4-list-items)
|
|
626
|
+
|
|
627
|
+
### Example 1: *Single Page Application*
|
|
628
|
+
|
|
629
|
+
The following is how something you could call a Single Page Application ([SPA](https://en.wikipedia.org/wiki/Single-page_application)) could be made - with zero tooling:
|
|
486
630
|
|
|
487
631
|
└ *First, two components that are themselves analogous to a Single File Component ([SFC](https://vuejs.org/guide/scaling-up/sfc.html))*:
|
|
488
632
|
|
|
633
|
+
<details><summary>Code</summary>
|
|
634
|
+
|
|
489
635
|
```html
|
|
490
636
|
<template def="pages">
|
|
491
637
|
|
|
@@ -519,8 +665,12 @@ All of OOHTML brings to the platform much of the modern UI development paradigms
|
|
|
519
665
|
</template>
|
|
520
666
|
```
|
|
521
667
|
|
|
668
|
+
</details>
|
|
669
|
+
|
|
522
670
|
└ *Then a 2-line router that alternates the view based on the URL hash*:
|
|
523
671
|
|
|
672
|
+
<details><summary>Code</summary>
|
|
673
|
+
|
|
524
674
|
```html
|
|
525
675
|
<body importscontext="/pages/home">
|
|
526
676
|
|
|
@@ -536,9 +686,13 @@ All of OOHTML brings to the platform much of the modern UI development paradigms
|
|
|
536
686
|
</body>
|
|
537
687
|
```
|
|
538
688
|
|
|
539
|
-
|
|
689
|
+
</details>
|
|
690
|
+
|
|
691
|
+
### Example 2: *Multi-Level Namespacing*
|
|
692
|
+
|
|
693
|
+
The following is a Listbox component lifted directly from the [ARIA Authoring Practices Guide (APG)](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-grouped/#sc_label) but with IDs effectively "contained" at different levels within the component using the `namespace` attribute.
|
|
540
694
|
|
|
541
|
-
|
|
695
|
+
<details><summary>Code</summary>
|
|
542
696
|
|
|
543
697
|
```html
|
|
544
698
|
<div namespace class="listbox-area">
|
|
@@ -603,10 +757,16 @@ All of OOHTML brings to the platform much of the modern UI development paradigms
|
|
|
603
757
|
</div>
|
|
604
758
|
```
|
|
605
759
|
|
|
606
|
-
|
|
760
|
+
</details>
|
|
761
|
+
|
|
762
|
+
### Example 3: *Dynamic Shadow DOM*
|
|
763
|
+
|
|
764
|
+
The following is a custom element that derives its Shadow DOM from an imported `<tenplate>` element. The idea is to have different Shadow DOM layouts defined and let the "usage" context decide which variant is imported!
|
|
607
765
|
|
|
608
766
|
└ *First, two layout options defined for the Shadow DOM*:
|
|
609
767
|
|
|
768
|
+
<details><summary>Code</summary>
|
|
769
|
+
|
|
610
770
|
```html
|
|
611
771
|
<template def="vendor1">
|
|
612
772
|
|
|
@@ -625,8 +785,12 @@ All of OOHTML brings to the platform much of the modern UI development paradigms
|
|
|
625
785
|
</template>
|
|
626
786
|
```
|
|
627
787
|
|
|
788
|
+
</details>
|
|
789
|
+
|
|
628
790
|
└ *Next, the Shadow DOM creation that imports its layout from context*:
|
|
629
791
|
|
|
792
|
+
<details><summary>Code</summary>
|
|
793
|
+
|
|
630
794
|
```js
|
|
631
795
|
customElements.define('magic-button', class extends HTMLElement {
|
|
632
796
|
connectedCallback() {
|
|
@@ -638,8 +802,12 @@ customElements.define('magic-button', class extends HTMLElement {
|
|
|
638
802
|
});
|
|
639
803
|
```
|
|
640
804
|
|
|
805
|
+
</details>
|
|
806
|
+
|
|
641
807
|
└ *Then, the part where we just drop the component in "layout" contexts*:
|
|
642
808
|
|
|
809
|
+
<details><summary>Code</summary>
|
|
810
|
+
|
|
643
811
|
```html
|
|
644
812
|
<div contextname="vendor1" importscontext="/vendor1/components-layout1">
|
|
645
813
|
|
|
@@ -652,9 +820,13 @@ customElements.define('magic-button', class extends HTMLElement {
|
|
|
652
820
|
</div>
|
|
653
821
|
```
|
|
654
822
|
|
|
655
|
-
|
|
823
|
+
</details>
|
|
656
824
|
|
|
657
|
-
|
|
825
|
+
### Example 4: *List Items*
|
|
826
|
+
|
|
827
|
+
The following is a "component" that derives its list items and other reusable snippets from "scoped" `<tenplate>` elements. The idea is to have a "self-contained" component that's all markup-based, not class-based!
|
|
828
|
+
|
|
829
|
+
<details><summary>Code</summary>
|
|
658
830
|
|
|
659
831
|
```html
|
|
660
832
|
<div namespace>
|
|
@@ -683,148 +855,8 @@ customElements.define('magic-button', class extends HTMLElement {
|
|
|
683
855
|
</div>
|
|
684
856
|
```
|
|
685
857
|
|
|
686
|
-
## The Polyfill
|
|
687
|
-
|
|
688
|
-
OOHTML is being developed as something to be used today - via a polyfill. This has been helping to facilitate the "release - iterations" loop and its overall evolution.
|
|
689
|
-
|
|
690
|
-
The polyfill can be loaded from the `unpkg.com` CDN, and should be placed early on in the document - before any OOHTML-specific features are used - and should be a classic script without any `defer` or `async` directives:
|
|
691
|
-
|
|
692
|
-
```html
|
|
693
|
-
<head>
|
|
694
|
-
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
695
|
-
</head>
|
|
696
|
-
```
|
|
697
|
-
|
|
698
|
-
> 22.5 kB min + gz | 77.5 KB min [↗](https://bundlephobia.com/package/@webqit/oohtml@2.1.45)
|
|
699
|
-
|
|
700
|
-
<details><summary>
|
|
701
|
-
Extended usage concepts
|
|
702
|
-
</summary>
|
|
703
|
-
|
|
704
|
-
If you must load the script "async", one little trade-off has to be made for `<script scoped>` and `<script stateful>` elements to have them ignored by the browser until the polyfill comes picking them up: *employing a custom MIME type in place of the standard `text/javascript` and `module` types*, in which case, a `<meta name="scoped-js">` element is used to configure the polyfill to honor the custom MIME type:
|
|
705
|
-
|
|
706
|
-
```html
|
|
707
|
-
<head>
|
|
708
|
-
<meta name="scoped-js" content="script.mimeType=some-mime">
|
|
709
|
-
<script async src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
710
|
-
</head>
|
|
711
|
-
<body>
|
|
712
|
-
<script type="some-mime" scoped>
|
|
713
|
-
console.log(this); // body
|
|
714
|
-
</script>
|
|
715
|
-
</body>
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
The custom MIME type strategy also comes in as a "fix" for when in a browser or other runtime where the polyfill is not able to intercept `<script scoped>` and `<script stateful>` elements ahead of the runtime - e.g. where...
|
|
719
|
-
|
|
720
|
-
```html
|
|
721
|
-
<body>
|
|
722
|
-
<script scoped>
|
|
723
|
-
console.log(this); // body
|
|
724
|
-
</script>
|
|
725
|
-
</body>
|
|
726
|
-
```
|
|
727
|
-
|
|
728
|
-
...still gives the `window` object in the console.
|
|
729
|
-
|
|
730
|
-
To use the polyfill on server-side DOM instances as made possible by libraries like [jsdom](https://github.com/jsdom/jsdom), simply install and initialize the library `@webqit/oohtml` with the DOM instance:
|
|
731
|
-
|
|
732
|
-
```bash
|
|
733
|
-
npm i @webqit/oohtml
|
|
734
|
-
```
|
|
735
|
-
|
|
736
|
-
```js
|
|
737
|
-
// Import
|
|
738
|
-
import init from '@webqit/oohtml';
|
|
739
|
-
|
|
740
|
-
// Initialize the lib
|
|
741
|
-
init.call( window[, options = {} ]);
|
|
742
|
-
```
|
|
743
|
-
|
|
744
|
-
But all things "SSR" for OOHTML are best left to the [`@webqit/oohtml-ssr`](https://github.com/webqit/oohtml-ssr) package!
|
|
745
|
-
|
|
746
|
-
Also, if you'll be going ahead to build a real world app to see OOHTML in action, you may want to consider also using:
|
|
747
|
-
|
|
748
|
-
+ the [`@webqit/oohtml-cli`](https://github.com/webqit/oohtml-cli) package for operating a file-based templating system.
|
|
749
|
-
|
|
750
|
-
+ the modest, OOHTML-based [Webflo](https://github.com/webqit/webflo) framework to greatly streamline your application development process!
|
|
751
|
-
|
|
752
858
|
</details>
|
|
753
859
|
|
|
754
|
-
<details><summary>
|
|
755
|
-
Implementation Notes
|
|
756
|
-
</summary>
|
|
757
|
-
|
|
758
|
-
Here are some performance-specific notes for this polyfill:
|
|
759
|
-
|
|
760
|
-
+ By default, the Stateful JS compiler (44.31 KB min+compressed | 157KB min) is excluded from the polyfill build and fetched separately on demand - on the first encounter with a Stateful Script. This is loaded into a [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) and all compilations are able to happen off the main thread! This ensures near-zero cost to your application loading and runtime performance!
|
|
761
|
-
|
|
762
|
-
Note that this lazy-loading approach means that all Stateful Scripts will behave "async" just like module scripts; i.e. scripts are defered until the compiler has been loaded. In other words, the following two scripts will have the same timing semantics:
|
|
763
|
-
|
|
764
|
-
```html
|
|
765
|
-
<script stateful></script>
|
|
766
|
-
<script type="module" stateful></script>
|
|
767
|
-
```
|
|
768
|
-
|
|
769
|
-
This isn't necessarily bad unless there is a requirment to have classic scripts follow their [native synchronous timing](https://html.spec.whatwg.org/multipage/parsing.html#scripts-that-modify-the-page-as-it-is-being-parsed), in which case the Stateful JS compiler will need to be explicitly and synchronously loaded ahead of any encounter with classic Stateful Scripts:
|
|
770
|
-
|
|
771
|
-
```html
|
|
772
|
-
<head>
|
|
773
|
-
<script src="https://unpkg.com/@webqit/stateful-js/dist/compiler.js"></script> <!-- Must come before the polyfil -->
|
|
774
|
-
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
775
|
-
</head>
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
+ Whether loaded lazily or eagerly, the compiler also factors in additional optimizations. For example, identical scripts are handled only first time, and only ever have one Stateful JS instance!
|
|
779
|
-
|
|
780
|
-
Here are other notes:
|
|
781
|
-
|
|
782
|
-
+ **Scoped CSS**. This feature is only in "concept" implementation and doesn't work right now as is. The current implementation simply wraps `<style scoped>` blocks in an `@scope {}` block - which itself isn't supported in any browser. To try this "concept" implementation, set the `style.strategy` config to `@scope`:
|
|
783
|
-
|
|
784
|
-
```html
|
|
785
|
-
<head>
|
|
786
|
-
<meta name="scoped-css" content="style.strategy=@scope"> <!-- Must come before the polyfil -->
|
|
787
|
-
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
788
|
-
<head>
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
Now the following `<style scoped>`...
|
|
792
|
-
|
|
793
|
-
```html
|
|
794
|
-
<style scoped>
|
|
795
|
-
h2 { color: red; }
|
|
796
|
-
</style>
|
|
797
|
-
```
|
|
798
|
-
|
|
799
|
-
...will be wrapped to something like:
|
|
800
|
-
|
|
801
|
-
```html
|
|
802
|
-
<style ref="scoped8eff" scoped>
|
|
803
|
-
@scope from (:has(> style[ref="scoped8eff"])) {
|
|
804
|
-
h2 { color: red; }
|
|
805
|
-
}
|
|
806
|
-
</style>
|
|
807
|
-
```
|
|
808
|
-
|
|
809
|
-
A working implementation may be coming soon, but in the meantime, you could try one of the polyfills for `<style scoped>` out there; e.g. [samthor/scoped](https://github.com/samthor/scoped).
|
|
810
|
-
|
|
811
|
-
+ **HTML Imports**. The attribute names for exposing reusable modules and for referencing them - the `def` and `ref` keywords, respectively - aren't finalized. While the principle of operation remains, these attributes may be renamed in subsequent iterations. But the polyfill is designed to always defer to any syntax that has been explicitly specified using a meta tag. Here's an example:
|
|
812
|
-
|
|
813
|
-
```html
|
|
814
|
-
<head>
|
|
815
|
-
<meta name="html-imports" content="template.attr.moduledef=def; template.attr.fragmentdef=def; import.attr.moduleref=ref;"> <!-- Must come before the polyfil -->
|
|
816
|
-
<script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
|
|
817
|
-
<head>
|
|
818
|
-
```
|
|
819
|
-
|
|
820
|
-
Now, even when the default attribute names change, your `def` and `ref` implementation will still work:
|
|
821
|
-
|
|
822
|
-
</details>
|
|
823
|
-
|
|
824
|
-
## Design Discussion
|
|
825
|
-
|
|
826
|
-
*[TODO]*
|
|
827
|
-
|
|
828
860
|
## Getting Involved
|
|
829
861
|
|
|
830
862
|
All forms of contributions are welcome at this time. For example, syntax and other implementation details are all up for discussion. Also, help is needed with more formal documentation. And here are specific links:
|