quark-sheet
Drop a Quark sheet next to your markup — bind, render, and react without a component runtime.
Features
- Sibling scope Sheet + targets share a parent — Quark watches that host
- Global sheets
is-globalruns top-level rules document-wide - Inline or remote Paste Quark in the element, or load
src-url - Lifecycle state
is-loading/is-success/is-error+ matching events (fromloadable-element ) - Reload The
--reloadcommand drops the shared cache entry forsrc-urland fetches again - Auto (un)register Connect registers; disconnect tears down cleanly
Installation
This package is available in the
<script src="https://unpkg.com/@excom/kit-utils@0.3.0/dist/index.umd.min.js"></script>
<script src="https://unpkg.com/@excom/neutron@0.2.0/dist/index.umd.min.js"></script>
<script src="https://unpkg.com/@excom/quark-sheet@0.2.1/dist/index.umd.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@excom/quark-sheet@0.2.1/dist/index.css">npm install @excom/quark-sheet<!-- import path to `node_modules` will depend on your build setup -->
<script type="module" src="/node_modules/@excom/quark-sheet"></script>
<link rel="stylesheet" href="/node_modules/@excom/quark-sheet">import "@excom/quark-sheet";@import "@excom/quark-sheet/index.css";Peer dependencies (0)
Packages a consumer must install alongside this one. Workspace deps are bundled.
| Package | Version |
|---|---|
|
Usage
Place <quark-sheet> under the same parent as the elements it should orchestrate.
Inline Quark text is enough for most apps. An inline sheet reads its text when it connects, so load the scripts with defer, as a module script, or after the markup (end of <body>); a plain <script src> in <head> leaves it dead. A src-url sheet is not affected.
<section>
<quark-sheet>
details[open] summary { content: "Panel Open"; }
details:not([open]) summary { content: "Panel Closed"; }
</quark-sheet>
<details>
<summary></summary>
<p>This is the panel content.</p>
</details>
</section><section>
<quark-sheet>
details[open] summary { content: "Panel Open"; }
details:not([open]) summary { content: "Panel Closed"; }
</quark-sheet>
<details>
<summary></summary>
<p>This is the panel content.</p>
</details>
</section>By default the sheet is scoped to its parent. Add is-global to run
top-level rules in the root context (e.g. reading a provider above the
host); rules inside an explicit @scope { } block stay host-scoped either
way. Language details live in the quark
An inline sheet is HTML content: a browser reads < followed by a letter, /, ! or ? as markup, in a sheet comment or string too, and a <title> or <textarea> there takes the rest of the page as its text (the sheet fails with a parse error far from the cause). Keep such text out of an inline sheet, or load the sheet with src-url.
For @excom/quark-sheet/server exports settle, the hook that holds a page until its sheets are quiet. @excom/nucleus-kit/server already has it.
API Reference
Attributes
Role —option is configurable, state
is managed by the element (read-only), or hybrid which is both.
Provision
Thisprovision property lives on the DOM node.
Read / watch it with Quark’s prop("provision"), or listen
for the neutron-provision event from app JS.
Events
Type
command event (HTML Command API): from a
<button command commandfor>, an <event-handler
command-name>, or a CommandEvent.
Recognized Elements
Child or descendant elements are recognized by and relevant to its functionality.Styles
@custom-selector synonyms so custom elements can share
semantic styles. Element aliases match the host tag / .tag-* class; state
aliases match attributes (nested under the element alias).
quark-sheet
Attributes (10)
Role —option is configurable, state
is managed by the element (read-only), or hybrid which is both.
is-global
@scope { }. Rules nested inside an explicit @scope { } block remain scoped to the host either way.
isGlobal
boolean
falsesrc-url
.quark / text sheet. When set, contents are fetched into the live sheet (replacing inline text).
srcUrl
string
<URL>nulldid-load
[did-load] rather than [is-success]. Cleared on error.
didLoad
boolean
falseis-error
isError
boolean
falseis-error
is-loading and is-success.
isError
boolean
falseis-loading
isLoading
boolean
falseis-loading
isLoading
boolean
falseis-success
isSuccess
boolean
falseis-success
is-loading and is-error.
isSuccess
boolean
falsequark-instance
Quark instance while registered.
quarkInstance
Quark
nullProvision (1)
Thisprovision property lives on the DOM node.
Read / watch it with Quark’s prop("provision"), or listen
for the neutron-provision event from app JS.
provision
provision
unknown
Events (7)
e.preventDefault() is not
synchronously called on the event.
Type
quark-sheet-error
is-error). event.detail is the error.
Type
QuarkSheetErrorEvent
quark-sheet-error
is-error is set. event.detail is the error payload (also stored as provision).
Type
LoadableErrorEvent
quark-sheet-loading
is-loading becomes true (fetch in flight).
Type
QuarkSheetLoadingEvent
quark-sheet-loading
is-loading is set (work started).
Type
LoadableLoadingEvent
quark-sheet-success
is-success).
Type
QuarkSheetSuccessEvent
quark-sheet-success
is-success is set. event.detail is the new provision.
Type
LoadableSuccessEvent
command event (HTML Command API): from a
<button command commandfor>, an <event-handler
command-name>, or a CommandEvent.
--reloadsrc-url and fetches the sheet again (the cache is page-wide: every element loading the same URL shares it). No-op without src-url.
Recognized Elements (0)
Child or descendant elements are recognized by quark-sheet and relevant to its functionality.Styles (1)
all: revert-layer.
Valence.css ships this as .unstyled and .unstyled-all for the entire tree.
@custom-selector synonyms so custom elements can share
semantic styles. Element aliases match the host tag / .tag-* class; state
aliases match attributes (nested under the element alias).
:--quark-sheetquark-sheet, .tag-quark-sheetRelease notes (2)
0.2.0
- Add
@excom/quark-sheet/server, which exportssettle: the prerender hook that holds a page until its sheets are quiet, without the 1 s limit ofQuark.whenSettled()
0.1.1
- Ship only dist (and declared extras) in the npm tarball; drop build logs, tests and sources
Release notes
e.preventDefault() is not
synchronously called on the event.
all: revert-layer.
Valence.css ships this as .unstyled and .unstyled-all for the entire tree.
Examples
Provider data
prop("provision") reads a <provider-fetch> provision on success and fills a title.