diff --git a/addon/content/solid-example/panorama/scripts/custom_game/libs.js b/addon/content/solid-example/panorama/scripts/custom_game/libs.js index 20aa098..3dcd4d3 100644 --- a/addon/content/solid-example/panorama/scripts/custom_game/libs.js +++ b/addon/content/solid-example/panorama/scripts/custom_game/libs.js @@ -50,15 +50,15 @@ let Effects = null; let ExecCount = 0; function createRoot(fn, detachedOwner) { const listener = Listener, - owner = Owner, - unowned = fn.length === 0, - root = unowned ? UNOWNED : { - owned: null, - cleanups: null, - context: null, - owner: detachedOwner || owner - }, - updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root))); + owner = Owner, + unowned = fn.length === 0, + root = unowned ? UNOWNED : { + owned: null, + cleanups: null, + context: null, + owner: detachedOwner || owner + }, + updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root))); Owner = root; Listener = null; try { @@ -181,8 +181,8 @@ function updateComputation(node) { if (!node.fn) return; cleanNode(node); const owner = Owner, - listener = Listener, - time = ExecCount; + listener = Listener, + time = ExecCount; Listener = Owner = node; runComputation(node, node.value, time); Listener = listener; @@ -193,13 +193,7 @@ function runComputation(node, value, time) { try { nextValue = node.fn(value); } catch (err) { - if (node.pure) { - { - node.state = STALE; - node.owned && node.owned.forEach(cleanNode); - node.owned = null; - } - } + if (node.pure) node.state = STALE; handleError(err); } if (!node.updatedAt || node.updatedAt <= time) { @@ -281,7 +275,7 @@ function runQueue(queue) { } function runUserEffects(queue) { let i, - userLength = 0; + userLength = 0; for (i = 0; i < queue.length; i++) { const e = queue[i]; if (!e.user) runTop(e);else queue[userLength++] = e; @@ -316,11 +310,11 @@ function cleanNode(node) { if (node.sources) { while (node.sources.length) { const source = node.sources.pop(), - index = node.sourceSlots.pop(), - obs = source.observers; + index = node.sourceSlots.pop(), + obs = source.observers; if (obs && obs.length) { const n = obs.pop(), - s = source.observerSlots.pop(); + s = source.observerSlots.pop(); if (index < obs.length) { n.sourceSlots[s] = index; obs[index] = n; @@ -355,27 +349,27 @@ function dispose(d) { } function mapArray(list, mapFn, options = {}) { let items = [], - mapped = [], - disposers = [], - len = 0, - indexes = mapFn.length > 1 ? [] : null; + mapped = [], + disposers = [], + len = 0, + indexes = mapFn.length > 1 ? [] : null; onCleanup(() => dispose(disposers)); return () => { let newItems = list() || [], - i, - j; + i, + j; newItems[$TRACK]; return untrack(() => { let newLen = newItems.length, - newIndices, - newIndicesNext, - temp, - tempdisposers, - tempIndexes, - start, - end, - newEnd, - item; + newIndices, + newIndicesNext, + temp, + tempdisposers, + tempIndexes, + start, + end, + newEnd, + item; if (newLen === 0) { if (len !== 0) { dispose(disposers); @@ -458,11 +452,11 @@ function mapArray(list, mapFn, options = {}) { } function indexArray(list, mapFn, options = {}) { let items = [], - mapped = [], - disposers = [], - signals = [], - len = 0, - i; + mapped = [], + disposers = [], + signals = [], + len = 0, + i; onCleanup(() => dispose(disposers)); return () => { const newItems = list() || []; @@ -1223,66 +1217,8 @@ function setData(node, key, v) { node.Data()[key] = v; } -function _defineProperty(obj, key, value) { - key = _toPropertyKey(key); - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - return target; -} -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = _objectWithoutPropertiesLoose(source, excluded); - var key, i; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - return target; -} -function _toPrimitive(input, hint) { - if (typeof input !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (typeof res !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); -} -function _toPropertyKey(arg) { - var key = _toPrimitive(arg, "string"); - return typeof key === "symbol" ? key : String(key); -} - exports.For = For; exports.Index = Index; -exports._defineProperty = _defineProperty; -exports._objectWithoutProperties = _objectWithoutProperties; exports.batch = batch; exports.createComponent = createComponent; exports.createEffect = createEffect; diff --git a/addon/content/solid-example/panorama/scripts/custom_game/lowhud.js b/addon/content/solid-example/panorama/scripts/custom_game/lowhud.js index df0f2b3..b74a826 100644 --- a/addon/content/solid-example/panorama/scripts/custom_game/lowhud.js +++ b/addon/content/solid-example/panorama/scripts/custom_game/lowhud.js @@ -3,9 +3,7 @@ var libs = require('./libs.js'); class UpdateList { - constructor() { - libs._defineProperty(this, "_indexes", []); - } + _indexes = []; next(index) { return false; } @@ -201,10 +199,7 @@ function Ability(props) { } const DotaAbilitiesStyle = "styled-9a15cb87"; class AbilityList extends UpdateList { - constructor(...args) { - super(...args); - libs._defineProperty(this, "_abilities", []); - } + _abilities = []; next(index) { return !!this._abilities[index]; } @@ -418,7 +413,7 @@ function getItemList() { } return items; } -const Inventory = () => { +function Inventory() { const [itemList, setItemList] = libs.createSignal(getItemList()); libs.createEffect(() => { const id = GameEvents.Subscribe('dota_inventory_changed', () => { @@ -459,7 +454,7 @@ const Inventory = () => { })); return _el$3; })(); -}; +} const rootStyle = "styled-1ed2f423"; function App() { diff --git a/addon/content/solid-example/panorama/scripts/custom_game/panorama-polyfill.js b/addon/content/solid-example/panorama/scripts/custom_game/panorama-polyfill.js index db012a1..c966a88 100644 --- a/addon/content/solid-example/panorama/scripts/custom_game/panorama-polyfill.js +++ b/addon/content/solid-example/panorama/scripts/custom_game/panorama-polyfill.js @@ -4,10 +4,5 @@ !function(){"use strict";const e=new Map;let l=-1e5;const t=(e,l=0,...t)=>$.Schedule(l/1e3,(()=>e(...t)));function c(t,c=0,...a){c/=1e3,l-=1;const s=l,n=()=>{e.set(s,$.Schedule(c,n)),t(...a)};return e.set(s,$.Schedule(c,n)),s}const a=(e,...l)=>$.Schedule(0,(()=>e(...l)));function s(l){if("number"==typeof l)try{l<-1e5?e.has(l)&&($.CancelScheduled(e.get(l)),e.delete(l)):$.CancelScheduled(l)}catch(e){}}globalThis.setInterval=c,globalThis.clearInterval=s,globalThis.setTimeout=t,globalThis.clearTimeout=s,globalThis.setImmediate=a,globalThis.clearImmediate=s}(); -var polyfillModule = (function () { - return { - default: global => { - // global.x = 1 - } - }; +!(function () { })(); diff --git a/addon/content/solid-example/panorama/scripts/custom_game/shop.js b/addon/content/solid-example/panorama/scripts/custom_game/shop.js index 28098f2..9c1f04e 100644 --- a/addon/content/solid-example/panorama/scripts/custom_game/shop.js +++ b/addon/content/solid-example/panorama/scripts/custom_game/shop.js @@ -2,14 +2,12 @@ var libs = require('./libs.js'); -const _excluded = ["text", "icon", "color"]; -function CButton(_ref) { - let { - text, - icon, - color - } = _ref, - props = libs._objectWithoutProperties(_ref, _excluded); +function CButton({ + text, + icon, + color, + ...props +}) { return (() => { const _el$ = libs.createElement("Button", { "class": "btnStyle" diff --git a/scripts/build-rollup-config.ts b/scripts/build-rollup-config.ts index d642aca..20a9245 100644 --- a/scripts/build-rollup-config.ts +++ b/scripts/build-rollup-config.ts @@ -57,7 +57,7 @@ export default function GetRollupWatchOptions(rootPath: string) { extensions: ['.js', '.ts', '.tsx'], babelHelpers: 'bundled', presets: [ - ['@babel/preset-env', { targets: { node: '8.2' } }], + ['@babel/preset-env', { targets: { node: '18.12' } }], '@babel/preset-typescript', [ 'babel-preset-solid-panorama', diff --git a/src/components/Inventory.tsx b/src/components/Inventory.tsx index c068d1e..e2dcff2 100644 --- a/src/components/Inventory.tsx +++ b/src/components/Inventory.tsx @@ -50,13 +50,6 @@ interface ItemContainerProps { OnDblclick?: (itemEntityIndex: number) => void; } -export interface DragCallbacks { - removePositionBeforeDrop: boolean; - offsetY: number; - offsetX: number; - displayPanel: Panel; -} - /** * 单个物品 */ diff --git a/src/tsconfig.json b/src/tsconfig.json index edbfcaf..239e41e 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -11,14 +11,11 @@ "moduleResolution": "Node", "esModuleInterop": true, "strict": true, - "target": "ES2017", + "target": "ESNext", "types": ["@moddota/panorama-types"], - "lib": ["ES2017"], + "lib": ["ESNext"], "jsx": "preserve", "jsxImportSource": "solid-js", - "paths": { - "@common/*": ["./common/*"] - }, "plugins": [ { "name": "typescript-styled-plugin", @@ -29,7 +26,8 @@ "wash-color", "saturation", "brightness", - "contrast" + "contrast", + "tooltip-position" ] } }