@getvitops/core 6.0.0 → 8.0.0
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/CHANGELOG.md +332 -15
- package/css/animation.css +9 -0
- package/css/global.css +28 -0
- package/css/index.css +4 -0
- package/css/patterns/counter.css +50 -0
- package/css/patterns/forms.css +1 -1
- package/css/patterns/gallery.css +64 -0
- package/css/patterns/lightbox.css +97 -98
- package/css/patterns/list.css +1 -1
- package/css/patterns/review.css +91 -0
- package/css/patterns/tag.css +1 -2
- package/css/patterns/tree.css +111 -8
- package/css/utilities.css +17 -0
- package/dist/elements.js +7 -844
- package/dist/polyfills/invokers-polyfill.js +1 -0
- package/dist/polyfills/template-shadowroot.js +1 -14
- package/dist/polyfills.js +1 -1
- package/package.json +19 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function t(){document.addEventListener(`invoke`,e=>{e.type==`invoke`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0),document.addEventListener(`command`,e=>{e.type==`command`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0);function e(e,t,n=!0){Object.defineProperty(e,t,{...Object.getOwnPropertyDescriptor(e,t),enumerable:n})}function t(e){return e&&typeof e.getRootNode==`function`?e.getRootNode():e&&e.parentNode?t(e.parentNode):e}let n=new WeakMap,r=new WeakMap;class i extends Event{constructor(e,t={}){super(e,t);let{source:i,command:a}=t;if(i!=null&&!(i instanceof Element))throw TypeError(`source must be an element`);n.set(this,i||null),r.set(this,a===void 0?``:String(a))}get[Symbol.toStringTag](){return`CommandEvent`}get source(){if(!n.has(this))throw TypeError(`illegal invocation`);let e=n.get(this);if(!(e instanceof Element))return null;let r=t(e);return r===t(this.target||document)?e:r.host}get command(){if(!r.has(this))throw TypeError(`illegal invocation`);return r.get(this)}}e(i.prototype,`source`),e(i.prototype,`command`);let a=new WeakMap;function o(e){Object.defineProperties(e.prototype,{commandForElement:{enumerable:!0,configurable:!0,set(e){if(e===null)this.removeAttribute(`commandfor`),a.delete(this);else if(e instanceof Element){this.setAttribute(`commandfor`,``);let n=t(e);t(this)===n||n===this.ownerDocument?a.set(this,e):a.delete(this)}else throw TypeError(`commandForElement must be an element or null`)},get(){if(this.localName!==`button`||this.disabled)return null;if(this.form&&this.getAttribute(`type`)!==`button`)return console.warn("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work"),null;let e=a.get(this);if(e)return e.isConnected?e:(a.delete(this),null);let n=t(this),r=this.getAttribute(`commandfor`);return(n instanceof Document||n instanceof ShadowRoot)&&r&&n.getElementById(r)||null}},command:{enumerable:!0,configurable:!0,get(){let e=this.getAttribute(`command`)||``;if(e.startsWith(`--`))return e;let t=e.toLowerCase();switch(t){case`show-modal`:case`request-close`:case`close`:case`toggle-popover`:case`hide-popover`:case`show-popover`:return t}return``},set(e){this.setAttribute(`command`,e)}}})}let s=new WeakMap;Object.defineProperties(HTMLElement.prototype,{oncommand:{enumerable:!0,configurable:!0,get(){return l.takeRecords(),s.get(this)||null},set(e){let t=s.get(this)||null;t&&this.removeEventListener(`command`,t),s.set(this,typeof e==`object`||typeof e==`function`?e:null),typeof e==`function`&&this.addEventListener(`command`,e)}}});function c(e){for(let t of e)t.oncommand=Function(`event`,t.getAttribute(`oncommand`))}let l=new MutationObserver(e=>{for(let t of e){let{target:e}=t;t.type===`childList`?c(e.querySelectorAll(`[oncommand]`)):c([e])}});l.observe(document,{subtree:!0,childList:!0,attributeFilter:[`oncommand`]}),c(document.querySelectorAll(`[oncommand]`));let u=new WeakSet;function d(e){if(u.has(e)||(u.add(e),e.defaultPrevented)||e.type!==`click`)return;let t=e.composedPath().find(e=>e.matches?.(`button[commandfor], button[command]`));if(!t)return;if(t.form&&t.getAttribute(`type`)!==`button`)throw e.preventDefault(),Error("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work. In order for it to act as a Submit button, it must not have command or commandfor attributes");if(t.hasAttribute(`command`)!==t.hasAttribute(`commandfor`)){let e=t.hasAttribute(`command`)?`command`:`commandfor`,n=t.hasAttribute(`command`)?`commandfor`:`command`;throw Error(`Element with ${e} attribute must also have a ${n} attribute to function.`)}if(t.command!==`show-popover`&&t.command!==`hide-popover`&&t.command!==`toggle-popover`&&t.command!==`show-modal`&&t.command!==`request-close`&&t.command!==`close`&&!t.command.startsWith(`--`)){console.warn(`"${t.command}" is not a valid command value. Custom commands must begin with --`);return}let n=t.commandForElement;if(!n)return;let r=new i(`command`,{command:t.command,source:t,cancelable:!0});if(n.dispatchEvent(r),r.defaultPrevented)return;let a=r.command.toLowerCase();if(n.popover){let e=!n.matches(`:popover-open`);e&&(a===`toggle-popover`||a===`show-popover`)?n.showPopover({source:t}):!e&&a===`hide-popover`&&n.hidePopover()}else if(n.localName===`dialog`){let e=!n.hasAttribute(`open`);e&&a==`show-modal`?n.showModal():!e&&a==`close`?n.close(t.value?t.value:void 0):!e&&a==`request-close`&&(HTMLDialogElement.prototype.requestClose||(HTMLDialogElement.prototype.requestClose=function(){let e=new Event(`cancel`,{cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||this.close()}),n.requestClose(t.value?t.value:void 0))}}function f(e){e.addEventListener(`click`,d,!0)}function p(e,t){let n=e.prototype.attachShadow;e.prototype.attachShadow=function(e){let r=n.call(this,e);return t(r),r};let r=e.prototype.attachInternals;e.prototype.attachInternals=function(){let e=r.call(this);return e.shadowRoot&&t(e.shadowRoot),e}}o(HTMLButtonElement),p(HTMLElement,e=>{f(e),l.observe(e,{attributeFilter:[`oncommand`]}),c(e.querySelectorAll(`[oncommand]`))}),f(document),Object.assign(globalThis,{CommandEvent:i})}e()||t();
|
|
@@ -3,22 +3,9 @@
|
|
|
3
3
|
* Copyright 2020 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
let e;function t(){return e===void 0&&(e=!!new DOMParser().parseFromString(`<div><template shadowrootmode="open"></template></div>`,`text/html`,{includeShadowRoots:!0}).querySelector(`div`)?.shadowRoot),e}
|
|
7
6
|
/**
|
|
8
7
|
* @license
|
|
9
8
|
* Copyright 2019 Google LLC
|
|
10
9
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
10
|
*/
|
|
12
|
-
const n=e=>e.parentElement===null,r=e=>e.tagName===`TEMPLATE`,i=e=>e.nodeType===Node.ELEMENT_NODE,a=e=>{
|
|
13
|
-
/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright 2019 Google LLC
|
|
16
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/
|
|
18
|
-
if(t())return;let a=[],o=e.firstElementChild;for(;o!==e&&o!==null;)if(r(o))a.push(o),o=o.content;else if(o.firstElementChild!==null)o=o.firstElementChild;else if(i(o)&&o.nextElementSibling!==null)o=o.nextElementSibling;else{let t;for(;o!==e&&o!==null;)if(n(o)){t=a.pop();let e=t.parentElement,n=t.getAttribute(`shadowrootmode`);if(o=t,n===`open`||n===`closed`){let r=t.hasAttribute(`shadowrootdelegatesfocus`);try{e.attachShadow({mode:n,delegatesFocus:r}).append(t.content)}catch{}}else t=void 0}else{let e=o.nextElementSibling;if(e!=null){o=e,t!==void 0&&t.parentElement.removeChild(t);break}let n=o.parentElement?.nextElementSibling;if(n!=null){o=n,t!==void 0&&t.parentElement.removeChild(t);break}o=o.parentElement,t!==void 0&&(t.parentElement.removeChild(t),t=void 0)}}};
|
|
19
|
-
/**
|
|
20
|
-
* @license
|
|
21
|
-
* Copyright 2019 Google LLC
|
|
22
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/
|
|
24
|
-
export{a as hydrateShadowRoots};
|
|
11
|
+
let e;function t(){return e===void 0&&(e=!!new DOMParser().parseFromString(`<div><template shadowrootmode="open"></template></div>`,`text/html`,{includeShadowRoots:!0}).querySelector(`div`)?.shadowRoot),e}const n=e=>e.parentElement===null,r=e=>e.tagName===`TEMPLATE`,i=e=>e.nodeType===Node.ELEMENT_NODE,a=e=>{if(t())return;let a=[],o=e.firstElementChild;for(;o!==e&&o!==null;)if(r(o))a.push(o),o=o.content;else if(o.firstElementChild!==null)o=o.firstElementChild;else if(i(o)&&o.nextElementSibling!==null)o=o.nextElementSibling;else{let t;for(;o!==e&&o!==null;)if(n(o)){t=a.pop();let e=t.parentElement,n=t.getAttribute(`shadowrootmode`);if(o=t,n===`open`||n===`closed`){let r=t.hasAttribute(`shadowrootdelegatesfocus`);try{e.attachShadow({mode:n,delegatesFocus:r}).append(t.content)}catch{}}else t=void 0}else{let e=o.nextElementSibling;if(e!=null){o=e,t!==void 0&&t.parentElement.removeChild(t);break}let n=o.parentElement?.nextElementSibling;if(n!=null){o=n,t!==void 0&&t.parentElement.removeChild(t);break}o=o.parentElement,t!==void 0&&(t.parentElement.removeChild(t),t=void 0)}}};export{a as hydrateShadowRoots};
|
package/dist/polyfills.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>{try{return typeof CSS<`u`&&CSS.supports(e)}catch{return!1}},t=[{name:`webcomponents`,test:()=>`customElements`in window&&`attachShadow`in Element.prototype,load:()=>import(`./polyfills/webcomponents-bundle.js`)},{name:`template-shadowroot`,test:()=>`shadowRootMode`in HTMLTemplateElement.prototype,load:async()=>{let{hydrateShadowRoots:e}=await import(`./polyfills/template-shadowroot.js`);e(document.body)}},{name:`temporal`,test:()=>`Temporal`in globalThis,load:()=>import(`./polyfills/global.esm.js`)},{name:`popover`,test:()=>`popover`in HTMLElement.prototype,load:()=>import(`./polyfills/popover.js`)},{name:`constructed-stylesheets`,test:()=>`adoptedStyleSheets`in Document.prototype,load:()=>import(`./polyfills/adoptedStyleSheets.js`)}],n=[{name:`css-anchor-positioning`,test:()=>e(`anchor-name: --x`),load:async()=>(await import(`./polyfills/css-anchor-positioning-fn.js`)).default()}],r=`polyfills:degraded`;async function i(e=t){let n=e.filter(({test:e})=>!e()),i=await Promise.allSettled(n.map(({load:e})=>e())),a=[];i.forEach((e,t)=>{let r=n[t];r&&e.status===`rejected`&&(a.push({name:r.name,reason:e.reason}),console.warn(`[polyfills] failed to load "${r.name}":`,e.reason))}),a.length&&window.dispatchEvent(new CustomEvent(r,{detail:{failures:a}}))}typeof document<`u`&&(i(t),document.addEventListener(`DOMContentLoaded`,()=>i(n)));export{r as POLYFILL_DEGRADED_EVENT,i as loadPolyfills,t as prerenderPolyfills};
|
|
1
|
+
const e=e=>{try{return typeof CSS<`u`&&CSS.supports(e)}catch{return!1}},t=[{name:`webcomponents`,test:()=>`customElements`in window&&`attachShadow`in Element.prototype,load:()=>import(`./polyfills/webcomponents-bundle.js`)},{name:`template-shadowroot`,test:()=>`shadowRootMode`in HTMLTemplateElement.prototype,load:async()=>{let{hydrateShadowRoots:e}=await import(`./polyfills/template-shadowroot.js`);e(document.body)}},{name:`temporal`,test:()=>`Temporal`in globalThis,load:()=>import(`./polyfills/global.esm.js`)},{name:`popover`,test:()=>`popover`in HTMLElement.prototype,load:()=>import(`./polyfills/popover.js`)},{name:`constructed-stylesheets`,test:()=>`adoptedStyleSheets`in Document.prototype,load:()=>import(`./polyfills/adoptedStyleSheets.js`)},{name:`invoker-commands`,test:()=>`command`in HTMLButtonElement.prototype,load:()=>import(`./polyfills/invokers-polyfill.js`)}],n=[{name:`css-anchor-positioning`,test:()=>e(`anchor-name: --x`),load:async()=>(await import(`./polyfills/css-anchor-positioning-fn.js`)).default()}],r=`polyfills:degraded`;async function i(e=t){let n=e.filter(({test:e})=>!e()),i=await Promise.allSettled(n.map(({load:e})=>e())),a=[];i.forEach((e,t)=>{let r=n[t];r&&e.status===`rejected`&&(a.push({name:r.name,reason:e.reason}),console.warn(`[polyfills] failed to load "${r.name}":`,e.reason))}),a.length&&window.dispatchEvent(new CustomEvent(r,{detail:{failures:a}}))}typeof document<`u`&&(i(t),document.addEventListener(`DOMContentLoaded`,()=>i(n)));export{r as POLYFILL_DEGRADED_EVENT,i as loadPolyfills,t as prerenderPolyfills};
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "The Vitops design-system framework — CSS partials, Lit web components, and browser polyfills.",
|
|
5
|
+
"homepage": "https://docs.vitops.ca",
|
|
6
|
+
"bugs": "https://github.com/getvitops/design-system/issues",
|
|
5
7
|
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/getvitops/design-system.git",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
6
13
|
"files": [
|
|
7
14
|
"dist",
|
|
8
15
|
"css",
|
|
@@ -21,7 +28,7 @@
|
|
|
21
28
|
"publishConfig": {
|
|
22
29
|
"access": "public"
|
|
23
30
|
},
|
|
24
|
-
"
|
|
31
|
+
"devDependencies": {
|
|
25
32
|
"@lit-labs/signals": "^0.3.0",
|
|
26
33
|
"@oddbird/css-anchor-positioning": "^0.9.0",
|
|
27
34
|
"@oddbird/popover-polyfill": "^0.7.0",
|
|
@@ -29,13 +36,19 @@
|
|
|
29
36
|
"@webcomponents/webcomponentsjs": "^2.8.0",
|
|
30
37
|
"colorjs.io": "^0.5.2",
|
|
31
38
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
39
|
+
"cssnano": "^8.0.5",
|
|
40
|
+
"happy-dom": "^20.0.0",
|
|
41
|
+
"invokers-polyfill": "^1.0.3",
|
|
32
42
|
"lit": "^3.3.3",
|
|
43
|
+
"minify-html-literals": "^1.3.5",
|
|
44
|
+
"postcss": "^8.5.26",
|
|
45
|
+
"postcss-lit": "^1.4.1",
|
|
33
46
|
"scroll-timeline-polyfill": "^1.1.0",
|
|
34
47
|
"temporal-polyfill": "^1.0.1",
|
|
35
|
-
"
|
|
48
|
+
"vitest": "4.1.9",
|
|
49
|
+
"@getvitops/utils": "8.0.0"
|
|
36
50
|
},
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"vitest": "^4.1.9"
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=24"
|
|
40
53
|
}
|
|
41
54
|
}
|