Skip to content

Commit

Permalink
更新编译配置
Browse files Browse the repository at this point in the history
  • Loading branch information
robincodex committed Feb 13, 2023
1 parent afad0bf commit a2b06eb
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 137 deletions.
136 changes: 36 additions & 100 deletions addon/content/solid-example/panorama/scripts/custom_game/libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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() || [];
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
var libs = require('./libs.js');

class UpdateList {
constructor() {
libs._defineProperty(this, "_indexes", []);
}
_indexes = [];
next(index) {
return false;
}
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -459,7 +454,7 @@ const Inventory = () => {
}));
return _el$3;
})();
};
}

const rootStyle = "styled-1ed2f423";
function App() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions addon/content/solid-example/panorama/scripts/custom_game/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-rollup-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 0 additions & 7 deletions src/components/Inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ interface ItemContainerProps {
OnDblclick?: (itemEntityIndex: number) => void;
}

export interface DragCallbacks {
removePositionBeforeDrop: boolean;
offsetY: number;
offsetX: number;
displayPanel: Panel;
}

/**
* 单个物品
*/
Expand Down
10 changes: 4 additions & 6 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -29,7 +26,8 @@
"wash-color",
"saturation",
"brightness",
"contrast"
"contrast",
"tooltip-position"
]
}
}
Expand Down

0 comments on commit a2b06eb

Please sign in to comment.