shinkom 1.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/LICENSE.md +7 -0
- package/README.md +399 -0
- package/dist/bundles/_virtual/_rolldown/runtime.js +14 -0
- package/dist/bundles/core/constants.d.ts +16 -0
- package/dist/bundles/core/constants.js +20 -0
- package/dist/bundles/core/event-bus.d.ts +33 -0
- package/dist/bundles/core/event-bus.js +36 -0
- package/dist/bundles/core/helpers.js +25 -0
- package/dist/bundles/core/index.d.ts +12 -0
- package/dist/bundles/core/index.js +12 -0
- package/dist/bundles/core/state-service.d.ts +37 -0
- package/dist/bundles/core/state-service.js +60 -0
- package/dist/bundles/core/ui-component.d.ts +45 -0
- package/dist/bundles/core/ui-component.js +52 -0
- package/dist/bundles/engine/engine.d.ts +61 -0
- package/dist/bundles/engine/engine.js +154 -0
- package/dist/bundles/engine/index.js +8 -0
- package/dist/bundles/gen/browser-data.js +96 -0
- package/dist/bundles/gen/browser-usage-data.js +669 -0
- package/dist/bundles/gen/compat-data.js +1 -0
- package/dist/bundles/gen/index.js +14 -0
- package/dist/bundles/index.d.ts +16 -0
- package/dist/bundles/index.js +17 -0
- package/dist/bundles/node_modules/@mdn/browser-compat-data/types.d.ts +78 -0
- package/dist/bundles/pkg/shinkore.d.ts +51 -0
- package/dist/bundles/pkg/shinkore.js +462 -0
- package/dist/bundles/pkg/shinkore_bg.wasm +0 -0
- package/dist/bundles/shinkom.d.ts +34 -0
- package/dist/bundles/shinkom.js +55 -0
- package/dist/bundles/types/public.d.ts +73 -0
- package/dist/bundles/ui/compat-ui/compat-ui.d.ts +33 -0
- package/dist/bundles/ui/compat-ui/compat-ui.js +49 -0
- package/dist/bundles/ui/control-panel/control-panel.d.ts +39 -0
- package/dist/bundles/ui/control-panel/control-panel.js +409 -0
- package/dist/bundles/ui/index.d.ts +11 -0
- package/dist/bundles/ui/index.js +11 -0
- package/dist/bundles/ui/inspector/inspector.d.ts +44 -0
- package/dist/bundles/ui/inspector/inspector.js +314 -0
- package/dist/modules/core/constants.cjs +1 -0
- package/dist/modules/core/event-bus.cjs +1 -0
- package/dist/modules/core/helpers.cjs +1 -0
- package/dist/modules/core/index.cjs +1 -0
- package/dist/modules/core/state-service.cjs +1 -0
- package/dist/modules/core/ui-component.cjs +1 -0
- package/dist/modules/engine/engine.cjs +1 -0
- package/dist/modules/gen/browser-data.cjs +1 -0
- package/dist/modules/gen/browser-usage-data.cjs +1 -0
- package/dist/modules/gen/compat-data.cjs +1 -0
- package/dist/modules/gen/index.cjs +1 -0
- package/dist/modules/index.cjs +1 -0
- package/dist/modules/pkg/shinkore.cjs +1 -0
- package/dist/modules/pkg/shinkore_bg.wasm +0 -0
- package/dist/modules/shinkom.cjs +1 -0
- package/dist/modules/ui/compat-ui/compat-ui.cjs +1 -0
- package/dist/modules/ui/control-panel/control-panel.cjs +182 -0
- package/dist/modules/ui/index.cjs +1 -0
- package/dist/modules/ui/inspector/inspector.cjs +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./compat-data.cjs`);require(`./browser-data.cjs`),require(`./browser-usage-data.cjs`);var t=e.default;exports.default=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core/event-bus.cjs`),t=require(`./core/state-service.cjs`),n=require(`./core/ui-component.cjs`),r=require(`./ui/inspector/inspector.cjs`),i=require(`./ui/control-panel/control-panel.cjs`),a=require(`./ui/compat-ui/compat-ui.cjs`),o=require(`./engine/engine.cjs`),s=require(`./shinkom.cjs`);exports.CompatControlPanel=i.CompatControlPanel,exports.CompatInspector=r.CompatInspector,exports.CompatUI=a.CompatUI,exports.SKEngine=o.SKEngine,exports.Shinkom=s.Shinkom,exports.ShinkomBus=e.ShinkomBus,exports.ShinkomState=t.ShinkomState,exports.UIComponent=n.UIComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,n.unregister(this),e}free(){let e=this.__destroy_into_raw();b.__wbg_compatengine_free(e,0)}check_element(e){let t=p(e,b.__wbindgen_malloc,b.__wbindgen_realloc),n=y,r=b.compatengine_check_element(this.__wbg_ptr,t,n);if(r[2])throw m(r[1]);return m(r[0])}check_elements(e,t){let n=p(e,b.__wbindgen_malloc,b.__wbindgen_realloc),r=y,i=b.compatengine_check_elements(this.__wbg_ptr,n,r,t);if(i[2])throw m(i[1]);return m(i[0])}full_inspect(e){let t=p(e,b.__wbindgen_malloc,b.__wbindgen_realloc),n=y,r=b.compatengine_full_inspect(this.__wbg_ptr,t,n);if(r[2])throw m(r[1]);return m(r[0])}constructor(e,t,r,i){return this.__wbg_ptr=b.compatengine_new(e,t,r,i)>>>0,n.register(this,this.__wbg_ptr,this),this}};Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);function t(){let e={__proto__:null,__wbg_Error_960c155d3d49e4c2:function(e,t){return Error(c(e,t))},__wbg_String_8564e559799eccda:function(e,t){let n=p(String(t),b.__wbindgen_malloc,b.__wbindgen_realloc),r=y;s().setInt32(e+4,r,!0),s().setInt32(e+0,n,!0)},__wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;s().setBigInt64(e+8,f(r)?BigInt(0):r,!0),s().setInt32(e+0,!f(r),!0)},__wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return f(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_ab4b34d23d6778bd:function(e,t){let n=p(i(t),b.__wbindgen_malloc,b.__wbindgen_realloc),r=y;s().setInt32(e+4,r,!0),s().setInt32(e+0,n,!0)},__wbg___wbindgen_in_a5d8b22e52b24dd1:function(e,t){return e in t},__wbg___wbindgen_is_bigint_ec25c7f91b4d9e93:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_3baa9db1a987f47d:function(e){return typeof e==`function`},__wbg___wbindgen_is_object_63322ec0cd6ea4ef:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_6df3bf7ef1164ed3:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_29a43b4d42920abd:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_d3465d8a07697228:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c:function(e,t){return e==t},__wbg___wbindgen_number_get_c7f42aed0525c451:function(e,t){let n=t,r=typeof n==`number`?n:void 0;s().setFloat64(e+8,f(r)?0:r,!0),s().setInt32(e+0,!f(r),!0)},__wbg___wbindgen_string_get_7ed5322991caaec5:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=f(r)?0:p(r,b.__wbindgen_malloc,b.__wbindgen_realloc),a=y;s().setInt32(e+4,a,!0),s().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(c(e,t))},__wbg_call_14b169f759b26747:function(){return d(function(e,t){return e.call(t)},arguments)},__wbg_done_9158f7cc8751ba32:function(e){return e.done},__wbg_entries_e0b73aa8571ddb56:function(e){return Object.entries(e)},__wbg_error_2001591ad2463697:function(e){console.error(e)},__wbg_get_1affdbdd5573b16a:function(){return d(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_8360291721e2339f:function(e,t){return e[t>>>0]},__wbg_get_unchecked_17f53dad852b9588:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_1b76fd4635be43eb:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_152ba1f289edcf3f:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_c3109d14ffc06469:function(e){return Array.isArray(e)},__wbg_isSafeInteger_4fc213d1989d6d2a:function(e){return Number.isSafeInteger(e)},__wbg_iterator_013bc09ec998c2a7:function(){return Symbol.iterator},__wbg_length_3d4ecd04bd8d22f1:function(e){return e.length},__wbg_length_9f1775224cf1d815:function(e){return e.length},__wbg_new_0c7403db6e782f19:function(e){return new Uint8Array(e)},__wbg_new_34d45cc8e36aaead:function(){return new Map},__wbg_new_682678e2f47e32bc:function(){return[]},__wbg_new_aa8d0fa9762c29bd:function(){return{}},__wbg_next_0340c4ae324393c3:function(){return d(function(e){return e.next()},arguments)},__wbg_next_7646edaa39458ef7:function(e){return e.next},__wbg_prototypesetcall_a6b02eb00b0f4ce2:function(e,t,n){Uint8Array.prototype.set.call(a(e,t),n)},__wbg_set_3bf1de9fab0cd644:function(e,t,n){e[t>>>0]=n},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_fde2cec06c23692b:function(e,t,n){return e.set(t,n)},__wbg_value_ee3a06f4579184fa:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e){return e},__wbindgen_cast_0000000000000003:function(e,t){return c(e,t)},__wbindgen_cast_0000000000000004:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=b.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}};return{__proto__:null,"./shinkore_bg.js":e}}const n=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>b.__wbg_compatengine_free(e>>>0,1));function r(e){let t=b.__externref_table_alloc();return b.__wbindgen_externrefs.set(t,e),t}function i(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=i(e[0]));for(let r=1;r<t;r++)n+=`, `+i(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function a(e,t){return e>>>=0,u().subarray(e/1,e/1+t)}let o=null;function s(){return(o===null||o.buffer.detached===!0||o.buffer.detached===void 0&&o.buffer!==b.memory.buffer)&&(o=new DataView(b.memory.buffer)),o}function c(e,t){return e>>>=0,_(e,t)}let l=null;function u(){return(l===null||l.byteLength===0)&&(l=new Uint8Array(b.memory.buffer)),l}function d(e,t){try{return e.apply(this,t)}catch(e){let t=r(e);b.__wbindgen_exn_store(t)}}function f(e){return e==null}function p(e,t,n){if(n===void 0){let n=v.encode(e),r=t(n.length,1)>>>0;return u().subarray(r,r+n.length).set(n),y=n.length,r}let r=e.length,i=t(r,1)>>>0,a=u(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=u().subarray(i+o,i+r),a=v.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return y=o,i}function m(e){let t=b.__wbindgen_externrefs.get(e);return b.__externref_table_dealloc(e),t}let h=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});h.decode();let g=0;function _(e,t){return g+=t,g>=2146435072&&(h=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),h.decode(),g=t),h.decode(u().subarray(e,e+t))}const v=new TextEncoder;`encodeInto`in v||(v.encodeInto=function(e,t){let n=v.encode(e);return t.set(n),{read:e.length,written:n.length}});let y=0,b;function x(e,t){return b=e.exports,o=null,l=null,b.__wbindgen_start(),b}async function S(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function C(e){if(b!==void 0)return b;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(`shinkore_bg.wasm`,{}.url));let n=t();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await S(await e,n);return x(r,i)}exports.CompatEngine=e,exports.__wbg_init=C;
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core/event-bus.cjs`),t=require(`./core/state-service.cjs`),n=require(`./ui/inspector/inspector.cjs`),r=require(`./ui/control-panel/control-panel.cjs`),i=require(`./ui/compat-ui/compat-ui.cjs`),a=require(`./engine/engine.cjs`);var o=class{#e;#t=null;constructor(o=void 0){this.#e=o;let s=new e.ShinkomBus,c=new t.ShinkomState;this.skEngine=new a.SKEngine(s),this.compatUI=new i.CompatUI(s,c,[new n.CompatInspector(s,c,this.#e?.inspector),new r.CompatControlPanel(s,c)])}async init(){try{await this.skEngine.initEngine(this.#e?.engine?.wasmURL),this.compatUI.init()}catch(e){console.error(`Shinkom initialization error: ${e}`)}}destroy(){this.skEngine.destroy(),this.compatUI.destroy(),this.#t&&this.#t.abort(),this.#t=null}};exports.Shinkom=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=new WeakMap;var t=class{constructor(t,n,r=[]){this.components=r,e.set(this,n.getState())}#e(){let t=e.get(this);this.components.forEach(e=>e.bindState(t))}init(){try{this.components.forEach(e=>e.mount()),this.#e()}catch(e){console.error(`Compat UI initialization error: ${e}`)}}destroy(){this.components.forEach(e=>{e.unmount()})}};exports.CompatUI=t;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../core/ui-component.cjs`);var t=class extends e.UIComponent{#e=null;#t=null;constructor(e,t){super(e,t),this.shadowHost=null,this.shadowRoot=null,this.depthLevelInput=null,this.ciStatusEl=null,this.toggleSwitchingEl=null,this.toggleInspectorEl=null,this.depthLevel=0,this.multiElements=!1,t.subscribe((e,t)=>{this.onStateChange(e,t)})}#n(){if(this.shadowHost)Object.assign(this.shadowHost.style,{position:`fixed`,top:`2rem`,left:`2rem`,zIndex:`9999`});else throw Error(`Shadow host is undefined or null.`)}createPanel(){if(this.shadowHost){console.warn(`Shadow host already exists.`);return}this.shadowHost=document.createElement(`div`),this.shadowHost.id=`sk-shadow-host`;try{this.#n()}catch(e){throw this.shadowHost=null,e}document.body.appendChild(this.shadowHost),this.shadowRoot=this.shadowHost.attachShadow({mode:`open`}),this.shadowRoot.innerHTML=`
|
|
2
|
+
<style>
|
|
3
|
+
.sk-control-panel {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: space-evenly;
|
|
7
|
+
width: 30rem;
|
|
8
|
+
height: 85lvh;
|
|
9
|
+
padding: 1rem;
|
|
10
|
+
background-color: #0f0c13;
|
|
11
|
+
color: white;
|
|
12
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
13
|
+
border-radius: 2rem;
|
|
14
|
+
z-index: 2;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sk-control-panel * {
|
|
18
|
+
transition-property: color, background-color, border-color;
|
|
19
|
+
transition-duration: 300ms;
|
|
20
|
+
transition-timing-function: ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sk-page-buttons {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: .75rem;
|
|
29
|
+
flex: 1 1 0%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sk-button-style {
|
|
33
|
+
font-size: 1.225rem;
|
|
34
|
+
color: white;
|
|
35
|
+
background-color: #201a27;
|
|
36
|
+
border: 1px solid #3c00c7;
|
|
37
|
+
border-radius: .5rem;
|
|
38
|
+
padding-inline: .5rem;
|
|
39
|
+
padding-block: .3rem;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sk-hr-line {
|
|
44
|
+
width: 100%;
|
|
45
|
+
border: 0px solid transparent;
|
|
46
|
+
border-top: 1px solid #8132ff;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sk-full-page-inspect {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-evenly;
|
|
53
|
+
font-size: 1.8rem;
|
|
54
|
+
flex: 0.5 1 0%;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.sk-options-container {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: .5rem;
|
|
61
|
+
padding-top: 1rem;
|
|
62
|
+
padding-inline: 1rem;
|
|
63
|
+
flex: 5 1 0%;
|
|
64
|
+
font-size: 1.25rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.sk-options-header {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
font-size: 1.5rem;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.sk-options-header p:last-child {
|
|
75
|
+
font-size: 1rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.sk-options {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
justify-content: space-evenly;
|
|
82
|
+
height: 100%;
|
|
83
|
+
padding-left: .05rem;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.sk-options-grid {
|
|
87
|
+
display: grid;
|
|
88
|
+
grid-template-columns: auto auto auto;
|
|
89
|
+
grid-template-rows: auto;
|
|
90
|
+
justify-items: flex-start;
|
|
91
|
+
align-items: center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.sk-options-grid:first-child {
|
|
95
|
+
column-gap: .5rem;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.sk-options-grid .sk-button-style {
|
|
99
|
+
justify-self: flex-end;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.sk-options-grid .sk-options-input {
|
|
103
|
+
justify-self: flex-end;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.sk-options-grid .sk-options-input:disabled {
|
|
107
|
+
opacity: .5;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.sk-options-grid:nth-last-of-type(2), .sk-options-grid:nth-last-of-type(1) {
|
|
111
|
+
grid-template-columns: auto auto;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.sk-options-input {
|
|
115
|
+
width: 70%;
|
|
116
|
+
padding-block: .2rem;
|
|
117
|
+
padding-inline: .3rem;
|
|
118
|
+
border-radius: .25rem;
|
|
119
|
+
border: none;
|
|
120
|
+
background-color: #232333;
|
|
121
|
+
font-size: 1rem;
|
|
122
|
+
color: white;
|
|
123
|
+
}
|
|
124
|
+
.sk-close {
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
flex: 1 1 0%;
|
|
129
|
+
}
|
|
130
|
+
.sk-show-panel {
|
|
131
|
+
width: 8rem;
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: 1rem;
|
|
134
|
+
left: 1rem;
|
|
135
|
+
z-index: -1;
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
138
|
+
<div style="position: relative">
|
|
139
|
+
<button id="sk-show-panel" class="sk-button-style sk-show-panel">Show Panel</button>
|
|
140
|
+
<div id="sk-control-panel" class="sk-control-panel" style="display: none;">
|
|
141
|
+
<div class="sk-page-buttons">
|
|
142
|
+
<button class="sk-button-style">Inspector</button>
|
|
143
|
+
<button class="sk-button-style">Compatibility View</button>
|
|
144
|
+
</div>
|
|
145
|
+
<hr class="sk-hr-line">
|
|
146
|
+
<div class="sk-full-page-inspect">
|
|
147
|
+
<p>Inspect Full Page</p>
|
|
148
|
+
<button id="sk-full-inspect" class="sk-button-style">Inspect</button>
|
|
149
|
+
</div>
|
|
150
|
+
<hr class="sk-hr-line">
|
|
151
|
+
<div class="sk-options-container">
|
|
152
|
+
<div class="sk-options-header">
|
|
153
|
+
<p>Inspector Options</p>
|
|
154
|
+
<p id="sk-inspector-status">Inspector Status: Active</p>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="sk-options">
|
|
157
|
+
<div class="sk-options-grid">
|
|
158
|
+
<p>Inspect multiple elements</p>
|
|
159
|
+
<input id="sk-toggle-elements" class="sk-options-checkbox" type="checkbox">
|
|
160
|
+
<input id="sk-depth-level" class="sk-options-input" type="text" placeholder="depth_level" disabled>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="sk-options-grid">
|
|
163
|
+
<p>Toggle Switching</p>
|
|
164
|
+
<button id="sk-toggle-switching" class="sk-button-style">Disabled</button>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="sk-options-grid">
|
|
167
|
+
<p>Toggle Inspector</p>
|
|
168
|
+
<button id="sk-toggle-inspector" class="sk-button-style">Active</button>
|
|
169
|
+
</div>
|
|
170
|
+
<button id="sk-create-inspector" class="sk-button-style">Create Inspector</button>
|
|
171
|
+
<button id="sk-reset-inspector" class="sk-button-style">Reset Inspector</button>
|
|
172
|
+
<button id="sk-destroy-inspector" class="sk-button-style">Destroy Inspector</button>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
<hr class="sk-hr-line">
|
|
176
|
+
<div class="sk-close">
|
|
177
|
+
<button id="sk-close-panel" class="sk-button-style">Close</button>
|
|
178
|
+
</div>
|
|
179
|
+
<hr class="sk-hr-line">
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
`}bindState(e){this.#e||=e,this.#e.ignorePanelEl=this.shadowHost}onStateChange(e,t){switch(e){case`inspectorSwitching`:this.toggleSwitchingEl&&(this.toggleSwitchingEl.innerHTML=t?`Enabled`:`Disabled`);break;case`inspectorActive`:this.toggleInspectorEl&&(this.toggleInspectorEl.innerHTML=t?`Active`:`Deactive`),this.ciStatusEl&&(this.ciStatusEl.innerHTML=t?`Inspector Status: Active`:`Inspector Status: Deactive`);break;default:break}}mount(){try{this.createPanel()}catch(e){throw e}this.#r()}#r(){this.#t=new AbortController;let{signal:e}=this.#t,t=this.shadowRoot?.getElementById(`sk-toggle-inspector`),n=this.shadowRoot?.getElementById(`sk-toggle-switching`),r=this.shadowRoot?.getElementById(`sk-create-inspector`),i=this.shadowRoot?.getElementById(`sk-reset-inspector`),a=this.shadowRoot?.getElementById(`sk-destroy-inspector`),o=this.shadowRoot?.getElementById(`sk-show-panel`),s=this.shadowRoot?.getElementById(`sk-close-panel`),c=this.shadowRoot?.getElementById(`sk-toggle-elements`),l=this.shadowRoot?.getElementById(`sk-depth-level`),u=this.shadowRoot?.getElementById(`sk-full-inspect`),d=this.shadowRoot?.getElementById(`sk-inspector-status`);t?.addEventListener(`click`,this.#a,{signal:e}),n?.addEventListener(`click`,this.#a,{signal:e}),r?.addEventListener(`click`,this.#a,{signal:e}),i?.addEventListener(`click`,this.#a,{signal:e}),a?.addEventListener(`click`,this.#a,{signal:e}),o?.addEventListener(`click`,this.#a,{signal:e}),s?.addEventListener(`click`,this.#a,{signal:e}),c?.addEventListener(`click`,this.#a,{signal:e}),l?.addEventListener(`change`,this.#o,{signal:e}),u?.addEventListener(`click`,this.#a,{signal:e}),l&&(this.depthLevelInput=l),t&&(this.toggleInspectorEl=t),n&&(this.toggleSwitchingEl=n),d&&(this.ciStatusEl=d)}unmount(){try{if(!this.shadowHost)return;this.shadowHost.remove(),this.shadowHost=null,this.#i()}catch(e){console.error(`Control panel destroy error: ${e}`)}}#i(){this.#t&&this.#t.abort(),this.#t=null,this.shadowRoot=null,this.depthLevelInput=null,this.depthLevel=0,this.multiElements=!1,this.#e&&(this.#e.depthLevel=0,this.#e.multiElements=!1,this.#e.ignorePanelEl=null)}#a=e=>{switch(e.target.id){case`sk-show-panel`:{if(!this.shadowRoot)return;let e=this.shadowRoot.getElementById(`sk-control-panel`);e&&(e.style.display=`flex`);break}case`sk-close-panel`:{if(!this.shadowRoot)return;let e=this.shadowRoot.getElementById(`sk-control-panel`);e&&(e.style.display=`none`);break}case`sk-toggle-inspector`:this.bus.emit(`ci:toggle`);break;case`sk-toggle-elements`:this.multiElements=!this.multiElements,this.depthLevelInput&&(this.multiElements?this.depthLevelInput.disabled=!1:this.depthLevelInput.disabled=!0),this.#e&&(this.#e.multiElements=this.multiElements);break;case`sk-toggle-switching`:this.#e&&(this.#e.inspectorSwitching=!this.#e.inspectorSwitching);break;case`sk-create-inspector`:this.bus.emit(`ci:create`);break;case`sk-reset-inspector`:this.bus.emit(`ci:reset`);break;case`sk-destroy-inspector`:this.bus.emit(`ci:destroy`);break;case`sk-full-inspect`:this.bus.emit(`engine:full`);break;default:console.error(`Could not dispatch an event for element of unknown id: ${e.target.id}`);break}};#o=e=>{let t=parseInt(e.target.value,10);this.depthLevel=t,this.#e&&(this.#e.depthLevel=t)}};exports.CompatControlPanel=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./inspector/inspector.cjs`),t=require(`./control-panel/control-panel.cjs`),n=require(`./compat-ui/compat-ui.cjs`);exports.CompatControlPanel=t.CompatControlPanel,exports.CompatInspector=e.CompatInspector,exports.CompatUI=n.CompatUI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../core/ui-component.cjs`);var t=class extends e.UIComponent{#e=null;#t=!1;#n=null;#r=null;constructor(e,t,n=void 0){super(e,t),this.config=n,this.enableSwitching=!1,this.inspectorEl=null,this.frozenTarget=null,this.bus.on(`ci:toggle`,()=>{this.#e?.inspectorActive?this.#m():this.#p()}),this.bus.on(`ci:create`,()=>{this.mount()}),this.bus.on(`ci:reset`,()=>{this.reset()}),this.bus.on(`ci:destroy`,()=>{this.unmount()})}#i=e=>{let t=e.ctrlKey,n=e.shiftKey,r=e.altKey;if(!this.inspectorEl&&t&&r&&e.key===`c`){this.mount();return}if(this.inspectorEl&&t&&n&&e.key===`|`){this.reset();return}if(this.inspectorEl&&t&&r&&e.key===`\\`){this.unmount();return}t&&e.key===`\\`&&(this.enableSwitching=!this.enableSwitching,console.log(`Switching is ${this.enableSwitching?`enabled`:`disabled`}`),this.#e&&(this.#e.inspectorSwitching=this.enableSwitching))};#a=e=>{if(!e.composedPath().includes(this.#r)){if(e.preventDefault(),e.stopPropagation(),!this.#t){this.#o(e.target);return}if(this.#t&&e.target===this.frozenTarget){this.#c();return}else this.#u(e.target)}};#o(e){this.inspectorEl&&(this.#t=!0,this.frozenTarget=e,this.#s(this.frozenTarget.outerHTML),Object.assign(this.inspectorEl.style,{backgroundColor:`rgba(255,0,0,.3)`,outlineColor:`rgb(255,0,0)`}))}#s(e){this.#e&&this.bus.emit(`engine:inspect`,{detail:{elem:e,multiElements:this.#e.multiElements,depthLevel:this.#e.depthLevel}})}#c(){this.inspectorEl&&(this.#t=!1,this.frozenTarget=null,Object.assign(this.inspectorEl.style,{backgroundColor:`rgba(0,255,0,.3)`,outlineColor:`rgb(0,255,0)`}))}#l=e=>{if(!this.#t)try{this.#d(e.target)}catch(e){console.error(`Inspector pointerOver error: ${e}`)}};#u(e){if(this.enableSwitching){this.#t=!0,this.frozenTarget=e,this.#s(this.frozenTarget.outerHTML);try{this.#d(e)}catch(e){console.error(`Inspector switch error: ${e}`)}}}#d(e){if(!this.inspectorEl)throw Error(`Failed to update inspector position and size as it does not exist.`);let{width:t,height:n,top:r,left:i}=e.getBoundingClientRect(),a=window.scrollY,o=window.scrollX;Object.assign(this.inspectorEl.style,{width:`${t}px`,height:`${n}px`,transform:`translateX(${i+o}px) translateY(${r+a}px)`})}createInspector(){if(this.inspectorEl){console.warn(`Inspector element already exists.`);return}this.inspectorEl=document.createElement(`div`),this.inspectorEl.id=`compat-inspector`,Object.assign(this.inspectorEl.style,{position:`absolute`,top:`0`,backgroundColor:`rgba(0, 255, 0, .3)`,outlineWidth:`1px`,outlineStyle:`dashed`,outlineColor:`rgb(0, 255, 0)`,outlineOffset:`4px`,zIndex:`9998`,transitionProperty:`width, height, transform`,transitionDuration:`300ms`,transitionTimingFunction:`ease-out`,willChange:`width, height, transform`,pointerEvents:`none`}),document.body.appendChild(this.inspectorEl)}#f(e){if(!(e instanceof HTMLDivElement)&&e!==null)throw Error(`el must be of type HTMLDivElement or null`);this.#r=e}bindState(e){this.#e||=e,this.#e.inspectorActive=this.inspectorEl!==null,this.#e.inspectorExists=this.inspectorEl!==null}onStateChange(e,t){switch(e){case`inspectorSwitching`:this.enableSwitching=t;break;case`ignorePanelEl`:this.#f(t);break;default:break}}mount(){if(this.inspectorEl||this.config?.disabled){console.warn(`Inspector is either disabled or already exists`);return}this.createInspector(),this.#p(),this.#e&&(this.#e.inspectorActive=this.inspectorEl!==null,this.#e.inspectorExists=this.inspectorEl!==null)}#p(){if(!this.inspectorEl){console.warn(`Cannot activate inspector as it does not exist.`);return}this.#n=new AbortController;let{signal:e}=this.#n;window.addEventListener(`pointerover`,this.#l,{signal:e}),window.addEventListener(`click`,this.#a,{signal:e,capture:!0}),this.config?.keyboardShortcuts&&window.addEventListener(`keydown`,this.#i),this.#e&&(this.#e.inspectorActive=!0)}#m(){if(!this.inspectorEl){console.warn(`Cannot deactivate inspector as it does not exist.`);return}this.#n&&this.#n.abort(),this.#n=null,this.#e&&(this.#e.inspectorActive=!1)}reset(){if(!this.inspectorEl){console.warn(`Cannot reset inspector as it does not exist.`);return}console.log(`Resetting inspector`),this.unmount(),this.mount()}unmount(){try{if(!this.inspectorEl){console.warn(`Cannot destroy inspector as it does not exist.`);return}console.log(`Destroying inspector`),this.#h(),this.inspectorEl.remove(),this.inspectorEl=null}catch(e){console.error(`Inspector destroy error: ${e}`)}}#h(){this.#m(),this.#t=!1,this.enableSwitching=!1,this.frozenTarget=null,this.#e&&(this.#e.inspectorActive=!1,this.#e.inspectorExists=!1,this.#e.inspectorSwitching=!1)}};exports.CompatInspector=t;
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shinkom",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A cross-browser compatibility library for developers",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "OneilNvM <oneil324@outlook.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/modules/index.cjs",
|
|
12
|
+
"module": "./dist/bundles/index.js",
|
|
13
|
+
"types": "./dist/bundles/index.d.ts",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"html",
|
|
16
|
+
"css",
|
|
17
|
+
"javascript",
|
|
18
|
+
"typescript",
|
|
19
|
+
"rust",
|
|
20
|
+
"wasm",
|
|
21
|
+
"cross-browser",
|
|
22
|
+
"compatibility",
|
|
23
|
+
"compat"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20.0.0"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/bundles/index.d.ts",
|
|
31
|
+
"import": "./dist/bundles/index.js",
|
|
32
|
+
"require": "./dist/modules/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./shinkom": {
|
|
35
|
+
"types": "./dist/bundles/shinkom/shinkom.d.ts",
|
|
36
|
+
"import": "./dist/bundles/shinkom/shinkom.js",
|
|
37
|
+
"require": "./dist/modules/shinkom/shinkom.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./engine": {
|
|
40
|
+
"types": "./dist/bundles/engine/engine.d.ts",
|
|
41
|
+
"import": "./dist/bundles/engine/engine.js",
|
|
42
|
+
"require": "./dist/modules/engine/engine.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./ui": {
|
|
45
|
+
"types": "./dist/bundles/ui/index.d.ts",
|
|
46
|
+
"import": "./dist/bundles/ui/index.js",
|
|
47
|
+
"require": "./dist/modules/ui/index.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./ui/inspector": {
|
|
50
|
+
"types": "./dist/bundles/ui/inspector/inspector.d.ts",
|
|
51
|
+
"import": "./dist/bundles/ui/inspector/inspector.js",
|
|
52
|
+
"require": "./dist/modules/ui/inspector/inspector.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./ui/control-panel": {
|
|
55
|
+
"types": "./dist/bundles/ui/control-panel/control-panel.d.ts",
|
|
56
|
+
"import": "./dist/bundles/ui/control-panel/control-panel.js",
|
|
57
|
+
"require": "./dist/modules/ui/control-panel/control-panel.cjs"
|
|
58
|
+
},
|
|
59
|
+
"./ui/compat-ui": {
|
|
60
|
+
"types": "./dist/bundles/ui/compat-ui/compat-ui.d.ts",
|
|
61
|
+
"import": "./dist/bundles/ui/compat-ui/compat-ui.js",
|
|
62
|
+
"require": "./dist/modules/ui/compat-ui/compat-ui.cjs"
|
|
63
|
+
},
|
|
64
|
+
"./@types": "./dist/bundles/types/public.d.ts",
|
|
65
|
+
"./wasm": "./dist/bundles/pkg/shinkore_bg.wasm"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"dev:nobuild": "vite",
|
|
69
|
+
"dev": "npm run build:wasm && vite",
|
|
70
|
+
"build": "npm run build:wasm && npm run build:js",
|
|
71
|
+
"build:js": "tsdown --config-loader unrun && cp src/types/public.d.ts dist/bundles/types/public.d.ts",
|
|
72
|
+
"build:wasm": "wasm-pack build shinkore --target web --out-dir ../pkg --release",
|
|
73
|
+
"test": "vitest",
|
|
74
|
+
"type:check": "tsc --project tsconfig.json",
|
|
75
|
+
"gen:data": "tsx ./scripts/extract-compat.ts && tsx ./scripts/extract-browser-data.ts && tsx ./scripts/extract-usage-data.ts"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@mdn/browser-compat-data": "7.3.13",
|
|
79
|
+
"@types/node": "^25.6.0",
|
|
80
|
+
"caniuse-db": "^1.0.30001790",
|
|
81
|
+
"jsdom": "^28.1.0",
|
|
82
|
+
"node": "^25.9.0",
|
|
83
|
+
"tsdown": "^0.21.2",
|
|
84
|
+
"tsx": "^4.21.0",
|
|
85
|
+
"typescript": "^5.9.3",
|
|
86
|
+
"vite": "^7.3.1",
|
|
87
|
+
"vitest": "^4.0.18"
|
|
88
|
+
}
|
|
89
|
+
}
|