@number10/phaserjsx 0.1.0 → 0.3.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/{TransformOriginView-CO-tJCmV.js → TransformOriginView-CzVjS16F.js} +987 -527
- package/dist/TransformOriginView-CzVjS16F.js.map +1 -0
- package/dist/{TransformOriginView-BYPbRH8N.cjs → TransformOriginView-KcTgaYRi.cjs} +929 -469
- package/dist/TransformOriginView-KcTgaYRi.cjs.map +1 -0
- package/dist/colors/index.d.ts +1 -1
- package/dist/colors/index.d.ts.map +1 -1
- package/dist/colors/preset-manager.d.ts +11 -7
- package/dist/colors/preset-manager.d.ts.map +1 -1
- package/dist/components/custom/Modal.d.ts.map +1 -1
- package/dist/components/custom/Portal.d.ts.map +1 -1
- package/dist/components/custom/ScrollSlider.d.ts +4 -0
- package/dist/components/custom/ScrollSlider.d.ts.map +1 -1
- package/dist/components/custom/ScrollView.d.ts +16 -0
- package/dist/components/custom/ScrollView.d.ts.map +1 -1
- package/dist/components/custom/Sidebar.d.ts.map +1 -1
- package/dist/components/custom/index.cjs +29 -29
- package/dist/components/custom/index.js +1 -1
- package/dist/gestures/gesture-manager.d.ts.map +1 -1
- package/dist/index.cjs +231 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +82 -77
- package/dist/index.js.map +1 -1
- package/dist/layout/utils/size-resolver.d.ts.map +1 -1
- package/dist/theme-defaults.d.ts +7 -1
- package/dist/theme-defaults.d.ts.map +1 -1
- package/dist/theme.d.ts +6 -4
- package/dist/theme.d.ts.map +1 -1
- package/dist/vdom.d.ts +21 -2
- package/dist/vdom.d.ts.map +1 -1
- package/package.json +4 -5
- package/dist/TransformOriginView-BYPbRH8N.cjs.map +0 -1
- package/dist/TransformOriginView-CO-tJCmV.js.map +0 -1
|
@@ -1444,7 +1444,7 @@ function requireLodash() {
|
|
|
1444
1444
|
var reIsNative = RegExp2(
|
|
1445
1445
|
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1446
1446
|
);
|
|
1447
|
-
var Buffer = moduleExports ? context.Buffer : undefined$1,
|
|
1447
|
+
var Buffer = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
|
|
1448
1448
|
var defineProperty = (function() {
|
|
1449
1449
|
try {
|
|
1450
1450
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -1459,7 +1459,7 @@ function requireLodash() {
|
|
|
1459
1459
|
var metaMap = WeakMap2 && new WeakMap2();
|
|
1460
1460
|
var realNames = {};
|
|
1461
1461
|
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
|
|
1462
|
-
var symbolProto =
|
|
1462
|
+
var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1;
|
|
1463
1463
|
function lodash2(value) {
|
|
1464
1464
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
1465
1465
|
if (value instanceof LodashWrapper) {
|
|
@@ -6644,10 +6644,6 @@ function resolveCalcOperand(operand, parentSize, viewportSize) {
|
|
|
6644
6644
|
}
|
|
6645
6645
|
if (operand.type === "percent") {
|
|
6646
6646
|
if (parentSize === void 0) {
|
|
6647
|
-
DebugLogger.warn(
|
|
6648
|
-
"Size",
|
|
6649
|
-
"Cannot resolve percentage in calc() without parent size. Using 0."
|
|
6650
|
-
);
|
|
6651
6647
|
return 0;
|
|
6652
6648
|
}
|
|
6653
6649
|
return parentSize * operand.value / 100;
|
|
@@ -7055,6 +7051,9 @@ class GestureManager {
|
|
|
7055
7051
|
this.activePointerDown = null;
|
|
7056
7052
|
}
|
|
7057
7053
|
this.hoveredContainers.delete(container);
|
|
7054
|
+
for (const hitContainers of this.activeContainersForMove.values()) {
|
|
7055
|
+
hitContainers.delete(container);
|
|
7056
|
+
}
|
|
7058
7057
|
}
|
|
7059
7058
|
/**
|
|
7060
7059
|
* Check if a container is registered
|
|
@@ -9696,6 +9695,18 @@ function getPresetWithMode(name, mode) {
|
|
|
9696
9695
|
const preset2 = getPreset(name);
|
|
9697
9696
|
return mode === "light" ? applyLightMode(preset2) : applyDarkMode(preset2);
|
|
9698
9697
|
}
|
|
9698
|
+
const colorPresets = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9699
|
+
__proto__: null,
|
|
9700
|
+
applyDarkMode,
|
|
9701
|
+
applyLightMode,
|
|
9702
|
+
forestGreenPreset,
|
|
9703
|
+
generateColorScale,
|
|
9704
|
+
getPreset,
|
|
9705
|
+
getPresetWithMode,
|
|
9706
|
+
midnightPreset,
|
|
9707
|
+
oceanBluePreset,
|
|
9708
|
+
presets
|
|
9709
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
9699
9710
|
const defaultSpacingTokens = {
|
|
9700
9711
|
xs: 4,
|
|
9701
9712
|
sm: 8,
|
|
@@ -9769,460 +9780,466 @@ function createTextStyleTokens(textColor) {
|
|
|
9769
9780
|
};
|
|
9770
9781
|
}
|
|
9771
9782
|
const defaultTextStyleTokens = createTextStyleTokens("#ffffff");
|
|
9772
|
-
|
|
9773
|
-
const
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
visible: true
|
|
9780
|
-
},
|
|
9781
|
-
Icon: {
|
|
9782
|
-
size: 24,
|
|
9783
|
-
tint: colors.border.dark.toNumber()
|
|
9784
|
-
},
|
|
9785
|
-
text: {
|
|
9786
|
-
text: "",
|
|
9787
|
-
alpha: 1,
|
|
9788
|
-
visible: true,
|
|
9789
|
-
style: textStyles.DEFAULT
|
|
9790
|
-
},
|
|
9791
|
-
nineslice: {
|
|
9792
|
-
alpha: 1,
|
|
9793
|
-
visible: true
|
|
9794
|
-
},
|
|
9795
|
-
sprite: {
|
|
9796
|
-
alpha: 1,
|
|
9797
|
-
visible: true
|
|
9798
|
-
},
|
|
9799
|
-
image: {
|
|
9800
|
-
alpha: 1,
|
|
9801
|
-
visible: true
|
|
9802
|
-
},
|
|
9803
|
-
graphics: {
|
|
9804
|
-
alpha: 1,
|
|
9805
|
-
visible: true
|
|
9806
|
-
},
|
|
9807
|
-
tilesprite: {
|
|
9808
|
-
alpha: 1,
|
|
9809
|
-
visible: true
|
|
9810
|
-
},
|
|
9811
|
-
// Public API (uppercase)
|
|
9812
|
-
View: {
|
|
9813
|
-
alpha: 1,
|
|
9814
|
-
visible: true
|
|
9815
|
-
},
|
|
9816
|
-
Text: {
|
|
9817
|
-
text: "",
|
|
9818
|
-
alpha: 1,
|
|
9819
|
-
visible: true,
|
|
9820
|
-
style: textStyles.DEFAULT
|
|
9821
|
-
},
|
|
9822
|
-
NineSlice: {
|
|
9823
|
-
alpha: 1,
|
|
9824
|
-
visible: true
|
|
9825
|
-
},
|
|
9826
|
-
Sprite: {
|
|
9827
|
-
alpha: 1,
|
|
9828
|
-
visible: true
|
|
9829
|
-
},
|
|
9830
|
-
Image: {
|
|
9831
|
-
alpha: 1,
|
|
9832
|
-
visible: true
|
|
9833
|
-
},
|
|
9834
|
-
Graphics: {
|
|
9835
|
-
alpha: 1,
|
|
9836
|
-
visible: true
|
|
9837
|
-
},
|
|
9838
|
-
TileSprite: {
|
|
9839
|
-
alpha: 1,
|
|
9840
|
-
visible: true
|
|
9841
|
-
},
|
|
9842
|
-
RadioButton: {
|
|
9843
|
-
selectedColor: colors.primary.DEFAULT.toNumber(),
|
|
9844
|
-
color: colors.border.medium.toNumber(),
|
|
9845
|
-
gap: 8,
|
|
9846
|
-
size: 16,
|
|
9847
|
-
innerSize: 12,
|
|
9848
|
-
labelStyle: {
|
|
9849
|
-
color: colors.text.DEFAULT.toString(),
|
|
9850
|
-
fontSize: "14px"
|
|
9851
|
-
}
|
|
9852
|
-
},
|
|
9853
|
-
ScrollSlider: {
|
|
9854
|
-
borderColor: colors.border.medium.toNumber(),
|
|
9855
|
-
trackColor: colors.surface.dark.toNumber(),
|
|
9856
|
-
thumbColor: colors.primary.light.toNumber(),
|
|
9857
|
-
borderWidth: 1,
|
|
9858
|
-
size: 12,
|
|
9859
|
-
minThumbSize: 20
|
|
9860
|
-
},
|
|
9861
|
-
Button: {
|
|
9862
|
-
disabledColor: colors.background.DEFAULT.toNumber(),
|
|
9863
|
-
iconSize: 24,
|
|
9864
|
-
backgroundColor: colors.primary.DEFAULT.toNumber(),
|
|
9865
|
-
backgroundAlpha: 1,
|
|
9866
|
-
borderColor: colors.primary.dark.toNumber(),
|
|
9867
|
-
borderWidth: 1,
|
|
9868
|
-
cornerRadius: 6,
|
|
9869
|
-
padding: 8,
|
|
9870
|
-
gap: 8,
|
|
9871
|
-
justifyContent: "center",
|
|
9872
|
-
alignItems: "center",
|
|
9873
|
-
primary: {
|
|
9874
|
-
backgroundColor: colors.primary.medium.toNumber(),
|
|
9875
|
-
borderColor: colors.primary.dark.toNumber()
|
|
9783
|
+
function buildDefaultTheme(colors) {
|
|
9784
|
+
const textStyles = createTextStyleTokens(colors.text.DEFAULT.toString());
|
|
9785
|
+
return {
|
|
9786
|
+
// Primitives (lowercase) - share same defaults as uppercase
|
|
9787
|
+
view: {
|
|
9788
|
+
alpha: 1,
|
|
9789
|
+
visible: true
|
|
9876
9790
|
},
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
effect: "press",
|
|
9881
|
-
effectConfig: { intensity: 0.9, time: 200 }
|
|
9791
|
+
Icon: {
|
|
9792
|
+
size: 24,
|
|
9793
|
+
tint: colors.border.dark.toNumber()
|
|
9882
9794
|
},
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
effect: "flash",
|
|
9889
|
-
effectConfig: { intensity: 1.15, time: 200 }
|
|
9795
|
+
text: {
|
|
9796
|
+
text: "",
|
|
9797
|
+
alpha: 1,
|
|
9798
|
+
visible: true,
|
|
9799
|
+
style: textStyles.DEFAULT
|
|
9890
9800
|
},
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9801
|
+
nineslice: {
|
|
9802
|
+
alpha: 1,
|
|
9803
|
+
visible: true
|
|
9894
9804
|
},
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9805
|
+
sprite: {
|
|
9806
|
+
alpha: 1,
|
|
9807
|
+
visible: true
|
|
9898
9808
|
},
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
}
|
|
9903
|
-
},
|
|
9904
|
-
Sidebar: {
|
|
9905
|
-
variant: "solid",
|
|
9906
|
-
size: "md",
|
|
9907
|
-
backgroundColor: colors.surface.light.toNumber(),
|
|
9908
|
-
backgroundAlpha: 1,
|
|
9909
|
-
padding: 16,
|
|
9910
|
-
gap: 8,
|
|
9911
|
-
dividerColor: colors.border.light.toNumber(),
|
|
9912
|
-
itemGap: 8,
|
|
9913
|
-
sectionGap: 10,
|
|
9914
|
-
headerStyle: {
|
|
9915
|
-
gap: 10,
|
|
9916
|
-
padding: { bottom: 6 },
|
|
9917
|
-
width: "fill"
|
|
9809
|
+
image: {
|
|
9810
|
+
alpha: 1,
|
|
9811
|
+
visible: true
|
|
9918
9812
|
},
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
width: "fill"
|
|
9813
|
+
graphics: {
|
|
9814
|
+
alpha: 1,
|
|
9815
|
+
visible: true
|
|
9923
9816
|
},
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9817
|
+
tilesprite: {
|
|
9818
|
+
alpha: 1,
|
|
9819
|
+
visible: true
|
|
9820
|
+
},
|
|
9821
|
+
// Public API (uppercase)
|
|
9822
|
+
View: {
|
|
9823
|
+
alpha: 1,
|
|
9824
|
+
visible: true
|
|
9825
|
+
},
|
|
9826
|
+
Text: {
|
|
9827
|
+
text: "",
|
|
9828
|
+
alpha: 1,
|
|
9829
|
+
visible: true,
|
|
9830
|
+
style: textStyles.DEFAULT
|
|
9831
|
+
},
|
|
9832
|
+
NineSlice: {
|
|
9833
|
+
alpha: 1,
|
|
9834
|
+
visible: true
|
|
9835
|
+
},
|
|
9836
|
+
Sprite: {
|
|
9837
|
+
alpha: 1,
|
|
9838
|
+
visible: true
|
|
9839
|
+
},
|
|
9840
|
+
Image: {
|
|
9841
|
+
alpha: 1,
|
|
9842
|
+
visible: true
|
|
9843
|
+
},
|
|
9844
|
+
Graphics: {
|
|
9845
|
+
alpha: 1,
|
|
9846
|
+
visible: true
|
|
9847
|
+
},
|
|
9848
|
+
TileSprite: {
|
|
9849
|
+
alpha: 1,
|
|
9850
|
+
visible: true
|
|
9851
|
+
},
|
|
9852
|
+
RadioButton: {
|
|
9853
|
+
selectedColor: colors.primary.DEFAULT.toNumber(),
|
|
9854
|
+
color: colors.border.medium.toNumber(),
|
|
9855
|
+
gap: 10,
|
|
9856
|
+
size: 16,
|
|
9857
|
+
innerSize: 16,
|
|
9858
|
+
labelStyle: {
|
|
9859
|
+
color: colors.text.DEFAULT.toString(),
|
|
9860
|
+
fontSize: "14px"
|
|
9932
9861
|
}
|
|
9933
9862
|
},
|
|
9934
|
-
|
|
9863
|
+
ScrollSlider: {
|
|
9864
|
+
borderColor: colors.border.dark.toNumber(),
|
|
9865
|
+
trackColor: colors.surface.dark.toNumber(),
|
|
9866
|
+
thumbColor: colors.primary.dark.toNumber(),
|
|
9867
|
+
borderWidth: 2,
|
|
9868
|
+
minThumbSize: 30,
|
|
9869
|
+
size: 24
|
|
9870
|
+
},
|
|
9871
|
+
Button: {
|
|
9872
|
+
disabledColor: colors.background.DEFAULT.toNumber(),
|
|
9873
|
+
iconSize: 24,
|
|
9874
|
+
backgroundColor: colors.primary.DEFAULT.toNumber(),
|
|
9875
|
+
backgroundAlpha: 1,
|
|
9876
|
+
borderColor: colors.primary.dark.toNumber(),
|
|
9877
|
+
borderWidth: 1,
|
|
9878
|
+
cornerRadius: 6,
|
|
9879
|
+
padding: 8,
|
|
9935
9880
|
gap: 8,
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
...textStyles.medium,
|
|
9942
|
-
color: colors.text.dark.toString()
|
|
9881
|
+
justifyContent: "center",
|
|
9882
|
+
alignItems: "center",
|
|
9883
|
+
primary: {
|
|
9884
|
+
backgroundColor: colors.primary.medium.toNumber(),
|
|
9885
|
+
borderColor: colors.primary.dark.toNumber()
|
|
9943
9886
|
},
|
|
9944
|
-
|
|
9945
|
-
backgroundColor: colors.
|
|
9946
|
-
borderColor: colors.
|
|
9947
|
-
|
|
9948
|
-
|
|
9887
|
+
secondary: {
|
|
9888
|
+
backgroundColor: colors.secondary.DEFAULT.toNumber(),
|
|
9889
|
+
borderColor: colors.secondary.dark.toNumber(),
|
|
9890
|
+
effect: "press",
|
|
9891
|
+
effectConfig: { intensity: 0.9, time: 200 }
|
|
9949
9892
|
},
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9893
|
+
outline: {
|
|
9894
|
+
backgroundColor: 0,
|
|
9895
|
+
backgroundAlpha: 0,
|
|
9896
|
+
borderColor: colors.accent.DEFAULT.toNumber(),
|
|
9897
|
+
borderWidth: 2,
|
|
9898
|
+
effect: "flash",
|
|
9899
|
+
effectConfig: { intensity: 1.15, time: 200 }
|
|
9900
|
+
},
|
|
9901
|
+
small: {
|
|
9902
|
+
padding: 6,
|
|
9903
|
+
cornerRadius: 4
|
|
9904
|
+
},
|
|
9905
|
+
medium: {
|
|
9906
|
+
padding: 8,
|
|
9907
|
+
cornerRadius: 6
|
|
9908
|
+
},
|
|
9909
|
+
large: {
|
|
9910
|
+
padding: { top: 12, bottom: 12, left: 8, right: 8 },
|
|
9911
|
+
cornerRadius: 8
|
|
9961
9912
|
}
|
|
9962
9913
|
},
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9914
|
+
Sidebar: {
|
|
9915
|
+
variant: "solid",
|
|
9916
|
+
size: "md",
|
|
9917
|
+
backgroundColor: colors.surface.light.toNumber(),
|
|
9918
|
+
backgroundAlpha: 1,
|
|
9919
|
+
padding: 16,
|
|
9920
|
+
gap: 8,
|
|
9921
|
+
dividerColor: colors.border.light.toNumber(),
|
|
9922
|
+
itemGap: 8,
|
|
9923
|
+
sectionGap: 10,
|
|
9924
|
+
headerStyle: {
|
|
9925
|
+
gap: 10,
|
|
9926
|
+
padding: { bottom: 6 },
|
|
9927
|
+
width: "fill"
|
|
9968
9928
|
},
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
borderWidth: 1
|
|
9929
|
+
footerStyle: {
|
|
9930
|
+
gap: 8,
|
|
9931
|
+
padding: { top: 6 },
|
|
9932
|
+
width: "fill"
|
|
9974
9933
|
},
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9934
|
+
sectionStyle: {
|
|
9935
|
+
gap: 8,
|
|
9936
|
+
padding: { top: 4, bottom: 8 },
|
|
9937
|
+
width: "fill",
|
|
9938
|
+
titleStyle: {
|
|
9939
|
+
...textStyles.medium,
|
|
9940
|
+
color: colors.text.dark.toString(),
|
|
9941
|
+
fontStyle: "bold"
|
|
9942
|
+
}
|
|
9979
9943
|
},
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9944
|
+
itemStyle: {
|
|
9945
|
+
gap: 8,
|
|
9946
|
+
padding: { top: 8, bottom: 8, left: 10, right: 10 },
|
|
9947
|
+
width: "fill",
|
|
9948
|
+
cornerRadius: 8,
|
|
9949
|
+
backgroundColor: colors.surface.lightest.toNumber(),
|
|
9950
|
+
textStyle: {
|
|
9951
|
+
...textStyles.medium,
|
|
9952
|
+
color: colors.text.dark.toString()
|
|
9953
|
+
},
|
|
9954
|
+
active: {
|
|
9955
|
+
backgroundColor: colors.primary.lightest.toNumber(),
|
|
9956
|
+
borderColor: colors.primary.light.toNumber(),
|
|
9957
|
+
borderWidth: 1,
|
|
9958
|
+
backgroundAlpha: 0.9
|
|
9959
|
+
},
|
|
9960
|
+
disabledAlpha: 0.5
|
|
9961
|
+
},
|
|
9962
|
+
badgeStyle: {
|
|
9963
|
+
backgroundColor: colors.primary.light.toNumber(),
|
|
9964
|
+
backgroundAlpha: 0.15,
|
|
9965
|
+
cornerRadius: 6,
|
|
9966
|
+
padding: { top: 4, bottom: 4, left: 8, right: 8 },
|
|
9967
|
+
textStyle: {
|
|
9968
|
+
...textStyles.small,
|
|
9969
|
+
color: colors.primary.dark.toString(),
|
|
9970
|
+
fontStyle: "bold"
|
|
9971
|
+
}
|
|
9972
|
+
},
|
|
9973
|
+
variants: {
|
|
9974
|
+
solid: {
|
|
9975
|
+
backgroundColor: colors.surface.light.toNumber(),
|
|
9976
|
+
borderColor: colors.border.light.toNumber(),
|
|
9977
|
+
borderWidth: 1
|
|
9978
|
+
},
|
|
9979
|
+
muted: {
|
|
9980
|
+
backgroundColor: colors.surface.medium.toNumber(),
|
|
9981
|
+
backgroundAlpha: 0.85,
|
|
9982
|
+
borderColor: colors.border.light.toNumber(),
|
|
9983
|
+
borderWidth: 1
|
|
9984
|
+
},
|
|
9985
|
+
ghost: {
|
|
9986
|
+
backgroundColor: colors.background.lightest.toNumber(),
|
|
9987
|
+
backgroundAlpha: 0.6,
|
|
9988
|
+
borderWidth: 0
|
|
9989
|
+
},
|
|
9990
|
+
inset: {
|
|
9991
|
+
backgroundColor: colors.surface.dark.toNumber(),
|
|
9992
|
+
backgroundAlpha: 1,
|
|
9993
|
+
borderColor: colors.border.medium.toNumber(),
|
|
9994
|
+
borderWidth: 1
|
|
9995
|
+
}
|
|
9996
|
+
},
|
|
9997
|
+
sizes: {
|
|
9998
|
+
sm: {
|
|
9999
|
+
padding: 10,
|
|
10000
|
+
gap: 6
|
|
10001
|
+
},
|
|
10002
|
+
md: {
|
|
10003
|
+
padding: 16,
|
|
10004
|
+
gap: 8
|
|
10005
|
+
},
|
|
10006
|
+
lg: {
|
|
10007
|
+
padding: { top: 20, bottom: 20, left: 16, right: 16 },
|
|
10008
|
+
gap: 12
|
|
10009
|
+
}
|
|
9985
10010
|
}
|
|
9986
10011
|
},
|
|
9987
|
-
|
|
9988
|
-
|
|
10012
|
+
Accordion: {
|
|
10013
|
+
effect: "none",
|
|
10014
|
+
effectConfig: { magnitude: 0.02, time: 150 },
|
|
10015
|
+
headerStyle: {
|
|
10016
|
+
backgroundColor: colors.surface.dark.toNumber(),
|
|
10017
|
+
padding: 10,
|
|
10018
|
+
gap: 10,
|
|
10019
|
+
cornerRadius: 5,
|
|
10020
|
+
width: "fill"
|
|
10021
|
+
},
|
|
10022
|
+
contentStyle: {
|
|
10023
|
+
backgroundColor: colors.surface.light.toNumber(),
|
|
9989
10024
|
padding: 10,
|
|
9990
|
-
|
|
10025
|
+
cornerRadius: 5,
|
|
10026
|
+
width: "fill"
|
|
9991
10027
|
},
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
gap: 8
|
|
10028
|
+
Icon: {
|
|
10029
|
+
size: 24
|
|
9995
10030
|
},
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
10031
|
+
textStyle: {
|
|
10032
|
+
color: colors.text.DEFAULT.toString(),
|
|
10033
|
+
fontSize: "18px"
|
|
9999
10034
|
}
|
|
10000
|
-
}
|
|
10001
|
-
},
|
|
10002
|
-
Accordion: {
|
|
10003
|
-
effect: "none",
|
|
10004
|
-
effectConfig: { magnitude: 0.02, time: 150 },
|
|
10005
|
-
headerStyle: {
|
|
10006
|
-
backgroundColor: colors.surface.dark.toNumber(),
|
|
10007
|
-
padding: 10,
|
|
10008
|
-
gap: 10,
|
|
10009
|
-
cornerRadius: 5,
|
|
10010
|
-
width: "fill"
|
|
10011
10035
|
},
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10036
|
+
NineSliceButton: {},
|
|
10037
|
+
CharText: {
|
|
10038
|
+
charSpacing: 0,
|
|
10039
|
+
cursorColor: colors.secondary.DEFAULT.toNumber(),
|
|
10040
|
+
cursorWidth: 3,
|
|
10041
|
+
cursorBlinkSpeed: 200,
|
|
10042
|
+
selectionAlpha: 0.3,
|
|
10043
|
+
lineHeight: 1.2,
|
|
10044
|
+
wordWrap: true,
|
|
10045
|
+
textStyle: textStyles.DEFAULT,
|
|
10046
|
+
borderColor: colors.border.medium.toNumber(),
|
|
10047
|
+
borderWidth: 2,
|
|
10048
|
+
cornerRadius: 6,
|
|
10049
|
+
padding: 10
|
|
10020
10050
|
},
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
selectionAlpha: 0.3,
|
|
10033
|
-
lineHeight: 1.2,
|
|
10034
|
-
wordWrap: true,
|
|
10035
|
-
textStyle: textStyles.DEFAULT,
|
|
10036
|
-
borderColor: colors.border.medium.toNumber(),
|
|
10037
|
-
borderWidth: 2,
|
|
10038
|
-
cornerRadius: 6,
|
|
10039
|
-
padding: 10
|
|
10040
|
-
},
|
|
10041
|
-
CharTextInput: {
|
|
10042
|
-
charSpacing: 2,
|
|
10043
|
-
cursorColor: colors.accent.DEFAULT.toNumber(),
|
|
10044
|
-
cursorWidth: 3,
|
|
10045
|
-
cursorBlinkSpeed: 200,
|
|
10046
|
-
selectionColor: colors.accent.light.toNumber(),
|
|
10047
|
-
selectionAlpha: 0.5,
|
|
10048
|
-
lineHeight: 1.2,
|
|
10049
|
-
wordWrap: false,
|
|
10050
|
-
disabledColor: colors.border.dark.toNumber(),
|
|
10051
|
-
focusedBorderColor: colors.accent.lightest.toNumber(),
|
|
10052
|
-
backgroundColor: colors.surface.medium.toNumber(),
|
|
10053
|
-
borderColor: colors.border.medium.toNumber(),
|
|
10054
|
-
borderWidth: 1,
|
|
10055
|
-
padding: 8,
|
|
10056
|
-
textStyle: textStyles.DEFAULT
|
|
10057
|
-
},
|
|
10058
|
-
Dropdown: {
|
|
10059
|
-
trigger: {
|
|
10051
|
+
CharTextInput: {
|
|
10052
|
+
charSpacing: 2,
|
|
10053
|
+
cursorColor: colors.secondary.DEFAULT.toNumber(),
|
|
10054
|
+
cursorWidth: 3,
|
|
10055
|
+
cursorBlinkSpeed: 200,
|
|
10056
|
+
selectionColor: colors.accent.light.toNumber(),
|
|
10057
|
+
selectionAlpha: 0.5,
|
|
10058
|
+
lineHeight: 1.2,
|
|
10059
|
+
wordWrap: false,
|
|
10060
|
+
disabledColor: colors.border.dark.toNumber(),
|
|
10061
|
+
focusedBorderColor: colors.accent.lightest.toNumber(),
|
|
10060
10062
|
backgroundColor: colors.surface.medium.toNumber(),
|
|
10061
10063
|
borderColor: colors.border.medium.toNumber(),
|
|
10062
10064
|
borderWidth: 1,
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
width: "fill"
|
|
10065
|
+
padding: 8,
|
|
10066
|
+
textStyle: textStyles.DEFAULT
|
|
10066
10067
|
},
|
|
10067
|
-
|
|
10068
|
-
|
|
10068
|
+
Dropdown: {
|
|
10069
|
+
trigger: {
|
|
10070
|
+
backgroundColor: colors.surface.medium.toNumber(),
|
|
10071
|
+
borderColor: colors.border.medium.toNumber(),
|
|
10072
|
+
borderWidth: 1,
|
|
10073
|
+
cornerRadius: 4,
|
|
10074
|
+
padding: { left: 12, right: 12, top: 8, bottom: 8 },
|
|
10075
|
+
width: "fill"
|
|
10076
|
+
},
|
|
10077
|
+
triggerHover: {
|
|
10078
|
+
borderColor: colors.primary.DEFAULT.toNumber()
|
|
10079
|
+
},
|
|
10080
|
+
triggerOpen: {
|
|
10081
|
+
borderColor: colors.primary.DEFAULT.toNumber(),
|
|
10082
|
+
backgroundColor: colors.surface.dark.toNumber()
|
|
10083
|
+
},
|
|
10084
|
+
triggerDisabled: {
|
|
10085
|
+
backgroundColor: colors.surface.light.toNumber(),
|
|
10086
|
+
alpha: 0.5
|
|
10087
|
+
},
|
|
10088
|
+
arrow: {
|
|
10089
|
+
color: colors.text.DEFAULT.toNumber(),
|
|
10090
|
+
size: 12
|
|
10091
|
+
},
|
|
10092
|
+
overlay: {
|
|
10093
|
+
backgroundColor: colors.surface.medium.toNumber(),
|
|
10094
|
+
borderColor: colors.border.medium.toNumber(),
|
|
10095
|
+
borderWidth: 1,
|
|
10096
|
+
cornerRadius: 4,
|
|
10097
|
+
maxHeight: 300,
|
|
10098
|
+
padding: 4
|
|
10099
|
+
},
|
|
10100
|
+
option: {
|
|
10101
|
+
padding: { left: 12, right: 12, top: 8, bottom: 8 }
|
|
10102
|
+
},
|
|
10103
|
+
optionSelected: {
|
|
10104
|
+
backgroundColor: colors.primary.light.toNumber(),
|
|
10105
|
+
Text: {
|
|
10106
|
+
style: textStyles.DEFAULT
|
|
10107
|
+
}
|
|
10108
|
+
},
|
|
10109
|
+
optionDisabled: {
|
|
10110
|
+
alpha: 0.3
|
|
10111
|
+
},
|
|
10112
|
+
textStyle: textStyles.DEFAULT,
|
|
10113
|
+
placeholderStyle: textStyles.DEFAULT,
|
|
10114
|
+
filterInput: {
|
|
10115
|
+
backgroundColor: colors.surface.lightest.toNumber(),
|
|
10116
|
+
borderColor: colors.border.medium.toNumber()
|
|
10117
|
+
//height: 32,
|
|
10118
|
+
},
|
|
10119
|
+
animationConfig: "stiff",
|
|
10120
|
+
optionGap: 2
|
|
10069
10121
|
},
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10122
|
+
Slider: {
|
|
10123
|
+
// Track styling
|
|
10124
|
+
trackColor: colors.surface.dark.toNumber(),
|
|
10125
|
+
trackFilledColor: colors.primary.dark.toNumber(),
|
|
10126
|
+
trackHeight: 6,
|
|
10127
|
+
trackBorderRadius: 3,
|
|
10128
|
+
trackLength: 200,
|
|
10129
|
+
trackHoverColor: colors.surface.dark.toNumber(),
|
|
10130
|
+
// Thumb styling
|
|
10131
|
+
thumbColor: colors.primary.light.toNumber(),
|
|
10132
|
+
thumbSize: 20,
|
|
10133
|
+
thumbBorderColor: colors.border.light.toNumber(),
|
|
10134
|
+
thumbBorderWidth: 2,
|
|
10135
|
+
thumbHoverColor: colors.primary.light.toNumber(),
|
|
10136
|
+
thumbActiveColor: colors.primary.dark.toNumber(),
|
|
10137
|
+
thumbDragScale: 1.1,
|
|
10138
|
+
// Marks/Ticks
|
|
10139
|
+
markColor: colors.border.medium.toNumber(),
|
|
10140
|
+
markHeight: 8,
|
|
10141
|
+
markWidth: 2,
|
|
10142
|
+
// Value label
|
|
10143
|
+
labelStyle: textStyles.small,
|
|
10144
|
+
labelOffset: 10,
|
|
10145
|
+
valueLabel: {
|
|
10146
|
+
backgroundColor: colors.background.dark.toNumber(),
|
|
10147
|
+
textStyle: { ...textStyles.small, color: colors.text.light.toString() },
|
|
10148
|
+
padding: { left: 6, right: 6, top: 4, bottom: 4 },
|
|
10149
|
+
cornerRadius: 4,
|
|
10150
|
+
offset: 8
|
|
10151
|
+
},
|
|
10152
|
+
// RangeSlider specific
|
|
10153
|
+
minDistance: 0,
|
|
10154
|
+
// States
|
|
10155
|
+
disabledAlpha: 0.4,
|
|
10156
|
+
// Animation & Effects
|
|
10157
|
+
animationConfig: { tension: 300, friction: 30 }
|
|
10073
10158
|
},
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10159
|
+
Toggle: {
|
|
10160
|
+
width: 50,
|
|
10161
|
+
height: 28,
|
|
10162
|
+
thumbSize: 24,
|
|
10163
|
+
trackColorOff: colors.surface.dark.toNumber(),
|
|
10164
|
+
trackColorOn: colors.success.DEFAULT.toNumber(),
|
|
10165
|
+
thumbColor: colors.surface.lightest.toNumber(),
|
|
10166
|
+
disabledColor: colors.border.medium.toNumber(),
|
|
10167
|
+
padding: 2,
|
|
10168
|
+
duration: 200,
|
|
10169
|
+
gap: 8,
|
|
10170
|
+
labelStyle: textStyles.DEFAULT,
|
|
10171
|
+
labelPosition: "right"
|
|
10077
10172
|
},
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10173
|
+
Modal: {
|
|
10174
|
+
backdropColor: 0,
|
|
10175
|
+
backdropOpacity: 0.5
|
|
10081
10176
|
},
|
|
10082
|
-
|
|
10083
|
-
backgroundColor: colors.surface.
|
|
10084
|
-
borderColor: colors.border.
|
|
10177
|
+
Dialog: {
|
|
10178
|
+
backgroundColor: colors.surface.DEFAULT.toNumber(),
|
|
10179
|
+
borderColor: colors.border.light.toNumber(),
|
|
10085
10180
|
borderWidth: 1,
|
|
10086
|
-
cornerRadius:
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10181
|
+
cornerRadius: 8,
|
|
10182
|
+
padding: 0,
|
|
10183
|
+
maxWidth: 600,
|
|
10184
|
+
showClose: true,
|
|
10185
|
+
Header: {
|
|
10186
|
+
padding: { left: 24, right: 24, top: 20, bottom: 16 },
|
|
10187
|
+
gap: 12,
|
|
10188
|
+
textStyle: textStyles.heading,
|
|
10189
|
+
closeButton: {
|
|
10190
|
+
size: 32,
|
|
10191
|
+
cornerRadius: 4,
|
|
10192
|
+
backgroundColor: colors.surface.dark.toNumber(),
|
|
10193
|
+
borderColor: colors.border.light.toNumber(),
|
|
10194
|
+
borderWidth: 1
|
|
10195
|
+
}
|
|
10196
|
+
},
|
|
10197
|
+
Content: {
|
|
10198
|
+
padding: { left: 24, right: 24, top: 16, bottom: 16 },
|
|
10199
|
+
gap: 12
|
|
10200
|
+
},
|
|
10201
|
+
Actions: {
|
|
10202
|
+
padding: { left: 24, right: 24, top: 16, bottom: 20 },
|
|
10203
|
+
gap: 12,
|
|
10204
|
+
justifyContent: "end"
|
|
10097
10205
|
}
|
|
10098
10206
|
},
|
|
10099
|
-
|
|
10100
|
-
|
|
10207
|
+
AlertDialog: {
|
|
10208
|
+
maxWidth: 500
|
|
10101
10209
|
},
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
borderColor: colors.border.medium.toNumber()
|
|
10107
|
-
//height: 32,
|
|
10210
|
+
WrapText: {
|
|
10211
|
+
wrap: true,
|
|
10212
|
+
paddingOffset: 0,
|
|
10213
|
+
textStyle: textStyles.DEFAULT
|
|
10108
10214
|
},
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
thumbDragScale: 1.1,
|
|
10128
|
-
// Marks/Ticks
|
|
10129
|
-
markColor: colors.border.medium.toNumber(),
|
|
10130
|
-
markHeight: 8,
|
|
10131
|
-
markWidth: 2,
|
|
10132
|
-
// Value label
|
|
10133
|
-
labelStyle: textStyles.small,
|
|
10134
|
-
labelOffset: 10,
|
|
10135
|
-
valueLabel: {
|
|
10136
|
-
backgroundColor: colors.surface.darkest.toNumber(),
|
|
10137
|
-
textStyle: { ...textStyles.small, color: colors.text.light.toString() },
|
|
10138
|
-
padding: { left: 6, right: 6, top: 4, bottom: 4 },
|
|
10139
|
-
cornerRadius: 4,
|
|
10140
|
-
offset: 8
|
|
10141
|
-
},
|
|
10142
|
-
// RangeSlider specific
|
|
10143
|
-
minDistance: 0,
|
|
10144
|
-
// States
|
|
10145
|
-
disabledAlpha: 0.4,
|
|
10146
|
-
// Animation & Effects
|
|
10147
|
-
animationConfig: { tension: 300, friction: 30 }
|
|
10148
|
-
},
|
|
10149
|
-
Toggle: {
|
|
10150
|
-
width: 50,
|
|
10151
|
-
height: 28,
|
|
10152
|
-
thumbSize: 24,
|
|
10153
|
-
trackColorOff: colors.surface.dark.toNumber(),
|
|
10154
|
-
trackColorOn: colors.success.DEFAULT.toNumber(),
|
|
10155
|
-
thumbColor: colors.surface.lightest.toNumber(),
|
|
10156
|
-
disabledColor: colors.border.medium.toNumber(),
|
|
10157
|
-
padding: 2,
|
|
10158
|
-
duration: 200,
|
|
10159
|
-
gap: 8,
|
|
10160
|
-
labelStyle: textStyles.DEFAULT,
|
|
10161
|
-
labelPosition: "right"
|
|
10162
|
-
},
|
|
10163
|
-
Modal: {
|
|
10164
|
-
backdropColor: 0,
|
|
10165
|
-
backdropOpacity: 0.5
|
|
10166
|
-
},
|
|
10167
|
-
Dialog: {
|
|
10168
|
-
backgroundColor: colors.surface.DEFAULT.toNumber(),
|
|
10169
|
-
borderColor: colors.border.light.toNumber(),
|
|
10170
|
-
borderWidth: 1,
|
|
10171
|
-
cornerRadius: 8,
|
|
10172
|
-
padding: 0,
|
|
10173
|
-
maxWidth: 600,
|
|
10174
|
-
showClose: true,
|
|
10175
|
-
Header: {
|
|
10176
|
-
padding: { left: 24, right: 24, top: 20, bottom: 16 },
|
|
10177
|
-
gap: 12,
|
|
10178
|
-
textStyle: textStyles.heading,
|
|
10179
|
-
closeButton: {
|
|
10180
|
-
size: 32,
|
|
10181
|
-
cornerRadius: 4,
|
|
10182
|
-
backgroundColor: colors.surface.dark.toNumber(),
|
|
10183
|
-
borderColor: colors.border.light.toNumber(),
|
|
10184
|
-
borderWidth: 1
|
|
10215
|
+
Tooltip: {
|
|
10216
|
+
position: "top",
|
|
10217
|
+
showDelay: 1e3,
|
|
10218
|
+
hideDelay: 500,
|
|
10219
|
+
offset: 8,
|
|
10220
|
+
textStyle: {
|
|
10221
|
+
fontSize: "12px",
|
|
10222
|
+
fontFamily: "Arial",
|
|
10223
|
+
color: colors.text.dark.toString(),
|
|
10224
|
+
backgroundColor: colors.warning.medium.toString(),
|
|
10225
|
+
padding: { x: 2, y: 2 }
|
|
10226
|
+
},
|
|
10227
|
+
cornerRadius: 8,
|
|
10228
|
+
animation: {
|
|
10229
|
+
fadeIn: 200,
|
|
10230
|
+
fadeOut: 200,
|
|
10231
|
+
move: { dx: 0, dy: -20 },
|
|
10232
|
+
pulse: false
|
|
10185
10233
|
}
|
|
10186
|
-
},
|
|
10187
|
-
Content: {
|
|
10188
|
-
padding: { left: 24, right: 24, top: 16, bottom: 16 },
|
|
10189
|
-
gap: 12
|
|
10190
|
-
},
|
|
10191
|
-
Actions: {
|
|
10192
|
-
padding: { left: 24, right: 24, top: 16, bottom: 20 },
|
|
10193
|
-
gap: 12,
|
|
10194
|
-
justifyContent: "end"
|
|
10195
10234
|
}
|
|
10196
|
-
}
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
},
|
|
10205
|
-
Tooltip: {
|
|
10206
|
-
position: "top",
|
|
10207
|
-
showDelay: 1e3,
|
|
10208
|
-
hideDelay: 500,
|
|
10209
|
-
offset: 8,
|
|
10210
|
-
textStyle: {
|
|
10211
|
-
fontSize: "12px",
|
|
10212
|
-
fontFamily: "Arial",
|
|
10213
|
-
color: colors.text.dark.toString(),
|
|
10214
|
-
backgroundColor: colors.warning.medium.toString(),
|
|
10215
|
-
padding: { x: 2, y: 2 }
|
|
10216
|
-
},
|
|
10217
|
-
cornerRadius: 8,
|
|
10218
|
-
animation: {
|
|
10219
|
-
fadeIn: 200,
|
|
10220
|
-
fadeOut: 200,
|
|
10221
|
-
move: { dx: 0, dy: -20 },
|
|
10222
|
-
pulse: false
|
|
10223
|
-
}
|
|
10224
|
-
}
|
|
10225
|
-
};
|
|
10235
|
+
};
|
|
10236
|
+
}
|
|
10237
|
+
const preset = getPresetWithMode("oceanBlue", "light");
|
|
10238
|
+
const defaultTheme = buildDefaultTheme(preset.colors);
|
|
10239
|
+
function createDefaultTheme(presetName = "oceanBlue", mode = "light") {
|
|
10240
|
+
const presetForMode = getPresetWithMode(presetName, mode);
|
|
10241
|
+
return buildDefaultTheme(presetForMode.colors);
|
|
10242
|
+
}
|
|
10226
10243
|
class ThemeRegistry {
|
|
10227
10244
|
globalTheme = { ...defaultTheme };
|
|
10228
10245
|
customThemes = /* @__PURE__ */ new Map();
|
|
@@ -10303,8 +10320,8 @@ class ThemeRegistry {
|
|
|
10303
10320
|
* Set color tokens for the global theme
|
|
10304
10321
|
* @param colors - ColorTokens to use globally
|
|
10305
10322
|
*/
|
|
10306
|
-
setColorTokens(
|
|
10307
|
-
this.colorTokens =
|
|
10323
|
+
setColorTokens(colors) {
|
|
10324
|
+
this.colorTokens = colors;
|
|
10308
10325
|
}
|
|
10309
10326
|
/**
|
|
10310
10327
|
* Get current color tokens
|
|
@@ -10321,15 +10338,28 @@ class ThemeRegistry {
|
|
|
10321
10338
|
return this.colorMode;
|
|
10322
10339
|
}
|
|
10323
10340
|
/**
|
|
10324
|
-
* Set color mode and
|
|
10341
|
+
* Set color mode and trigger complete remount
|
|
10325
10342
|
* Updates color tokens if a preset is active
|
|
10343
|
+
* Triggers complete remount of all active mountJSX instances
|
|
10326
10344
|
* @param mode - Color mode to set
|
|
10327
10345
|
*/
|
|
10328
10346
|
setColorMode(mode) {
|
|
10329
10347
|
if (this.colorMode !== mode) {
|
|
10330
10348
|
this.colorMode = mode;
|
|
10331
|
-
if (this.currentPresetName
|
|
10332
|
-
|
|
10349
|
+
if (this.currentPresetName) {
|
|
10350
|
+
Promise.resolve().then(() => colorPresets).then(({ getPresetWithMode: getPresetWithMode2 }) => {
|
|
10351
|
+
const preset2 = getPresetWithMode2(
|
|
10352
|
+
this.currentPresetName,
|
|
10353
|
+
mode
|
|
10354
|
+
);
|
|
10355
|
+
this.colorTokens = preset2.colors;
|
|
10356
|
+
});
|
|
10357
|
+
}
|
|
10358
|
+
setTimeout(() => {
|
|
10359
|
+
Promise.resolve().then(() => vdom).then(({ remountAll: remountAll2 }) => {
|
|
10360
|
+
remountAll2();
|
|
10361
|
+
});
|
|
10362
|
+
}, 0);
|
|
10333
10363
|
}
|
|
10334
10364
|
}
|
|
10335
10365
|
/**
|
|
@@ -10342,11 +10372,14 @@ class ThemeRegistry {
|
|
|
10342
10372
|
/**
|
|
10343
10373
|
* Set current preset name
|
|
10344
10374
|
* @param name - Preset name
|
|
10375
|
+
* @param skipNotify - If true, skip notifying listeners (used during remount)
|
|
10345
10376
|
*/
|
|
10346
|
-
setCurrentPresetName(name) {
|
|
10377
|
+
setCurrentPresetName(name, skipNotify = false) {
|
|
10347
10378
|
if (this.currentPresetName !== name) {
|
|
10348
10379
|
this.currentPresetName = name;
|
|
10349
|
-
|
|
10380
|
+
if (!skipNotify) {
|
|
10381
|
+
this.notifyListeners();
|
|
10382
|
+
}
|
|
10350
10383
|
}
|
|
10351
10384
|
}
|
|
10352
10385
|
/**
|
|
@@ -11205,6 +11238,129 @@ class PortalRegistry {
|
|
|
11205
11238
|
}
|
|
11206
11239
|
}
|
|
11207
11240
|
const portalRegistry = new PortalRegistry();
|
|
11241
|
+
class MountRegistry {
|
|
11242
|
+
entries = /* @__PURE__ */ new Map();
|
|
11243
|
+
nextId = 1;
|
|
11244
|
+
/**
|
|
11245
|
+
* Register a new mountJSX instance
|
|
11246
|
+
* @param parent - Parent container or scene
|
|
11247
|
+
* @param type - Component type or node type
|
|
11248
|
+
* @param props - Mount props
|
|
11249
|
+
* @param rootNode - Root game object
|
|
11250
|
+
* @returns Registry ID for this mount
|
|
11251
|
+
*/
|
|
11252
|
+
register(parent, type, props, rootNode, vnode) {
|
|
11253
|
+
const id = this.nextId++;
|
|
11254
|
+
this.entries.set(id, { id, parent, type, props, rootNode, vnode });
|
|
11255
|
+
DebugLogger.log("vdom", `Registered mount ${id}`);
|
|
11256
|
+
return id;
|
|
11257
|
+
}
|
|
11258
|
+
/**
|
|
11259
|
+
* Unregister a mountJSX instance
|
|
11260
|
+
* @param id - Registry ID
|
|
11261
|
+
*/
|
|
11262
|
+
unregister(id) {
|
|
11263
|
+
const entry = this.entries.get(id);
|
|
11264
|
+
if (entry) {
|
|
11265
|
+
DebugLogger.log("vdom", `Unregistered mount ${id}`);
|
|
11266
|
+
this.entries.delete(id);
|
|
11267
|
+
}
|
|
11268
|
+
}
|
|
11269
|
+
/**
|
|
11270
|
+
* Get a specific mount entry by registry ID
|
|
11271
|
+
* @param id - Registry ID
|
|
11272
|
+
* @returns Mount entry or undefined if not found
|
|
11273
|
+
*/
|
|
11274
|
+
getEntry(id) {
|
|
11275
|
+
return this.entries.get(id);
|
|
11276
|
+
}
|
|
11277
|
+
/**
|
|
11278
|
+
* Get all active mount entries
|
|
11279
|
+
* @returns Array of mount entries
|
|
11280
|
+
*/
|
|
11281
|
+
getAllEntries() {
|
|
11282
|
+
return Array.from(this.entries.values());
|
|
11283
|
+
}
|
|
11284
|
+
/**
|
|
11285
|
+
* Clear all entries (for testing)
|
|
11286
|
+
*/
|
|
11287
|
+
clear() {
|
|
11288
|
+
this.entries.clear();
|
|
11289
|
+
this.nextId = 1;
|
|
11290
|
+
}
|
|
11291
|
+
}
|
|
11292
|
+
const mountRegistry = new MountRegistry();
|
|
11293
|
+
function remountAll() {
|
|
11294
|
+
const entries = mountRegistry.getAllEntries();
|
|
11295
|
+
if (entries.length === 0) {
|
|
11296
|
+
DebugLogger.log("vdom", "No mounts to remount");
|
|
11297
|
+
return;
|
|
11298
|
+
}
|
|
11299
|
+
console.log(`[REMOUNT] Starting remount of ${entries.length} root(s)`);
|
|
11300
|
+
entries.forEach((entry) => {
|
|
11301
|
+
try {
|
|
11302
|
+
const scene = entry.parent instanceof Phaser$1.Scene ? entry.parent : entry.parent.scene;
|
|
11303
|
+
if (!scene || !scene.sys) {
|
|
11304
|
+
console.warn("[REMOUNT] Scene is invalid, skipping remount");
|
|
11305
|
+
return;
|
|
11306
|
+
}
|
|
11307
|
+
const currentVNode = scene.__rootVNode;
|
|
11308
|
+
if (entry.rootNode instanceof Phaser$1.GameObjects.Container) {
|
|
11309
|
+
const children = entry.rootNode.getAll();
|
|
11310
|
+
children.forEach((child) => {
|
|
11311
|
+
;
|
|
11312
|
+
entry.rootNode.remove(child, true);
|
|
11313
|
+
});
|
|
11314
|
+
}
|
|
11315
|
+
if (currentVNode) {
|
|
11316
|
+
const flatChildren = flattenChildren(currentVNode.children);
|
|
11317
|
+
flatChildren.forEach(unmount);
|
|
11318
|
+
if (currentVNode.__ctx) {
|
|
11319
|
+
disposeCtx(currentVNode.__ctx);
|
|
11320
|
+
delete currentVNode.__ctx;
|
|
11321
|
+
}
|
|
11322
|
+
}
|
|
11323
|
+
const { width, height, disableAutoSize = false, ...componentProps } = entry.props;
|
|
11324
|
+
const renderContext = getRenderContext(entry.parent);
|
|
11325
|
+
renderContext.setViewport(width, height, scene);
|
|
11326
|
+
portalRegistry.setViewportSize(scene, width, height);
|
|
11327
|
+
let vnode;
|
|
11328
|
+
if (disableAutoSize) {
|
|
11329
|
+
vnode = { type: entry.type, props: { ...componentProps, width, height }, children: [] };
|
|
11330
|
+
} else {
|
|
11331
|
+
const componentVNode = {
|
|
11332
|
+
type: entry.type,
|
|
11333
|
+
props: componentProps,
|
|
11334
|
+
children: []
|
|
11335
|
+
};
|
|
11336
|
+
vnode = {
|
|
11337
|
+
type: SceneWrapper,
|
|
11338
|
+
props: {
|
|
11339
|
+
width,
|
|
11340
|
+
height,
|
|
11341
|
+
children: componentVNode
|
|
11342
|
+
},
|
|
11343
|
+
children: []
|
|
11344
|
+
};
|
|
11345
|
+
}
|
|
11346
|
+
;
|
|
11347
|
+
scene.__rootVNode = vnode;
|
|
11348
|
+
const rootNode = mount(entry.parent, vnode);
|
|
11349
|
+
if (rootNode instanceof Phaser$1.GameObjects.Container) {
|
|
11350
|
+
;
|
|
11351
|
+
rootNode.__mountRootId = generateMountRootId();
|
|
11352
|
+
}
|
|
11353
|
+
entry.rootNode = rootNode;
|
|
11354
|
+
entry.vnode = vnode;
|
|
11355
|
+
rootNode.__registryId = entry.id;
|
|
11356
|
+
rootNode.__rootVNode = vnode;
|
|
11357
|
+
console.log("[REMOUNT] Successfully remounted entry", entry.id);
|
|
11358
|
+
} catch (error) {
|
|
11359
|
+
console.error("[REMOUNT] Failed to remount entry", entry.id, error);
|
|
11360
|
+
}
|
|
11361
|
+
});
|
|
11362
|
+
console.log("[REMOUNT] Remount complete");
|
|
11363
|
+
}
|
|
11208
11364
|
function flattenChildren(children) {
|
|
11209
11365
|
if (!children) return [];
|
|
11210
11366
|
return children.flat(Infinity);
|
|
@@ -11597,6 +11753,11 @@ function unmount(vnode) {
|
|
|
11597
11753
|
attachRef(ref, null);
|
|
11598
11754
|
const flatChildren = flattenChildren(vnode.children);
|
|
11599
11755
|
flatChildren.forEach(unmount);
|
|
11756
|
+
const node = vnode.__node;
|
|
11757
|
+
if (node?.__registryId !== void 0) {
|
|
11758
|
+
mountRegistry.unregister(node.__registryId);
|
|
11759
|
+
delete node.__registryId;
|
|
11760
|
+
}
|
|
11600
11761
|
const parent = vnode.__parent;
|
|
11601
11762
|
if (parent) host.remove(parent, vnode.__node);
|
|
11602
11763
|
}
|
|
@@ -11872,8 +12033,47 @@ function mountJSX(parentOrScene, type, props = { width: 0, height: 0 }) {
|
|
|
11872
12033
|
if (rootNode instanceof Phaser$1.GameObjects.Container) {
|
|
11873
12034
|
rootNode.__mountRootId = generateMountRootId();
|
|
11874
12035
|
}
|
|
11875
|
-
|
|
12036
|
+
rootNode.__rootVNode = vnode;
|
|
12037
|
+
const registryId = mountRegistry.register(parentOrScene, type, props, rootNode, vnode);
|
|
12038
|
+
rootNode.__registryId = registryId;
|
|
12039
|
+
const handle = rootNode;
|
|
12040
|
+
handle.unmount = () => unmountJSX(handle);
|
|
12041
|
+
return handle;
|
|
11876
12042
|
}
|
|
12043
|
+
function unmountJSX(target) {
|
|
12044
|
+
const scene = target instanceof Phaser$1.Scene ? target : target.scene;
|
|
12045
|
+
const targetWithVNode = target;
|
|
12046
|
+
const sceneWithVNode = scene;
|
|
12047
|
+
const rootVNode = targetWithVNode.__rootVNode ?? sceneWithVNode?.__rootVNode;
|
|
12048
|
+
if (rootVNode) {
|
|
12049
|
+
unmount(rootVNode);
|
|
12050
|
+
if (targetWithVNode.__rootVNode === rootVNode) {
|
|
12051
|
+
delete targetWithVNode.__rootVNode;
|
|
12052
|
+
}
|
|
12053
|
+
if (sceneWithVNode?.__rootVNode === rootVNode) {
|
|
12054
|
+
delete sceneWithVNode.__rootVNode;
|
|
12055
|
+
}
|
|
12056
|
+
return;
|
|
12057
|
+
}
|
|
12058
|
+
if (targetWithVNode.__registryId !== void 0) {
|
|
12059
|
+
const entry = mountRegistry.getEntry(targetWithVNode.__registryId);
|
|
12060
|
+
if (entry?.vnode) {
|
|
12061
|
+
unmount(entry.vnode);
|
|
12062
|
+
return;
|
|
12063
|
+
}
|
|
12064
|
+
}
|
|
12065
|
+
DebugLogger.log("vdom", "unmountJSX called but no root VNode found on target");
|
|
12066
|
+
}
|
|
12067
|
+
const vdom = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
12068
|
+
__proto__: null,
|
|
12069
|
+
createElement,
|
|
12070
|
+
mount,
|
|
12071
|
+
mountJSX,
|
|
12072
|
+
patchVNode,
|
|
12073
|
+
remountAll,
|
|
12074
|
+
unmount,
|
|
12075
|
+
unmountJSX
|
|
12076
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
11877
12077
|
function getCurrent() {
|
|
11878
12078
|
return _currentCtx;
|
|
11879
12079
|
}
|
|
@@ -13835,6 +14035,8 @@ function Portal(props) {
|
|
|
13835
14035
|
const depth = props.depth ?? 1e3;
|
|
13836
14036
|
const scene = useScene();
|
|
13837
14037
|
const blockEvents = props.blockEvents ?? true;
|
|
14038
|
+
const mountedNodesRef = useRef([]);
|
|
14039
|
+
const previousChildrenRef = useRef([]);
|
|
13838
14040
|
useEffect(() => {
|
|
13839
14041
|
const portalContainer = portalRegistry.register(
|
|
13840
14042
|
portalId,
|
|
@@ -13850,14 +14052,18 @@ function Portal(props) {
|
|
|
13850
14052
|
blockerContainer.setDepth(-1);
|
|
13851
14053
|
}
|
|
13852
14054
|
const children = Array.isArray(props.children) ? props.children : [props.children];
|
|
14055
|
+
const mountedNodes = [];
|
|
13853
14056
|
for (const child of children) {
|
|
13854
14057
|
if (child) {
|
|
13855
14058
|
const mountedNode = mount(portalContainer, child);
|
|
13856
14059
|
if (mountedNode) {
|
|
13857
14060
|
portalContainer.add(mountedNode);
|
|
14061
|
+
mountedNodes.push(mountedNode);
|
|
13858
14062
|
}
|
|
13859
14063
|
}
|
|
13860
14064
|
}
|
|
14065
|
+
mountedNodesRef.current = mountedNodes;
|
|
14066
|
+
previousChildrenRef.current = children;
|
|
13861
14067
|
const gestureManager = getGestureManager(scene);
|
|
13862
14068
|
if (blockEvents && blockerContainer) {
|
|
13863
14069
|
const blocker = blockerContainer;
|
|
@@ -13904,7 +14110,31 @@ function Portal(props) {
|
|
|
13904
14110
|
}
|
|
13905
14111
|
portalRegistry.unregister(portalId);
|
|
13906
14112
|
};
|
|
13907
|
-
}, [portalId, depth, scene,
|
|
14113
|
+
}, [portalId, depth, scene, blockEvents]);
|
|
14114
|
+
useEffect(() => {
|
|
14115
|
+
const portal = portalRegistry.get(portalId);
|
|
14116
|
+
if (!portal) return;
|
|
14117
|
+
const portalContainer = portal.container;
|
|
14118
|
+
const newChildren = Array.isArray(props.children) ? props.children : [props.children];
|
|
14119
|
+
const oldChildren = previousChildrenRef.current;
|
|
14120
|
+
const maxLen = Math.max(oldChildren.length, newChildren.length);
|
|
14121
|
+
for (let i = 0; i < maxLen; i++) {
|
|
14122
|
+
const oldChild = oldChildren[i];
|
|
14123
|
+
const newChild = newChildren[i];
|
|
14124
|
+
if (oldChild && newChild) {
|
|
14125
|
+
patchVNode(portalContainer, oldChild, newChild);
|
|
14126
|
+
} else if (!oldChild && newChild) {
|
|
14127
|
+
const mountedNode = mount(portalContainer, newChild);
|
|
14128
|
+
if (mountedNode) {
|
|
14129
|
+
portalContainer.add(mountedNode);
|
|
14130
|
+
mountedNodesRef.current.push(mountedNode);
|
|
14131
|
+
}
|
|
14132
|
+
} else if (oldChild && !newChild) {
|
|
14133
|
+
unmount(oldChild);
|
|
14134
|
+
}
|
|
14135
|
+
}
|
|
14136
|
+
previousChildrenRef.current = newChildren;
|
|
14137
|
+
}, [props.children, portalId]);
|
|
13908
14138
|
return null;
|
|
13909
14139
|
}
|
|
13910
14140
|
function Modal(props) {
|
|
@@ -13991,19 +14221,7 @@ function Modal(props) {
|
|
|
13991
14221
|
view.setVisible(false);
|
|
13992
14222
|
backdrop.setVisible(false);
|
|
13993
14223
|
}
|
|
13994
|
-
}, [
|
|
13995
|
-
backdropAnimation,
|
|
13996
|
-
closeDurationMs,
|
|
13997
|
-
isVisible,
|
|
13998
|
-
openDurationMs,
|
|
13999
|
-
props.onClosed,
|
|
14000
|
-
props.onOpen,
|
|
14001
|
-
props.onRequestClose,
|
|
14002
|
-
props.show,
|
|
14003
|
-
stopBackdropEffects,
|
|
14004
|
-
stopViewEffects,
|
|
14005
|
-
viewAnimation
|
|
14006
|
-
]);
|
|
14224
|
+
}, [props.show]);
|
|
14007
14225
|
useEffect(() => {
|
|
14008
14226
|
if (!closeOnEscape || !props.show) return;
|
|
14009
14227
|
const handleKeyDown = (e) => {
|
|
@@ -15309,11 +15527,22 @@ function calculateSliderSize(size) {
|
|
|
15309
15527
|
return { border, outer, dimension };
|
|
15310
15528
|
}
|
|
15311
15529
|
function ScrollSlider(props) {
|
|
15312
|
-
const {
|
|
15530
|
+
const {
|
|
15531
|
+
direction,
|
|
15532
|
+
scrollPosition,
|
|
15533
|
+
viewportSize,
|
|
15534
|
+
contentSize,
|
|
15535
|
+
onScroll,
|
|
15536
|
+
momentum = true,
|
|
15537
|
+
onMomentumEnd
|
|
15538
|
+
} = props;
|
|
15313
15539
|
const { props: themed } = getThemedProps("ScrollSlider", void 0, {});
|
|
15314
15540
|
const sliderRef = useRef(null);
|
|
15315
15541
|
const isDraggingRef = useRef(false);
|
|
15316
15542
|
const trackContainerRef = useRef(null);
|
|
15543
|
+
const velocityRef = useRef(0);
|
|
15544
|
+
const lastTimeRef = useRef(0);
|
|
15545
|
+
const tweenRef = useRef(null);
|
|
15317
15546
|
const isVertical = direction === "vertical";
|
|
15318
15547
|
const { border, outer, dimension } = calculateSliderSize(props.size);
|
|
15319
15548
|
const containerWithLayout = trackContainerRef.current;
|
|
@@ -15329,18 +15558,60 @@ function ScrollSlider(props) {
|
|
|
15329
15558
|
data.stopPropagation();
|
|
15330
15559
|
if (data.state === "start") {
|
|
15331
15560
|
isDraggingRef.current = true;
|
|
15561
|
+
velocityRef.current = 0;
|
|
15562
|
+
lastTimeRef.current = Date.now();
|
|
15563
|
+
if (tweenRef.current) {
|
|
15564
|
+
tweenRef.current.stop();
|
|
15565
|
+
tweenRef.current = null;
|
|
15566
|
+
}
|
|
15332
15567
|
return;
|
|
15333
15568
|
}
|
|
15334
15569
|
if (data.state === "end") {
|
|
15335
15570
|
isDraggingRef.current = false;
|
|
15571
|
+
if (momentum && Math.abs(velocityRef.current) > 0.1) {
|
|
15572
|
+
startMomentum(scrollPosition);
|
|
15573
|
+
} else if (onMomentumEnd) {
|
|
15574
|
+
onMomentumEnd();
|
|
15575
|
+
}
|
|
15336
15576
|
return;
|
|
15337
15577
|
}
|
|
15338
15578
|
if (!isDraggingRef.current) return;
|
|
15339
15579
|
const delta = isVertical ? data.dy ?? 0 : data.dx ?? 0;
|
|
15580
|
+
const now = Date.now();
|
|
15581
|
+
const deltaTime = now - lastTimeRef.current;
|
|
15582
|
+
if (deltaTime > 0) {
|
|
15583
|
+
velocityRef.current = delta / deltaTime * 1e3;
|
|
15584
|
+
lastTimeRef.current = now;
|
|
15585
|
+
}
|
|
15340
15586
|
const newThumbPos = Math.max(0, Math.min(thumbRange, thumbPosition + delta));
|
|
15341
15587
|
const newScrollPos = thumbRange > 0 ? newThumbPos / thumbRange * maxScroll : 0;
|
|
15342
15588
|
onScroll(newScrollPos);
|
|
15343
15589
|
};
|
|
15590
|
+
const startMomentum = (startPos) => {
|
|
15591
|
+
if (!sliderRef.current?.scene) return;
|
|
15592
|
+
const scene = sliderRef.current.scene;
|
|
15593
|
+
const duration = Math.min(1e3, Math.max(200, Math.abs(velocityRef.current)));
|
|
15594
|
+
const targetScrollPos = Math.max(
|
|
15595
|
+
0,
|
|
15596
|
+
Math.min(maxScroll, startPos + velocityRef.current * (duration / 1e3))
|
|
15597
|
+
);
|
|
15598
|
+
tweenRef.current = scene.tweens.add({
|
|
15599
|
+
targets: { pos: startPos },
|
|
15600
|
+
pos: targetScrollPos,
|
|
15601
|
+
duration,
|
|
15602
|
+
ease: "Quad.easeOut",
|
|
15603
|
+
onUpdate: (tween) => {
|
|
15604
|
+
const target = tween.targets[0];
|
|
15605
|
+
onScroll(target.pos);
|
|
15606
|
+
},
|
|
15607
|
+
onComplete: () => {
|
|
15608
|
+
tweenRef.current = null;
|
|
15609
|
+
if (onMomentumEnd) {
|
|
15610
|
+
onMomentumEnd();
|
|
15611
|
+
}
|
|
15612
|
+
}
|
|
15613
|
+
});
|
|
15614
|
+
};
|
|
15344
15615
|
const handleBackgroundTouch = (data) => {
|
|
15345
15616
|
data.stopPropagation();
|
|
15346
15617
|
const localPos = isVertical ? data.localY ?? 0 : data.localX ?? 0;
|
|
@@ -15406,13 +15677,23 @@ function ScrollView(props) {
|
|
|
15406
15677
|
showVerticalSlider = "auto",
|
|
15407
15678
|
showHorizontalSlider = "auto",
|
|
15408
15679
|
scroll: initialScroll,
|
|
15409
|
-
onScrollInfoChange
|
|
15680
|
+
onScrollInfoChange,
|
|
15681
|
+
snap = false,
|
|
15682
|
+
snapAlignment = "start",
|
|
15683
|
+
snapThreshold = 20,
|
|
15684
|
+
momentum = true
|
|
15410
15685
|
} = props;
|
|
15411
15686
|
const [scroll, setScroll] = useState(initialScroll ?? { dx: 0, dy: 0 });
|
|
15687
|
+
const scrollRef = useRef(scroll);
|
|
15412
15688
|
const contentRef = useRef(null);
|
|
15413
15689
|
const viewportRef = useRef(null);
|
|
15414
15690
|
const [contentHeight, setContentHeight] = useState(0);
|
|
15415
15691
|
const [contentWidth, setContentWidth] = useState(0);
|
|
15692
|
+
const [velocity, setVelocity] = useState({ vx: 0, vy: 0 });
|
|
15693
|
+
const [lastTime, setLastTime] = useState(0);
|
|
15694
|
+
const tweenRef = useRef(null);
|
|
15695
|
+
const wheelSnapTimeoutRef = useRef(null);
|
|
15696
|
+
const WHEEL_SNAP_DELAY = 200;
|
|
15416
15697
|
const { outer: sliderSize } = calculateSliderSize(props.sliderSize);
|
|
15417
15698
|
const viewportHeight = viewportRef.current?.height ?? 0;
|
|
15418
15699
|
const viewportWidth = viewportRef.current?.width ?? 0;
|
|
@@ -15425,9 +15706,24 @@ function ScrollView(props) {
|
|
|
15425
15706
|
const showHorizontalSliderActual = showHorizontalSlider === true || needsHorizontalScroll && showHorizontalSlider === "auto";
|
|
15426
15707
|
const maxScrollY = Math.max(0, effectiveContentHeight - viewportHeight);
|
|
15427
15708
|
const maxScrollX = Math.max(0, effectiveContentWidth - viewportWidth);
|
|
15709
|
+
const updateScroll = (value) => {
|
|
15710
|
+
setScroll((prev) => {
|
|
15711
|
+
const next = typeof value === "function" ? value(prev) : value;
|
|
15712
|
+
scrollRef.current = next;
|
|
15713
|
+
return next;
|
|
15714
|
+
});
|
|
15715
|
+
};
|
|
15716
|
+
const stopActiveTween = () => {
|
|
15717
|
+
if (tweenRef.current) {
|
|
15718
|
+
tweenRef.current.stop();
|
|
15719
|
+
tweenRef.current = null;
|
|
15720
|
+
}
|
|
15721
|
+
};
|
|
15722
|
+
const resolvedSnapThreshold = typeof snap === "object" && "positions" in snap ? snap.threshold ?? snapThreshold : snapThreshold;
|
|
15723
|
+
const effectiveSnapThreshold = resolvedSnapThreshold === void 0 || resolvedSnapThreshold < 0 ? Infinity : resolvedSnapThreshold;
|
|
15428
15724
|
useEffect(() => {
|
|
15429
15725
|
if (initialScroll) {
|
|
15430
|
-
|
|
15726
|
+
updateScroll(initialScroll);
|
|
15431
15727
|
}
|
|
15432
15728
|
}, [initialScroll]);
|
|
15433
15729
|
useEffect(() => {
|
|
@@ -15482,27 +15778,168 @@ function ScrollView(props) {
|
|
|
15482
15778
|
const maxScrollX2 = Math.max(0, contentWidth2 - viewportWidth2);
|
|
15483
15779
|
const newScrollY = Math.max(0, Math.min(maxScrollY2, scroll.dy - deltaY));
|
|
15484
15780
|
const newScrollX = Math.max(0, Math.min(maxScrollX2, scroll.dx - deltaX));
|
|
15485
|
-
|
|
15781
|
+
updateScroll({ dx: newScrollX, dy: newScrollY });
|
|
15782
|
+
};
|
|
15783
|
+
const startMomentum = () => {
|
|
15784
|
+
if (!contentRef.current?.scene) return;
|
|
15785
|
+
const scene = contentRef.current.scene;
|
|
15786
|
+
const duration = Math.min(1e3, Math.max(200, Math.abs(velocity.vx) + Math.abs(velocity.vy)));
|
|
15787
|
+
const currentScroll = scrollRef.current;
|
|
15788
|
+
const baseTargetDx = Math.max(
|
|
15789
|
+
0,
|
|
15790
|
+
Math.min(maxScrollX, currentScroll.dx - velocity.vx * (duration / 1e3))
|
|
15791
|
+
);
|
|
15792
|
+
const baseTargetDy = Math.max(
|
|
15793
|
+
0,
|
|
15794
|
+
Math.min(maxScrollY, currentScroll.dy - velocity.vy * (duration / 1e3))
|
|
15795
|
+
);
|
|
15796
|
+
const snappedTarget = snap ? calculateSnapDestination(baseTargetDx, baseTargetDy) : null;
|
|
15797
|
+
stopActiveTween();
|
|
15798
|
+
tweenRef.current = scene.tweens.add({
|
|
15799
|
+
targets: { dx: currentScroll.dx, dy: currentScroll.dy },
|
|
15800
|
+
dx: snappedTarget?.dx ?? baseTargetDx,
|
|
15801
|
+
dy: snappedTarget?.dy ?? baseTargetDy,
|
|
15802
|
+
duration,
|
|
15803
|
+
ease: "Quad.easeOut",
|
|
15804
|
+
onUpdate: (tween) => {
|
|
15805
|
+
const target = tween.targets[0];
|
|
15806
|
+
updateScroll({ dx: target.dx, dy: target.dy });
|
|
15807
|
+
},
|
|
15808
|
+
onComplete: () => {
|
|
15809
|
+
tweenRef.current = null;
|
|
15810
|
+
}
|
|
15811
|
+
});
|
|
15812
|
+
};
|
|
15813
|
+
const getSnapTargets = () => {
|
|
15814
|
+
const viewportHeightCurrent = viewportRef.current?.height ?? viewportHeight;
|
|
15815
|
+
const viewportWidthCurrent = viewportRef.current?.width ?? viewportWidth;
|
|
15816
|
+
if (typeof snap === "object" && "positions" in snap) {
|
|
15817
|
+
const sorted = [...snap.positions].sort((a, b) => a - b);
|
|
15818
|
+
const inferredSizeY = sorted.length > 1 ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0)) : viewportHeightCurrent || 0;
|
|
15819
|
+
const inferredSizeX = sorted.length > 1 ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0)) : viewportWidthCurrent || 0;
|
|
15820
|
+
const targetsX = sorted.map((position, index) => {
|
|
15821
|
+
const next = sorted[index + 1];
|
|
15822
|
+
const size = next !== void 0 ? Math.max(0, next - position) : inferredSizeX > 0 ? inferredSizeX : viewportWidthCurrent || 0;
|
|
15823
|
+
return { position, size };
|
|
15824
|
+
});
|
|
15825
|
+
const targetsY = sorted.map((position, index) => {
|
|
15826
|
+
const next = sorted[index + 1];
|
|
15827
|
+
const size = next !== void 0 ? Math.max(0, next - position) : inferredSizeY > 0 ? inferredSizeY : viewportHeightCurrent || 0;
|
|
15828
|
+
return { position, size };
|
|
15829
|
+
});
|
|
15830
|
+
return { x: targetsX, y: targetsY };
|
|
15831
|
+
}
|
|
15832
|
+
return { x: [], y: [] };
|
|
15833
|
+
};
|
|
15834
|
+
const findNearestSnap = (current, targets, viewportSize, maxScroll) => {
|
|
15835
|
+
if (targets.length === 0) return current;
|
|
15836
|
+
let nearest = current;
|
|
15837
|
+
let minDistance = Infinity;
|
|
15838
|
+
for (const { position, size } of targets) {
|
|
15839
|
+
let adjustedPos = position;
|
|
15840
|
+
if (snapAlignment === "center") {
|
|
15841
|
+
adjustedPos = position + size / 2 - viewportSize / 2;
|
|
15842
|
+
} else if (snapAlignment === "end") {
|
|
15843
|
+
adjustedPos = position + size - viewportSize;
|
|
15844
|
+
}
|
|
15845
|
+
adjustedPos = Math.max(0, Math.min(maxScroll, adjustedPos));
|
|
15846
|
+
const distance = Math.abs(current - adjustedPos);
|
|
15847
|
+
if (distance < minDistance && distance <= effectiveSnapThreshold) {
|
|
15848
|
+
minDistance = distance;
|
|
15849
|
+
nearest = adjustedPos;
|
|
15850
|
+
} else if (distance < minDistance && effectiveSnapThreshold === Infinity) {
|
|
15851
|
+
minDistance = distance;
|
|
15852
|
+
nearest = adjustedPos;
|
|
15853
|
+
}
|
|
15854
|
+
}
|
|
15855
|
+
return nearest;
|
|
15856
|
+
};
|
|
15857
|
+
const calculateSnapDestination = (baseDx, baseDy) => {
|
|
15858
|
+
const { x: xTargets, y: yTargets } = getSnapTargets();
|
|
15859
|
+
const viewportHeightLocal = viewportRef.current?.height ?? 0;
|
|
15860
|
+
const viewportWidthLocal = viewportRef.current?.width ?? 0;
|
|
15861
|
+
const targetDx = findNearestSnap(baseDx, xTargets, viewportWidthLocal, maxScrollX);
|
|
15862
|
+
const targetDy = findNearestSnap(baseDy, yTargets, viewportHeightLocal, maxScrollY);
|
|
15863
|
+
return { dx: targetDx, dy: targetDy };
|
|
15864
|
+
};
|
|
15865
|
+
const applySnap = () => {
|
|
15866
|
+
if (!contentRef.current?.scene || !snap) return;
|
|
15867
|
+
const currentScroll = scrollRef.current;
|
|
15868
|
+
const { dx: targetDx, dy: targetDy } = calculateSnapDestination(
|
|
15869
|
+
currentScroll.dx,
|
|
15870
|
+
currentScroll.dy
|
|
15871
|
+
);
|
|
15872
|
+
if (targetDx === currentScroll.dx && targetDy === currentScroll.dy) return;
|
|
15873
|
+
const scene = contentRef.current.scene;
|
|
15874
|
+
stopActiveTween();
|
|
15875
|
+
tweenRef.current = scene.tweens.add({
|
|
15876
|
+
targets: { dx: currentScroll.dx, dy: currentScroll.dy },
|
|
15877
|
+
dx: targetDx,
|
|
15878
|
+
dy: targetDy,
|
|
15879
|
+
duration: 250,
|
|
15880
|
+
ease: "Quad.easeOut",
|
|
15881
|
+
onUpdate: (tween) => {
|
|
15882
|
+
const target = tween.targets[0];
|
|
15883
|
+
updateScroll({ dx: target.dx, dy: target.dy });
|
|
15884
|
+
},
|
|
15885
|
+
onComplete: () => {
|
|
15886
|
+
tweenRef.current = null;
|
|
15887
|
+
}
|
|
15888
|
+
});
|
|
15486
15889
|
};
|
|
15487
15890
|
const handleVerticalScroll = (scrollPos) => {
|
|
15488
15891
|
const clampedScrollPos = Math.max(0, Math.min(maxScrollY, scrollPos));
|
|
15489
|
-
|
|
15892
|
+
updateScroll((prev) => ({ ...prev, dy: clampedScrollPos }));
|
|
15490
15893
|
};
|
|
15491
15894
|
const handleHorizontalScroll = (scrollPos) => {
|
|
15492
15895
|
const clampedScrollPos = Math.max(0, Math.min(maxScrollX, scrollPos));
|
|
15493
|
-
|
|
15896
|
+
updateScroll((prev) => ({ ...prev, dx: clampedScrollPos }));
|
|
15897
|
+
};
|
|
15898
|
+
const handleSliderMomentumEnd = () => {
|
|
15899
|
+
if (snap) {
|
|
15900
|
+
applySnap();
|
|
15901
|
+
}
|
|
15494
15902
|
};
|
|
15495
15903
|
const handleTouchMove = (data) => {
|
|
15496
|
-
if (data.state === "end")
|
|
15904
|
+
if (data.state === "end") {
|
|
15905
|
+
if (momentum && (Math.abs(velocity.vx) > 0.1 || Math.abs(velocity.vy) > 0.1)) {
|
|
15906
|
+
startMomentum();
|
|
15907
|
+
} else if (snap) {
|
|
15908
|
+
applySnap();
|
|
15909
|
+
}
|
|
15910
|
+
return;
|
|
15911
|
+
}
|
|
15912
|
+
if (data.state === "start") {
|
|
15913
|
+
stopActiveTween();
|
|
15914
|
+
setVelocity({ vx: 0, vy: 0 });
|
|
15915
|
+
setLastTime(Date.now());
|
|
15916
|
+
data.stopPropagation();
|
|
15917
|
+
return;
|
|
15918
|
+
}
|
|
15497
15919
|
data.stopPropagation();
|
|
15498
15920
|
const deltaX = data.dx ?? 0;
|
|
15499
15921
|
const deltaY = data.dy ?? 0;
|
|
15922
|
+
const now = Date.now();
|
|
15923
|
+
const deltaTime = now - lastTime;
|
|
15924
|
+
if (deltaTime > 0) {
|
|
15925
|
+
const newVx = deltaX / deltaTime * 1e3;
|
|
15926
|
+
const newVy = deltaY / deltaTime * 1e3;
|
|
15927
|
+
setVelocity({ vx: newVx, vy: newVy });
|
|
15928
|
+
setLastTime(now);
|
|
15929
|
+
}
|
|
15500
15930
|
calc(deltaX, deltaY);
|
|
15501
15931
|
};
|
|
15502
15932
|
const handleWheel = (data) => {
|
|
15503
15933
|
data.stopPropagation();
|
|
15504
15934
|
data.preventDefault();
|
|
15935
|
+
stopActiveTween();
|
|
15505
15936
|
calc(-data.deltaX, -data.deltaY);
|
|
15937
|
+
if (snap) {
|
|
15938
|
+
if (wheelSnapTimeoutRef.current) {
|
|
15939
|
+
clearTimeout(wheelSnapTimeoutRef.current);
|
|
15940
|
+
}
|
|
15941
|
+
wheelSnapTimeoutRef.current = setTimeout(() => applySnap(), WHEEL_SNAP_DELAY);
|
|
15942
|
+
}
|
|
15506
15943
|
};
|
|
15507
15944
|
const redraw = useRedraw();
|
|
15508
15945
|
const [visible, setVisible] = useState(false);
|
|
@@ -15512,6 +15949,10 @@ function ScrollView(props) {
|
|
|
15512
15949
|
return () => {
|
|
15513
15950
|
clearTimeout(timer1);
|
|
15514
15951
|
clearTimeout(timer2);
|
|
15952
|
+
if (wheelSnapTimeoutRef.current) {
|
|
15953
|
+
clearTimeout(wheelSnapTimeoutRef.current);
|
|
15954
|
+
}
|
|
15955
|
+
stopActiveTween();
|
|
15515
15956
|
};
|
|
15516
15957
|
}, [showVerticalSliderActual, showHorizontalSliderActual]);
|
|
15517
15958
|
return /* @__PURE__ */ jsxRuntime.jsx(View, { visible, children: /* @__PURE__ */ jsxRuntime.jsxs(View, { direction: "row", width: "100%", height: "100%", gap: 0, padding: 0, children: [
|
|
@@ -15568,7 +16009,9 @@ function ScrollView(props) {
|
|
|
15568
16009
|
scrollPosition: scroll.dx,
|
|
15569
16010
|
viewportSize: viewportWidth,
|
|
15570
16011
|
contentSize: contentWidth,
|
|
15571
|
-
onScroll: handleHorizontalScroll
|
|
16012
|
+
onScroll: handleHorizontalScroll,
|
|
16013
|
+
momentum,
|
|
16014
|
+
onMomentumEnd: handleSliderMomentumEnd
|
|
15572
16015
|
}
|
|
15573
16016
|
) })
|
|
15574
16017
|
] }),
|
|
@@ -15581,7 +16024,9 @@ function ScrollView(props) {
|
|
|
15581
16024
|
scrollPosition: scroll.dy,
|
|
15582
16025
|
viewportSize: viewportHeight,
|
|
15583
16026
|
contentSize: effectiveContentHeight,
|
|
15584
|
-
onScroll: handleVerticalScroll
|
|
16027
|
+
onScroll: handleVerticalScroll,
|
|
16028
|
+
momentum,
|
|
16029
|
+
onMomentumEnd: handleSliderMomentumEnd
|
|
15585
16030
|
}
|
|
15586
16031
|
) }),
|
|
15587
16032
|
showHorizontalSliderActual && // Placeholder corner for potential icon - matches slider dimensions
|
|
@@ -16203,23 +16648,34 @@ function Sidebar(props) {
|
|
|
16203
16648
|
const primaryContent = sectionsContent ?? (!hasSections ? props.children : null) ?? null;
|
|
16204
16649
|
const extraContent = hasSections ? props.children ?? null : null;
|
|
16205
16650
|
const contentNodes = [...normalizeChildren(primaryContent), ...normalizeChildren(extraContent)];
|
|
16206
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16651
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16652
|
+
View,
|
|
16653
|
+
{
|
|
16654
|
+
...combinedProps,
|
|
16655
|
+
theme: nestedTheme,
|
|
16656
|
+
backgroundColor: themed.backgroundColor,
|
|
16657
|
+
backgroundAlpha: themed.backgroundAlpha,
|
|
16658
|
+
padding: themed.padding,
|
|
16659
|
+
gap: themed.gap,
|
|
16660
|
+
children: [
|
|
16661
|
+
props.header ? /* @__PURE__ */ jsxRuntime.jsx(View, { ...headerStyle, children: props.header }) : null,
|
|
16662
|
+
scrollable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16663
|
+
ScrollView,
|
|
16664
|
+
{
|
|
16665
|
+
flex: 1,
|
|
16666
|
+
width: "fill",
|
|
16667
|
+
height: "fill",
|
|
16668
|
+
showVerticalSlider: "auto",
|
|
16669
|
+
showHorizontalSlider: false,
|
|
16670
|
+
sliderSize: "tiny",
|
|
16671
|
+
theme: nestedTheme,
|
|
16672
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(View, { direction: "column", gap: effectiveGap, width: "fill", children: contentNodes })
|
|
16673
|
+
}
|
|
16674
|
+
) : contentNodes,
|
|
16675
|
+
props.footer ? /* @__PURE__ */ jsxRuntime.jsx(View, { ...footerStyle, children: props.footer }) : null
|
|
16676
|
+
]
|
|
16677
|
+
}
|
|
16678
|
+
);
|
|
16223
16679
|
}
|
|
16224
16680
|
function DefaultThumb(props) {
|
|
16225
16681
|
const { size, color, borderColor, borderWidth = 0, isDragging, dragScale = 1.1 } = props;
|
|
@@ -16937,6 +17393,7 @@ exports.applyLightMode = applyLightMode;
|
|
|
16937
17393
|
exports.calculateSliderSize = calculateSliderSize;
|
|
16938
17394
|
exports.createBounceEffect = createBounceEffect;
|
|
16939
17395
|
exports.createBreatheEffect = createBreatheEffect;
|
|
17396
|
+
exports.createDefaultTheme = createDefaultTheme;
|
|
16940
17397
|
exports.createElement = createElement;
|
|
16941
17398
|
exports.createFadeEffect = createFadeEffect;
|
|
16942
17399
|
exports.createFlashEffect = createFlashEffect;
|
|
@@ -17009,6 +17466,7 @@ exports.registerBuiltins = registerBuiltins;
|
|
|
17009
17466
|
exports.releaseAllSVGTextures = releaseAllSVGTextures;
|
|
17010
17467
|
exports.releaseSVGTexture = releaseSVGTexture;
|
|
17011
17468
|
exports.releaseSVGTextures = releaseSVGTextures;
|
|
17469
|
+
exports.remountAll = remountAll;
|
|
17012
17470
|
exports.resolveEffect = resolveEffect;
|
|
17013
17471
|
exports.rgbToNumber = rgbToNumber;
|
|
17014
17472
|
exports.shallowEqual = shallowEqual;
|
|
@@ -17022,6 +17480,7 @@ exports.themeRegistry = themeRegistry;
|
|
|
17022
17480
|
exports.tileSpriteCreator = tileSpriteCreator;
|
|
17023
17481
|
exports.tileSpritePatcher = tileSpritePatcher;
|
|
17024
17482
|
exports.unmount = unmount;
|
|
17483
|
+
exports.unmountJSX = unmountJSX;
|
|
17025
17484
|
exports.unwrapSignal = unwrapSignal;
|
|
17026
17485
|
exports.useCallback = useCallback;
|
|
17027
17486
|
exports.useEffect = useEffect;
|
|
@@ -17038,8 +17497,9 @@ exports.useSpring = useSpring;
|
|
|
17038
17497
|
exports.useSprings = useSprings;
|
|
17039
17498
|
exports.useState = useState;
|
|
17040
17499
|
exports.useTheme = useTheme;
|
|
17500
|
+
exports.vdom = vdom;
|
|
17041
17501
|
exports.viewCreator = viewCreator;
|
|
17042
17502
|
exports.viewPatcher = viewPatcher;
|
|
17043
17503
|
exports.viewportRegistry = viewportRegistry;
|
|
17044
17504
|
exports.withHooks = withHooks;
|
|
17045
|
-
//# sourceMappingURL=TransformOriginView-
|
|
17505
|
+
//# sourceMappingURL=TransformOriginView-KcTgaYRi.cjs.map
|