smoothly 0.3.32 → 1.0.0-alpha.1
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/dist/cjs/{Trigger-3443997e.js → Listenable-c8d2f8ef.js} +55 -0
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/smoothly-accordion_53.cjs.entry.js +7 -7
- package/dist/cjs/smoothly-trigger-sink.cjs.entry.js +3 -3
- package/dist/cjs/smoothly-trigger-source.cjs.entry.js +3 -3
- package/dist/collection/index.js +1 -1
- package/dist/custom-elements/index.js +55 -1
- package/dist/esm/{Trigger-327e506e.js → Listenable-55a1f6af.js} +55 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/smoothly-accordion_53.entry.js +1 -1
- package/dist/esm/smoothly-trigger-sink.entry.js +1 -1
- package/dist/esm/smoothly-trigger-source.entry.js +1 -1
- package/dist/smoothly/index.esm.js +1 -1
- package/dist/smoothly/p-156763cd.js +1 -0
- package/dist/smoothly/{p-eb4e2500.entry.js → p-4a78c705.entry.js} +1 -1
- package/dist/smoothly/{p-f97fcb32.entry.js → p-4fecfc5d.entry.js} +1 -1
- package/dist/smoothly/{p-c9bb4a18.entry.js → p-96e8781a.entry.js} +1 -1
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +93 -93
- package/dist/smoothly/p-b1c579b3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,h as i}from"./p-4a0b35b7.js";import{T as t,M as r}from"./p-
|
|
1
|
+
import{r as s,h as i}from"./p-4a0b35b7.js";import{T as t,M as r}from"./p-156763cd.js";import"./p-bd478a53.js";const o=class{constructor(i){s(this,i),this.context=void 0,this.destination=void 0,this.filter=void 0}get filters(){return this.filtersValue||(this.filtersValue=this.filter?this.filter.split(" "):[]),this.filtersValue}TriggerListener(s){t.is(s.detail)&&this.filters.some((i=>i==s.detail.name))&&(r.send(this.destination,s.detail,this.context||window),s.preventDefault(),s.stopPropagation())}render(){return i("slot",null)}};o.style=".sc-smoothly-trigger-sink-h{display:block}[hidden].sc-smoothly-trigger-sink-h{display:none}";export{o as smoothly_trigger_sink}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,c as t,h as o,a as r}from"./p-4a0b35b7.js";import{M as i,T as e}from"./p-
|
|
1
|
+
import{r as s,c as t,h as o,a as r}from"./p-4a0b35b7.js";import{M as i,T as e}from"./p-156763cd.js";import"./p-bd478a53.js";const n=class{constructor(o){s(this,o),this.trigger=t(this,"trigger",7),this.message=t(this,"message",7),this.listen=void 0}componentDidLoad(){i.listen(this.listen,((s,t)=>{e.is(t)?this.trigger.emit(t):this.message.emit({destination:s,content:t})}),window)}render(){return o("slot",null)}get element(){return r(this)}};n.style=".sc-smoothly-trigger-source-h{display:block}[hidden].sc-smoothly-trigger-source-h{display:none}";export{n as smoothly_trigger_source}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-4a0b35b7.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-6630d923",[[2,"smoothly-country",{value:[1],text:[1],language:[32]}]]],["p-e0f4957d",[[2,"smoothly-google-font",{value:[1]}]]],["p-7db49a38",[[4,"smoothly-radio-group",{orientation:[513]}]]],["p-5d41e3ca",[[0,"smoothly-reorder"]]],["p-
|
|
1
|
+
import{p as e,b as o}from"./p-4a0b35b7.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-6630d923",[[2,"smoothly-country",{value:[1],text:[1],language:[32]}]]],["p-e0f4957d",[[2,"smoothly-google-font",{value:[1]}]]],["p-7db49a38",[[4,"smoothly-radio-group",{orientation:[513]}]]],["p-5d41e3ca",[[0,"smoothly-reorder"]]],["p-4fecfc5d",[[6,"smoothly-trigger-sink",{context:[16],destination:[1],filter:[1]},[[0,"trigger","TriggerListener"]]]]],["p-96e8781a",[[6,"smoothly-trigger-source",{listen:[1]}]]],["p-4a78c705",[[0,"smoothly-app-demo",{baseUrl:[1,"base-url"]}],[0,"smoothly-input-demo"],[2,"smoothly-select-demo",null,[[0,"selectionChanged","handleSelectionChanged"]]],[0,"smoothly-display-demo"],[2,"smoothly-table-demo"],[4,"smoothly-app",{color:[1]}],[0,"smoothly-dialog-demo"],[2,"smoothly-icon-demo"],[6,"smoothly-button",{color:[513],expand:[513],fill:[513],disabled:[516],type:[513],link:[1],download:[4]}],[4,"smoothly-room",{label:[1],icon:[1],path:[1],to:[1]}],[2,"smoothly-input-date-range",{value:[1025],start:[1025],end:[1025],max:[1025],min:[1025],open:[1028],showLabel:[516,"show-label"],labelStart:[1,"label-start"],labelEnd:[1,"label-end"]},[[0,"startChanged","onStartChanged"],[0,"endChanged","onEndChanged"],[0,"dateRangeSet","onDateRangeSet"]]],[1,"smoothly-picker",{disabled:[516],readonly:[516],maxMenuHeight:[1,"max-menu-height"],maxHeight:[1,"max-height"],emptyMenuLabel:[1025,"empty-menu-label"],multiple:[516],mutable:[4],optionStyle:[8,"option-style"],options:[1040],labelSetting:[513,"label-setting"],label:[513],selections:[1040],selectNoneName:[1025,"select-none-name"],selectAllName:[1025,"select-all-name"],selectionName:[1025,"selection-name"],newOptionLabel:[1025,"new-option-label"],valueValidator:[16],isOpen:[32],empty:[32]},[[0,"optionSelect","optionSelectHandler"],[0,"optionUnselect","optionSelectHandler"],[0,"optionAdd","optionAddHandler"],[0,"menuEmpty","emptyHandler"]]],[6,"smoothly-notifier",{notices:[32]},[[0,"notice","onNotice"],[0,"remove","onRemove"]]],[6,"smoothly-dialog",{color:[513],open:[1540],closable:[516],header:[513]},[[0,"trigger","TriggerListener"]]],[2,"smoothly-backtotop",{opacity:[1],bottom:[1],right:[1],visible:[32]}],[2,"smoothly-checkbox",{selectAll:[4,"select-all"],size:[1],intermediate:[1540],selected:[1540],disabled:[1540],t:[32]}],[6,"smoothly-radio-button-item",{value:[8],selected:[1540],color:[513]}],[6,"smoothly-submit",{processing:[1540],color:[513],expand:[513],fill:[513],disabled:[516],prevent:[4],submit:[64]},[[0,"click","handleSubmit"]]],[6,"smoothly-table-cell"],[6,"smoothly-table-expandable-cell",{align:[1],open:[1540],allowSpotlight:[32],spotlight:[32]},[[0,"click","onClick"],[0,"tableLoad","handleTableLoaded"]]],[0,"smoothly-urlencoded",{data:[1]}],[6,"smoothly-accordion",{value:[1025]},[[0,"smoothlyOpen","handleOpenClose"],[0,"smoothlyClose","handleOpenClose"],[0,"smoothlyAccordionItemDidLoad","onAccordionItemDidLoad"],[0,"smoothlyAccordionItemDidUnload","onAccordionItemDidUnload"]]],[6,"smoothly-accordion-item",{name:[1],brand:[1],open:[1540]}],[2,"smoothly-display",{type:[1],value:[8],currency:[1],country:[1],format:[16]}],[2,"smoothly-display-amount",{amount:[8],currency:[1],toInteger:[4,"to-integer"]}],[2,"smoothly-display-date-time",{datetime:[1]}],[2,"smoothly-frame",{url:[1],name:[1],origin:[1],send:[64]}],[6,"smoothly-popup",{visible:[1540],direction:[1537],cssVariables:[32]}],[6,"smoothly-radio",{name:[1],value:[1],checked:[1540],tabIndex:[2,"tab-index"]}],[6,"smoothly-radio-button",{name:[1],value:[1032],deselectable:[516],decoration:[513]},[[2,"radioItemSelectInternal","radioSelectHandler"]]],[6,"smoothly-select",{identifier:[1],background:[513],value:[1025]}],[2,"smoothly-skeleton",{widths:[16],width:[1025],color:[1],period:[2],distance:[1],align:[513]}],[2,"smoothly-svg",{url:[513],size:[513],color:[1]}],[6,"smoothly-table",{root:[1540]},[[0,"expandableLoad","handleExpandableLoaded"],[0,"expandableChange","handleExpandableState"],[0,"spotlightChange","handleSpotlightState"],[0,"smoothlyNestedTable","handleNestedTable"],[0,"expansionLoad","handleEvents"],[0,"expansionOpen","handleEvents"]]],[6,"smoothly-table-expandable-row",{align:[1],open:[1540],allowSpotlight:[32],spotlight:[32]},[[0,"click","onClick"],[0,"tableLoad","handleTableLoaded"]]],[6,"smoothly-table-header",{name:[1]}],[6,"smoothly-table-row",null,[[0,"expansionLoad","onExpansionLoad"],[0,"expansionOpen","onExpansionOpen"]]],[6,"smoothly-input-date",{name:[513],value:[1025],open:[1028],max:[1025],min:[1025],disabled:[1028]},[[0,"dateSet","dateSetHandler"]]],[1,"smoothly-menu-options",{toggle:[4],emptyMenuLabel:[1025,"empty-menu-label"],newOptionLabel:[1,"new-option-label"],maxMenuHeight:[1,"max-menu-height"],order:[4],optionStyle:[8,"option-style"],options:[1040],resetHighlightOnOptionsChange:[1028,"reset-highlight-on-options-change"],mutable:[4],filteredOptions:[32],highlightIndex:[32],keyword:[32],moveHighlight:[64],setHighlight:[64],getHighlighted:[64],filterOptions:[64]},[[0,"optionHover","optionHoverHandler"]]],[2,"smoothly-notification",{notice:[16],tick:[32]},[[0,"trigger","onTrigger"]]],[6,"smoothly-tab",{label:[1],open:[1540]},[[0,"click","onClick"]]],[6,"smoothly-tab-switch",{selectedElement:[32]},[[0,"expansionOpen","openChanged"]]],[0,"smoothly-tuple",{tuple:[16]}],[1,"smoothly-option",{aliases:[513],dataHighlight:[1540,"data-highlight"],name:[1537],value:[1537],divider:[1540],checkbox:[4],new:[4],toggle:[4],checked:[1028]}],[2,"smoothly-spinner",{active:[516],size:[513]}],[2,"smoothly-calendar",{month:[1025],value:[1025],start:[1025],end:[1025],max:[1025],min:[1025],doubleInput:[516,"double-input"],firstSelected:[32]}],[6,"smoothly-input",{name:[513],value:[1032],type:[513],required:[1540],minLength:[1026,"min-length"],showLabel:[516,"show-label"],maxLength:[1026,"max-length"],autocomplete:[1028],pattern:[1040],placeholder:[1025],disabled:[1028],readonly:[1028],currency:[513],initialValue:[32],getFormData:[64],setKeepFocusOnReRender:[64],setSelectionRange:[64]}],[2,"smoothly-input-month",{value:[1025]}],[6,"smoothly-quiet",{color:[1]}],[6,"smoothly-selector",{initialPrompt:[1,"initial-prompt"],opened:[32],selectedElement:[32],missing:[32],filter:[32],reset:[64]},[[0,"click","onClick"],[0,"itemSelected","onItemSelected"],[0,"keydown","onKeyDown"]]],[6,"smoothly-item",{value:[8],selected:[1540],marked:[1540],filter:[64]},[[0,"click","onClick"]]],[6,"smoothly-trigger",{color:[513],expand:[513],fill:[513],disabled:[516],type:[513],name:[1],value:[8]},[[0,"click","onClick"]]],[2,"smoothly-icon",{color:[513],fill:[513],name:[1],size:[513],toolTip:[1,"tool-tip"],document:[32]}]]]],e)));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Components, JSX } from "./components";
|
|
2
2
|
export { App, redirect } from "./components/App";
|
|
3
|
-
export { Autocomplete, ClientIdentifier, Color, Expand, Fill, GoogleFont, Message, Notice, Trigger, Option, } from "./model";
|
|
3
|
+
export { Autocomplete, ClientIdentifier, Color, Expand, Fill, GoogleFont, Message, Notice, Trigger, Option, Listenable, } from "./model";
|
|
4
4
|
export { Cosmetic } from "./utilities";
|
package/package.json
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
2
|
+
"name": "smoothly",
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
|
+
"description": "Web component library written in Stencil.",
|
|
5
|
+
"author": "PayFunc",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/payfunc/smoothly"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/payfunc/smoothly/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://payfunc.com/open-source/smoothly",
|
|
15
|
+
"private": false,
|
|
16
|
+
"main": "dist/index.cjs.js",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
|
+
"es2015": "dist/esm/index.js",
|
|
20
|
+
"es2017": "dist/esm/index.js",
|
|
21
|
+
"types": "dist/custom-elements/index.d.ts",
|
|
22
|
+
"collection": "dist/collection/collection-manifest.json",
|
|
23
|
+
"collection:main": "dist/collection/index.js",
|
|
24
|
+
"unpkg": "dist/smoothly/smoothly.js",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/",
|
|
27
|
+
"loader/"
|
|
28
|
+
],
|
|
29
|
+
"git": {
|
|
30
|
+
"tagName": "v${version}"
|
|
31
|
+
},
|
|
32
|
+
"github": {
|
|
33
|
+
"release": true
|
|
34
|
+
},
|
|
35
|
+
"jest": {
|
|
36
|
+
"globals": {
|
|
37
|
+
"ts-jest": {
|
|
38
|
+
"tsconfig": "tsconfig.json"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"transform": {
|
|
42
|
+
"^.+\\.(j|t)sx?$": "ts-jest"
|
|
43
|
+
},
|
|
44
|
+
"transformIgnorePatterns": [
|
|
45
|
+
"<rootDir>/node_modules/(?!(cryptly|authly|isoly|gracely|cloudly-http|cloudly-router|cloudly-rest)/.*)"
|
|
46
|
+
],
|
|
47
|
+
"testEnvironment": "node",
|
|
48
|
+
"testRegex": "((\\.|/)(test|spec))(\\.|\\/.+)(jsx?|tsx?)$",
|
|
49
|
+
"testPathIgnorePatterns": [
|
|
50
|
+
"node_modules/",
|
|
51
|
+
"dist/"
|
|
52
|
+
],
|
|
53
|
+
"collectCoverageFrom": [
|
|
54
|
+
"**/*.{ts,tsx,js,jsx}",
|
|
55
|
+
"!**/node_modules/**",
|
|
56
|
+
"!**/dist/**"
|
|
57
|
+
],
|
|
58
|
+
"preset": "ts-jest",
|
|
59
|
+
"testMatch": null
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "stencil build",
|
|
63
|
+
"start": "stencil build --dev --watch --serve",
|
|
64
|
+
"lint": "eslint 'src/**/*.{js,ts,tsx}'",
|
|
65
|
+
"fix": "eslint 'src/**/*.{js,ts,tsx}' --fix",
|
|
66
|
+
"test": "stencil test --spec --e2e",
|
|
67
|
+
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
68
|
+
"clean": "rm -rf .stencil/ dist/ node_modules/ loader/ www/"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"authly": "3.0.1",
|
|
72
|
+
"isoly": "^2.0.13",
|
|
73
|
+
"langly": "2.0.1",
|
|
74
|
+
"normalize.css": "^8.0.1",
|
|
75
|
+
"stencil-router-v2": "^0.6.0",
|
|
76
|
+
"tidily": "0.0.53"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@stencil/core": "^2.17.4",
|
|
80
|
+
"@stencil/sass": "^1.5.2",
|
|
81
|
+
"@types/jest": "^27.0.3",
|
|
82
|
+
"@types/pvutils": "^1.0.1",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^5.36.0",
|
|
84
|
+
"@typescript-eslint/parser": "^5.36.0",
|
|
85
|
+
"eslint": "^8.26.0",
|
|
86
|
+
"eslint-plugin-prettierx": "github:utily/eslint-plugin-prettierx#utily-20221229",
|
|
87
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
88
|
+
"jest": "^27.0.3",
|
|
89
|
+
"jest-cli": "^27.4.5",
|
|
90
|
+
"prettier": "^2.7.1",
|
|
91
|
+
"prettierx": "github:utily/prettierx#utily-20221229",
|
|
92
|
+
"puppeteer": "^17.0.0",
|
|
93
|
+
"typescript": "^4.8.4"
|
|
94
|
+
}
|
|
95
95
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class t{constructor(){this.encoding="utf-8"}encode(t){return Uint8Array.from(unescape(encodeURIComponent(t)).split(""),(t=>t.charCodeAt(0)))}}const n={standard:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",url:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function r(r,e="standard",i=""){"string"==typeof r&&(r=(new t).encode(r));const s=n[e],a=[];for(let t=0;t<r.length;t+=3){const n=r[t],e=t+1<r.length?r[t+1]:0,i=t+2<r.length?r[t+2]:0;a.push(s[n>>>2]),a.push(s[(3&n)<<4|e>>>4]),a.push(s[(15&e)<<2|i>>>6]),a.push(s[63&i])}const c=Math.ceil(r.length/3*4);return a.join("").substr(0,c)+i.repeat(a.length-c)}function e(t,r="standard"){for(;t.endsWith("=")&&t.length>0;)t=t.substr(0,t.length-1);const e=n[r],i=t.split("").map((t=>e.indexOf(t))),s=new Uint8Array(Math.floor(i.length/4*3));for(let t=0;t<s.length;t+=3){const n=i.shift()||0,r=i.shift()||0,e=i.shift()||0,a=i.shift()||0;s[t]=n<<2|r>>>4,s[t+1]=(15&r)<<4|e>>>2,s[t+2]=(3&e)<<6|a}return s}const i="undefined"!=typeof window?window.crypto||window.msCrypto:self.crypto||self.msCrypto;var s,a,c,o,u,f,S,y,A,p,w,h,l,b,g,H;!function(t){t.create=function(t,n,...r){const[e,...i]=(s=r,Array.isArray(s)&&s.length>0&&"string"==typeof s[0]?r.map((t=>Object.fromEntries(t.split(",").map((t=>t.split(":",2).map((t=>t.trim()))))))):r);var s;const a=Object.assign({},...Object.entries(e).map((([t,n])=>[t,[n,...i.map((n=>n[t])).filter((t=>t))]])).map((([n,r])=>({get[n](){return Object.assign(t(r),{name:n})}}))));return{current:a[n],...a}}}(s||(s={})),function(t){t.is=function(t){return"object"==typeof t&&(null==t.key||"string"==typeof t.key)&&"string"==typeof t.value&&"string"==typeof t.salt},t.stringify=function(t){return t.key=t.key&&4!=t.key.length?t.key.slice(-2):t.key,[t.key,t.salt,t.value].join(".")},t.parse=function(n){const r=n.split("."),e={key:r[0],salt:r[1],value:r[2]};return t.is(e)?e:void 0}}(a||(a={})),function(t){function n(t){return r(t,"url")}function s(t){t.length%2==1&&(t+="0");const r=new Uint8Array(t.length/2);for(let n=0;n<r.length;n++)r[n]=16*Number.parseInt(t[2*n],16)+Number.parseInt(t[2*n+1],16);return n(r)}function a(t,n){const r=e(t,"url");let i=[];for(const t of r)i.push(Math.floor(t/16).toString(16),(t%16).toString(16));return n&&(i=i.slice(0,n)),i.join("")}t.is=function(t,n){return"string"==typeof t&&(null==n||t.length==n)&&Array.from(t).every((t=>t>="0"&&t<="9"||t>="A"&&t<="Z"||t>="a"&&t<="z"||"-"==t||"_"==t))},t.fromUint24=function(t){return s(t.toString(16).padStart(6,"0"))},t.toUint24=function(t){return Number.parseInt(a(t,6),16)},t.fromUint48=function(t){return s(t.toString(16).padStart(12,"0"))},t.toUint48=function(t){return Number.parseInt(a(t,12),16)},t.fromBinary=n,t.toBinary=function(t){return e(t,"url")},t.generate=function(t){return n(i.getRandomValues(new Uint8Array(t/4*3)))},t.fromHexadecimal=s,t.toHexadecimal=a,t.length=[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128],(t.Length||(t.Length={})).is=function(t){return"number"==typeof t&&t>=4&&t<=128&&(252&t)==t}}(c||(c={})),function(t){t.is=function(t){return"string"==typeof t||"object"==typeof t&&"string"==typeof t.hash&&"string"==typeof t.salt},t.hash=async function(t,n,e){return e||(e=r(i.getRandomValues(new Uint8Array(64)))),{hash:await t.sign(e+n),salt:e}},t.verify=async function(n,r,e){return(await t.hash(n,e,r.salt)).hash==r.hash},(t.Hashed||(t.Hashed={})).is=function(t){return"object"==typeof t&&"string"==typeof t.hash&&"string"==typeof t.salt}}(o||(o={})),function(t){t.generate=function(t){return i.getRandomValues(t)}}(u||(u={})),(f||(f={})).is=function(t){return"HMAC"==t||"RSA"==t||"ECDSA"==t||"RSA-PSS"==t};class d{async sign(n){return"string"==typeof n?r(await this.signBinary((new t).encode(n)),"url"):this.signBinary(n)}verify(n,r){return"string"==typeof r&&(r=e(r,"url")),this.verifyBinary("string"==typeof n?(new t).encode(n):n,r)}}class P extends d{constructor(t,n,r){super(),this.hash=t,n&&("string"==typeof n&&(n=e(n)),this.publicKey=i.subtle.importKey("spki",n,{name:"ECDSA",namedCurve:"P-512"==t.replace("SHA","P")?"P-521":t.replace("SHA","P")},!1,["verify"])),r&&("string"==typeof r&&(r=e(r)),this.privateKey=i.subtle.importKey("pkcs8",r,{name:"ECDSA",namedCurve:"P-512"==t.replace("SHA","P")?"P-521":t.replace("SHA","P")},!0,["sign","verify"]))}async signBinary(t){return new Uint8Array(await i.subtle.sign({name:"ECDSA",hash:{name:this.hash}},await this.privateKey,t))}async verifyBinary(t,n){return i.subtle.verify({name:"ECDSA",hash:{name:this.hash}},await this.publicKey,n,t)}}!function(t){t.is=function(t){return"SHA-1"==t||"SHA-256"==t||"SHA-384"==t||"SHA-512"==t}}(S||(S={}));class m extends d{async verifyBinary(t,n){return r(await this.signBinary(t),"url")==r(n,"url")}}class v extends m{constructor(t,n){super(),this.hash=t,"string"==typeof n&&(n=e(n,"url")),this.key=i.subtle.importKey("raw",n,{name:"HMAC",hash:{name:t}},!1,["sign","verify"])}async signBinary(t){return new Uint8Array(await i.subtle.sign("HMAC",await this.key,t))}}class E extends m{signBinary(t){return Promise.resolve(new Uint8Array(0))}}class k extends d{constructor(t,n,r){super(),this.variant=t,this.publicKey=n,this.privateKey=r}get parameters(){return C(this.variant)}async signBinary(t){return this.privateKey?new Uint8Array(await i.subtle.sign(this.parameters,await this.privateKey,t)):new Uint8Array(0)}async verifyBinary(t,n){return!!this.publicKey&&i.subtle.verify(this.parameters,await this.publicKey,n,t)}async export(t,n="base64"){const e=await("private"==t?this.privateKey:this.publicKey);let s;if(e)switch(n){case"jwk":s=await i.subtle.exportKey("jwk",e);break;case"buffer":s=await i.subtle.exportKey("private"==t?"pkcs8":"spki",e);break;case"base64":{const n=await this.export(t,"buffer");s=n&&r(new Uint8Array(n),"standard","=")}break;case"pem":{const n=await this.export(t,"base64");s=n&&[`-----BEGIN ${t.toUpperCase()} KEY-----`,...R(n,64),`-----END ${t.toUpperCase()} KEY-----`].join("\n")}}return s}static import(t,n,r,e){return new k(t,k.importHelper(t,n,"public",r),k.importHelper(t,n,"private",e))}static importHelper(t,n,r,s){return"string"==typeof s&&(s=e(s)),s&&i.subtle.importKey("private"==r?"pkcs8":"spki",s,{name:C(t).name,hash:{name:n}},!0,["private"==r?"sign":"verify"])}static generate(t,n,r){const e=i.subtle.generateKey({name:C(t).name,modulusLength:r,publicExponent:new Uint8Array([1,0,1]),hash:n},!0,["sign","verify"]);return new k(t,e.then((t=>t.publicKey)),e.then((t=>t.privateKey)))}}function*R(t,n){let r=0;for(;r<t.length;)yield t.slice(r,r+=n)}function C(t){return"PSS"==t?{name:"RSA-PSS",saltLength:128}:{name:"RSASSA-PKCS1-v1_5"}}!function(t){!function(t){t.is=f.is}(t.Algorithm||(t.Algorithm={})),(t.Hash||(t.Hash={})).is=S.is,t.generate=function(t,n,r){let e;switch(t){case"RSA":e=k.generate("SSA",n,r);break;case"RSA-PSS":e=k.generate("PSS",n,r)}return e},t.create=function(t,n,...r){let e;if(null!=n)switch(t){case"HMAC":e=new v(n,r[0]);break;case"RSA":e=k.import("SSA",n,r[0],r[1]);break;case"RSA-PSS":e=k.import("PSS",n,r[0],r[1]);break;case"ECDSA":e=new P(n,r[0],r[1])}else"None"==t&&(e=new E);return e}}(y||(y={})),Uint8Array.__proto__.from||(Uint8Array.__proto__.from=function(t,n,r){const e=Uint8Array.__proto__;if("function"!=typeof this)throw new TypeError("# is not a constructor");if(this.__proto__!==e)throw new TypeError("this is not a typed array.");if("function"!=typeof(n=n||(t=>t)))throw new TypeError("specified argument is not a function");if(!(t=Object(t)).length)return new this(0);let i=[];for(const t of i)i.push(t);i=i.map(n,r);const s=new this(i.length);for(let t=0;t<s.length;t++)s[t]=i[t];return s}),function(t){t.is=function(t){return"object"==typeof t&&Object.entries(t).every((t=>"function"==typeof t))}}(A||(A={})),function(t){t.is=function(t){return Array.isArray(t)&&t.every((t=>"string"==typeof t))}}(p||(p={})),function(t){t.is=function(t){return"object"==typeof t&&Object.entries(t).every((t=>"string"==typeof t[1]))}}(w||(w={})),function(t){t.is=function(t){return p.is(t)||A.is(t)||w.is(t)},(t.Converter||(t.Converter={})).is=A.is,(t.Crypto||(t.Crypto={})).is=p.is,(t.Renamer||(t.Renamer={})).is=w.is}(h||(h={})),function(t){t.is=function(t){return"object"==typeof t&&"function"==typeof t.apply&&"function"==typeof t.reverse},t.create=function(t){return{apply:t.apply?t.apply:t=>t,reverse:t.reverse?t.reverse:t=>t}}}(l||(l={})),function(t){t.is=function(t){return"RS256"==t||"RS384"==t||"RS512"==t||"ES256"==t||"ES384"==t||"ES512"==t||"PS256"==t||"PS384"==t||"PS512"==t}}(b||(b={})),function(t){t.is=function(t){return"HS256"==t||"HS384"==t||"HS512"==t}}(g||(g={})),function(t){t.is=function(t){return"none"==t||g.is(t)||b.is(t)},function(t){t.is=g.is}(t.Symmetric||(t.Symmetric={})),(t.Asymmetric||(t.Asymmetric={})).is=b.is}(H||(H={}));var j;class U{constructor(t,n){this.name=t,this.signer=n}sign(t){return n=this,r=void 0,i=function*(){return this.signer.sign(t)},new((e=void 0)||(e=Promise))((function(t,s){function a(t){try{o(i.next(t))}catch(t){s(t)}}function c(t){try{o(i.throw(t))}catch(t){s(t)}}function o(n){var r;n.done?t(n.value):(r=n.value,r instanceof e?r:new e((function(t){t(r)}))).then(a,c)}o((i=i.apply(n,r||[])).next())}));var n,r,e,i}verify(t,n){return this.signer.verify(t,n)}static create(t,...n){let r;switch(t){case"ES256":r=y.create("ECDSA","SHA-256",n[0],n[1]);break;case"ES384":r=y.create("ECDSA","SHA-384",n[0],n[1]);break;case"ES512":r=y.create("ECDSA","SHA-512",n[0],n[1]);break;case"PS256":r=y.create("RSA-PSS","SHA-256",n[0],n[1]);break;case"PS384":r=y.create("RSA-PSS","SHA-384",n[0],n[1]);break;case"PS512":r=y.create("RSA-PSS","SHA-512",n[0],n[1]);break;case"HS256":r=y.create("HMAC","SHA-256",n[0]);break;case"HS384":r=y.create("HMAC","SHA-384",n[0]);break;case"HS512":r=y.create("HMAC","SHA-512",n[0]);break;case"RS256":r=y.create("RSA","SHA-256",n[0],n[1]);break;case"RS384":r=y.create("RSA","SHA-384",n[0],n[1]);break;case"RS512":r=y.create("RSA","SHA-512",n[0],n[1]);break;case"none":r=y.create("None")}return r&&new U(t,r)}static none(){return U.create("none")}static HS256(t){return U.create("HS256",t)}static HS384(t){return U.create("HS384",t)}static HS512(t){return U.create("HS512",t)}static RS256(t,n){return U.create("RS256",t,n)}static RS384(t,n){return U.create("RS384",t,n)}static RS512(t,n){return U.create("RS512",t,n)}static ES256(t,n){return U.create("ES256",t,n)}static ES384(t,n){return U.create("ES384",t,n)}static ES512(t,n){return U.create("ES512",t,n)}static PS256(t,n){return U.create("PS256",t,n)}static PS384(t,n){return U.create("PS384",t,n)}static PS512(t,n){return U.create("PS512",t,n)}}!function(t){var n;(n=t.Name||(t.Name={})).is=H.is,function(t){t.is=H.Symmetric.is}(n.Symmetric||(n.Symmetric={})),function(t){t.is=H.Asymmetric.is}(n.Asymmetric||(n.Asymmetric={}))}(U||(U={})),function(t){t.is=function(t){return"string"==typeof t&&/^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$/.test(t)}}(j||(j={}));class M{static is(t){return"object"==typeof t&&"string"==typeof t.destination&&null!=t.content}static send(t,n,r){if(M.is(t)&&null==r){(r=n)||(r=window);const e=t.destination.split("#",2);r.postMessage(t={destination:e[1],content:t.content},e[0])}else"string"!=typeof r&&(r||(r=window),"string"==typeof t&&M.send({destination:t,content:n},r))}static listen(t,n,r){const e=t.split("#",2);let i="";2==e.length&&(t=e[0],i=e[1]),(r||window).addEventListener("message",(r=>{const e=r.data;!M.is(e)||"*"!=t&&r.origin!=t||""!=i&&e.destination!=i||n(e.destination,e.content)}))}}class D{static is(t){return"object"==typeof t&&"string"==typeof t.name}}export{c as I,M,D as T}
|