rune-lab 0.3.0 → 0.4.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/README.md +1 -1
- package/dist/core/design-tokens/props.d.ts +52 -0
- package/dist/core/design-tokens/props.d.ts.map +1 -0
- package/dist/core/design-tokens/props.js +34 -0
- package/dist/core/exchange-rate/strategies.d.ts +52 -0
- package/dist/core/exchange-rate/strategies.d.ts.map +1 -0
- package/dist/core/exchange-rate/strategies.js +72 -0
- package/dist/core/index.d.ts +8 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -3
- package/dist/core/internal/message-resolver.d.ts +1 -1
- package/dist/core/internal/message-resolver.d.ts.map +1 -1
- package/dist/core/layout/types.d.ts +60 -0
- package/dist/core/layout/types.d.ts.map +1 -0
- package/dist/core/layout/types.js +4 -0
- package/dist/core/money/index.d.ts +1 -1
- package/dist/core/money/index.d.ts.map +1 -1
- package/dist/core/money/index.js +1 -1
- package/dist/core/money/money-primitive.d.ts +101 -0
- package/dist/core/money/money-primitive.d.ts.map +1 -0
- package/dist/core/money/money-primitive.js +161 -0
- package/dist/core/money/money.d.ts +74 -2
- package/dist/core/money/money.d.ts.map +1 -1
- package/dist/core/money/money.js +120 -2
- package/dist/core/shortcuts/types.d.ts +60 -0
- package/dist/core/shortcuts/types.d.ts.map +1 -0
- package/dist/core/shortcuts/types.js +4 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +6 -4
- package/dist/state/api.svelte.js +2 -2
- package/dist/state/app.svelte.js +1 -1
- package/dist/state/auth/index.d.ts +2 -2
- package/dist/state/auth/index.js +1 -1
- package/dist/state/auth/session.svelte.d.ts +1 -1
- package/dist/state/auth/session.svelte.js +7 -5
- package/dist/state/auth/types.d.ts +1 -1
- package/dist/state/cart.svelte.d.ts +1 -1
- package/dist/state/cart.svelte.js +1 -1
- package/dist/state/commands.svelte.d.ts +7 -7
- package/dist/state/commands.svelte.js +1 -1
- package/dist/state/composables/useMoney.d.ts +19 -3
- package/dist/state/composables/useMoney.js +70 -6
- package/dist/state/composables/useMoneyFilter.d.ts +20 -0
- package/dist/state/composables/useMoneyFilter.js +81 -0
- package/dist/state/composables/usePersistence.d.ts +1 -1
- package/dist/state/composables/usePersistence.js +1 -1
- package/dist/state/composables/useRuneLab.d.ts +1 -1
- package/dist/state/composables/useRuneLab.js +2 -2
- package/dist/state/composables/useShortcuts.d.ts +33 -0
- package/dist/state/composables/useShortcuts.js +75 -0
- package/dist/state/context.d.ts +1 -0
- package/dist/state/context.js +1 -0
- package/dist/state/createConfigStore.svelte.d.ts +4 -31
- package/dist/state/createConfigStore.svelte.js +62 -51
- package/dist/state/currency.svelte.d.ts +13 -9
- package/dist/state/currency.svelte.js +26 -10
- package/dist/state/currency.test.d.ts +1 -0
- package/dist/state/currency.test.js +35 -0
- package/dist/state/exchange-rate.svelte.d.ts +43 -0
- package/dist/state/exchange-rate.svelte.js +145 -0
- package/dist/state/exchange-rate.test.d.ts +1 -0
- package/dist/state/exchange-rate.test.js +75 -0
- package/dist/state/index.d.ts +26 -19
- package/dist/state/index.js +25 -18
- package/dist/state/language.svelte.d.ts +3 -10
- package/dist/state/language.svelte.js +4 -5
- package/dist/state/layout.svelte.d.ts +1 -1
- package/dist/state/layout.svelte.js +4 -4
- package/dist/state/persistence/drivers.d.ts +1 -1
- package/dist/state/persistence/drivers.js +9 -7
- package/dist/state/persistence/drivers.test.d.ts +1 -0
- package/dist/state/persistence/drivers.test.js +79 -0
- package/dist/state/persistence/provider.d.ts +23 -0
- package/dist/state/persistence/provider.js +43 -0
- package/dist/state/persistence/provider.test.d.ts +1 -0
- package/dist/state/persistence/provider.test.js +51 -0
- package/dist/state/registry/index.d.ts +44 -0
- package/dist/state/registry/index.js +58 -0
- package/dist/state/registry/registry.test.d.ts +1 -0
- package/dist/state/registry/registry.test.js +112 -0
- package/dist/state/registry/types.d.ts +20 -0
- package/dist/state/registry/types.js +3 -0
- package/dist/state/shortcuts.svelte.js +4 -4
- package/dist/state/theme.svelte.d.ts +3 -10
- package/dist/state/theme.svelte.js +8 -8
- package/dist/state/toast-bridge.d.ts +1 -1
- package/dist/state/toast.svelte.js +1 -1
- package/dist/ui/components/ApiMonitor.svelte +2 -2
- package/dist/ui/components/Icon.svelte +1 -1
- package/dist/ui/components/RuneProvider.svelte +28 -8
- package/dist/ui/components/RuneProvider.svelte.d.ts +12 -5
- package/dist/ui/components/Toaster.svelte +1 -1
- package/dist/ui/components/money/MoneyDisplay.svelte +91 -18
- package/dist/ui/components/money/MoneyDisplay.svelte.d.ts +15 -3
- package/dist/ui/components/money/MoneyDisplay.svelte.test.d.ts +1 -1
- package/dist/ui/components/money/MoneyDisplay.svelte.test.js +45 -2
- package/dist/ui/components/money/MoneyInput.svelte +123 -42
- package/dist/ui/components/money/MoneyInput.svelte.d.ts +14 -5
- package/dist/ui/features/command-palette/CommandPalette.svelte +3 -3
- package/dist/ui/features/config/APP_CONFIGURATIONS.d.ts +29 -0
- package/dist/ui/features/config/APP_CONFIGURATIONS.js +38 -0
- package/dist/ui/features/config/CurrencySelector.svelte +10 -36
- package/dist/ui/features/config/LanguageSelector.svelte +10 -33
- package/dist/ui/features/config/ResourceSelector.svelte +92 -0
- package/dist/ui/features/config/ResourceSelector.svelte.d.ts +25 -0
- package/dist/ui/features/config/ThemeSelector.svelte +11 -34
- package/dist/ui/features/shortcuts/ShortcutBinder.svelte +17 -0
- package/dist/ui/features/shortcuts/ShortcutBinder.svelte.d.ts +7 -0
- package/dist/ui/features/shortcuts/ShortcutPalette.svelte +3 -3
- package/dist/ui/index.d.ts +5 -1
- package/dist/ui/index.js +8 -3
- package/dist/ui/layout/ConnectedNavigationPanel.svelte +7 -8
- package/dist/ui/layout/ConnectedNavigationPanel.svelte.d.ts +1 -1
- package/dist/ui/layout/ConnectedWorkspaceStrip.svelte +5 -3
- package/dist/ui/layout/ConnectedWorkspaceStrip.svelte.d.ts +1 -1
- package/dist/ui/layout/NavigationPanel.svelte +1 -1
- package/dist/ui/layout/NavigationPanel.svelte.d.ts +1 -1
- package/dist/ui/layout/WorkspaceLayout.svelte +9 -1
- package/dist/ui/layout/WorkspaceLayout.svelte.d.ts +7 -0
- package/dist/ui/layout/WorkspaceStrip.svelte +1 -1
- package/dist/ui/layout/WorkspaceStrip.svelte.d.ts +1 -1
- package/dist/ui/layout/connection-factory.d.ts +50 -0
- package/dist/ui/layout/connection-factory.js +58 -0
- package/dist/ui/layout/index.d.ts +2 -2
- package/dist/ui/layout/index.js +1 -1
- package/dist/ui/paraglide/README.md +53 -0
- package/dist/ui/paraglide/runtime.d.ts +105 -124
- package/dist/ui/paraglide/runtime.js +162 -127
- package/dist/ui/paraglide/server.d.ts +6 -17
- package/dist/ui/paraglide/server.js +11 -20
- package/dist/ui/primitives/DatePicker.svelte +1 -1
- package/package.json +8 -8
- package/dist/state/daisyui.d.ts +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Dinero, type DineroCurrency } from "dinero.js";
|
|
1
|
+
import { type Dinero, type DineroCurrency, type DineroSnapshot } from "dinero.js";
|
|
2
2
|
/**
|
|
3
3
|
* Map of ISO 4217 currency codes to Dinero currency objects
|
|
4
4
|
*/
|
|
@@ -8,6 +8,24 @@ export declare const CURRENCY_MAP: Record<string, DineroCurrency<number>>;
|
|
|
8
8
|
* Enables IDE autocomplete while allowing any string for dynamic currencies.
|
|
9
9
|
*/
|
|
10
10
|
export type ISO4217Code = keyof typeof CURRENCY_MAP;
|
|
11
|
+
/**
|
|
12
|
+
* Scaled integer rate for Dinero.js conversion.
|
|
13
|
+
* Avoids floating-point errors by using integer amounts with a scale.
|
|
14
|
+
*/
|
|
15
|
+
export type ScaledRate = {
|
|
16
|
+
amount: number;
|
|
17
|
+
scale: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Map of currency codes to their exchange rates relative to a base currency.
|
|
21
|
+
* Rates can be plain numbers (integers) or ScaledRate objects.
|
|
22
|
+
*/
|
|
23
|
+
export type RateMap = Record<string, ScaledRate | number>;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a human-readable float rate (e.g., 17.23) into a ScaledRate.
|
|
26
|
+
* Defaults to 4 decimal places of precision if not specified.
|
|
27
|
+
*/
|
|
28
|
+
export declare function scaledRate(float: number, precision?: number): ScaledRate;
|
|
11
29
|
/**
|
|
12
30
|
* Register a new currency in CURRENCY_MAP atomically.
|
|
13
31
|
* Ensures the core registry and any store-level registries stay in sync.
|
|
@@ -53,5 +71,59 @@ export declare function subtractMoney(a: Dinero<number>, b: Dinero<number>): Din
|
|
|
53
71
|
* Multiply a monetary value by a factor
|
|
54
72
|
*/
|
|
55
73
|
export declare function multiplyMoney(money: Dinero<number>, factor: number): Dinero<number>;
|
|
56
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Converts a Dinero object to another currency.
|
|
76
|
+
* Both currencies must share the same base (base 10 for all standard ISO currencies).
|
|
77
|
+
*/
|
|
78
|
+
export declare function convertMoney(money: Dinero<number>, toCurrencyCode: string, rates: RateMap): Dinero<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Converts a raw minor-unit amount between currencies.
|
|
81
|
+
* Returns the original amount if from and to currencies are the same.
|
|
82
|
+
*/
|
|
83
|
+
export declare function convertAmount(amount: number, fromCode: string, toCode: string, rates: RateMap): number;
|
|
84
|
+
/**
|
|
85
|
+
* Converts Dinero object to a Stripe-compatible payload.
|
|
86
|
+
*/
|
|
87
|
+
export declare function toStripeMoney(money: Dinero<number>): {
|
|
88
|
+
amount: number;
|
|
89
|
+
currency: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Converts Dinero object to a PayPal-compatible payload.
|
|
93
|
+
*/
|
|
94
|
+
export declare function toPaypalMoney(money: Dinero<number>): {
|
|
95
|
+
value: string;
|
|
96
|
+
currency_code: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Converts Dinero object to an Adyen-compatible payload.
|
|
100
|
+
*/
|
|
101
|
+
export declare function toAdyenMoney(money: Dinero<number>): {
|
|
102
|
+
value: number;
|
|
103
|
+
currency: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Converts Dinero object to a Square-compatible payload (uses BigInt).
|
|
107
|
+
*/
|
|
108
|
+
export declare function toSquareMoney(money: Dinero<number>): {
|
|
109
|
+
amount: bigint;
|
|
110
|
+
currency: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Serializes a Dinero object into a plain object snapshot.
|
|
114
|
+
*/
|
|
115
|
+
export declare function toMoneySnapshot(money: Dinero<number>): {
|
|
116
|
+
amount: number;
|
|
117
|
+
currency: string;
|
|
118
|
+
scale: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Restores a Dinero object from a snapshot.
|
|
122
|
+
*/
|
|
123
|
+
export declare function fromMoneySnapshot(snapshot: {
|
|
124
|
+
amount: number;
|
|
125
|
+
currency: string;
|
|
126
|
+
scale?: number;
|
|
127
|
+
}): Dinero<number>;
|
|
128
|
+
export type { Dinero, DineroCurrency, DineroSnapshot };
|
|
57
129
|
//# sourceMappingURL=money.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../../src/sdk/core/src/money/money.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../../src/sdk/core/src/money/money.ts"],"names":[],"mappings":"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"}
|
package/dist/core/money/money.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// sdk/core/src/money/money.ts
|
|
2
2
|
// Framework-agnostic money utilities using Dinero.js v2
|
|
3
3
|
// Consumers should never import Dinero directly — these helpers encapsulate it.
|
|
4
|
-
import { add as dineroAdd, AED, BRL, CAD, CNY, dinero, EUR, GBP, INR, JPY, KRW, multiply as dineroMultiply, MXN, subtract as dineroSubtract, toDecimal,
|
|
4
|
+
import { add as dineroAdd, AED, BRL, CAD, CNY, convert as dineroConvert, dinero, EUR, GBP, INR, JPY, KRW, multiply as dineroMultiply, MXN, subtract as dineroSubtract, toDecimal,
|
|
5
5
|
// ISO 4217 currency definitions
|
|
6
|
-
USD, } from "dinero.js";
|
|
6
|
+
toSnapshot, transformScale as dineroTransformScale, USD, } from "dinero.js";
|
|
7
7
|
/**
|
|
8
8
|
* Map of ISO 4217 currency codes to Dinero currency objects
|
|
9
9
|
*/
|
|
@@ -20,6 +20,17 @@ export const CURRENCY_MAP = {
|
|
|
20
20
|
BRL,
|
|
21
21
|
INR,
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Converts a human-readable float rate (e.g., 17.23) into a ScaledRate.
|
|
25
|
+
* Defaults to 4 decimal places of precision if not specified.
|
|
26
|
+
*/
|
|
27
|
+
export function scaledRate(float, precision = 4) {
|
|
28
|
+
const factor = Math.pow(10, precision);
|
|
29
|
+
return {
|
|
30
|
+
amount: Math.round(float * factor),
|
|
31
|
+
scale: precision,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
23
34
|
/**
|
|
24
35
|
* Register a new currency in CURRENCY_MAP atomically.
|
|
25
36
|
* Ensures the core registry and any store-level registries stay in sync.
|
|
@@ -130,3 +141,110 @@ export function subtractMoney(a, b) {
|
|
|
130
141
|
export function multiplyMoney(money, factor) {
|
|
131
142
|
return dineroMultiply(money, factor);
|
|
132
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Converts a Dinero object to another currency.
|
|
146
|
+
* Both currencies must share the same base (base 10 for all standard ISO currencies).
|
|
147
|
+
*/
|
|
148
|
+
export function convertMoney(money, toCurrencyCode, rates) {
|
|
149
|
+
const targetCurrency = CURRENCY_MAP[toCurrencyCode];
|
|
150
|
+
if (!targetCurrency) {
|
|
151
|
+
throw new Error(`Unknown target currency: ${toCurrencyCode}. Register it first via registerCurrency().`);
|
|
152
|
+
}
|
|
153
|
+
const rate = rates[toCurrencyCode];
|
|
154
|
+
if (rate === undefined) {
|
|
155
|
+
throw new Error(`Missing exchange rate for currency: ${toCurrencyCode}`);
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
return dineroConvert(money, targetCurrency, { [toCurrencyCode]: rate });
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
if (err instanceof Error && err.message.includes("base")) {
|
|
162
|
+
throw new Error(`Cannot convert between currencies with different bases. Ensure both are base 10.`);
|
|
163
|
+
}
|
|
164
|
+
throw err;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Converts a raw minor-unit amount between currencies.
|
|
169
|
+
* Returns the original amount if from and to currencies are the same.
|
|
170
|
+
*/
|
|
171
|
+
export function convertAmount(amount, fromCode, toCode, rates) {
|
|
172
|
+
if (fromCode === toCode)
|
|
173
|
+
return amount;
|
|
174
|
+
const targetCurrency = CURRENCY_MAP[toCode];
|
|
175
|
+
if (!targetCurrency) {
|
|
176
|
+
throw new Error(`Unknown target currency: ${toCode}`);
|
|
177
|
+
}
|
|
178
|
+
const sourceMoney = createMoney(amount, fromCode);
|
|
179
|
+
const convertedMoney = convertMoney(sourceMoney, toCode, rates);
|
|
180
|
+
// Normalize back to the target currency's standard exponent
|
|
181
|
+
const targetMoney = dineroTransformScale(convertedMoney, targetCurrency.exponent);
|
|
182
|
+
const snapshot = toSnapshot(targetMoney);
|
|
183
|
+
return snapshot.amount;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Converts Dinero object to a Stripe-compatible payload.
|
|
187
|
+
*/
|
|
188
|
+
export function toStripeMoney(money) {
|
|
189
|
+
const snapshot = toSnapshot(money);
|
|
190
|
+
return {
|
|
191
|
+
amount: snapshot.amount,
|
|
192
|
+
currency: snapshot.currency.code.toLowerCase(),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Converts Dinero object to a PayPal-compatible payload.
|
|
197
|
+
*/
|
|
198
|
+
export function toPaypalMoney(money) {
|
|
199
|
+
const value = toDecimal(money);
|
|
200
|
+
const snapshot = toSnapshot(money);
|
|
201
|
+
return {
|
|
202
|
+
value,
|
|
203
|
+
currency_code: snapshot.currency.code,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Converts Dinero object to an Adyen-compatible payload.
|
|
208
|
+
*/
|
|
209
|
+
export function toAdyenMoney(money) {
|
|
210
|
+
const snapshot = toSnapshot(money);
|
|
211
|
+
return {
|
|
212
|
+
value: snapshot.amount,
|
|
213
|
+
currency: snapshot.currency.code.toUpperCase(),
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Converts Dinero object to a Square-compatible payload (uses BigInt).
|
|
218
|
+
*/
|
|
219
|
+
export function toSquareMoney(money) {
|
|
220
|
+
const snapshot = toSnapshot(money);
|
|
221
|
+
return {
|
|
222
|
+
amount: BigInt(snapshot.amount),
|
|
223
|
+
currency: snapshot.currency.code,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Serializes a Dinero object into a plain object snapshot.
|
|
228
|
+
*/
|
|
229
|
+
export function toMoneySnapshot(money) {
|
|
230
|
+
const snapshot = toSnapshot(money);
|
|
231
|
+
return {
|
|
232
|
+
amount: snapshot.amount,
|
|
233
|
+
currency: snapshot.currency.code,
|
|
234
|
+
scale: snapshot.scale,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Restores a Dinero object from a snapshot.
|
|
239
|
+
*/
|
|
240
|
+
export function fromMoneySnapshot(snapshot) {
|
|
241
|
+
const currency = CURRENCY_MAP[snapshot.currency];
|
|
242
|
+
if (!currency) {
|
|
243
|
+
throw new Error(`Unknown currency: ${snapshot.currency}. Register it first.`);
|
|
244
|
+
}
|
|
245
|
+
return dinero({
|
|
246
|
+
amount: snapshot.amount,
|
|
247
|
+
currency,
|
|
248
|
+
scale: snapshot.scale ?? currency.exponent,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarative shortcut configuration.
|
|
3
|
+
* Used by the `useShortcuts` composable to register shortcuts with automatic cleanup.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const shortcuts: ShortcutConfig[] = [
|
|
8
|
+
* {
|
|
9
|
+
* id: "save:document",
|
|
10
|
+
* keys: "ctrl+s",
|
|
11
|
+
* handler: () => save(),
|
|
12
|
+
* label: "Save document",
|
|
13
|
+
* category: "Editing",
|
|
14
|
+
* },
|
|
15
|
+
* {
|
|
16
|
+
* id: "palette:open",
|
|
17
|
+
* keys: "ctrl+k",
|
|
18
|
+
* handler: () => openPalette(),
|
|
19
|
+
* when: () => !isModalOpen,
|
|
20
|
+
* },
|
|
21
|
+
* ];
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface ShortcutConfig {
|
|
25
|
+
/**
|
|
26
|
+
* Unique dot-namespaced identifier.
|
|
27
|
+
* Must be namespaced by feature to prevent collisions in the global registry.
|
|
28
|
+
* @example "save:document", "palette:open"
|
|
29
|
+
*/
|
|
30
|
+
id: string;
|
|
31
|
+
/**
|
|
32
|
+
* Hotkeys.js-compatible key combination string.
|
|
33
|
+
* @example "ctrl+s", "alt+shift+p", "escape"
|
|
34
|
+
*/
|
|
35
|
+
keys: string;
|
|
36
|
+
/**
|
|
37
|
+
* Handler function invoked when the shortcut is triggered.
|
|
38
|
+
*/
|
|
39
|
+
handler: (event: KeyboardEvent) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Optional predicate — when provided, the shortcut only fires if this returns `true`.
|
|
42
|
+
* Useful for context-dependent shortcuts (e.g., only when a modal is closed).
|
|
43
|
+
*/
|
|
44
|
+
when?: () => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Human-readable label for display in the shortcut palette.
|
|
47
|
+
* If omitted, the shortcut is registered but hidden from the palette.
|
|
48
|
+
*/
|
|
49
|
+
label?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Display category (e.g., "Navigation", "Editing") for grouping in the palette.
|
|
52
|
+
*/
|
|
53
|
+
category?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Scope in which the shortcut is active.
|
|
56
|
+
* @default "global"
|
|
57
|
+
*/
|
|
58
|
+
scope?: "global" | "layout" | `panel:${string}`;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/sdk/core/src/shortcuts/types.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAExC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,MAAM,EAAE,CAAC;CACjD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "
|
|
3
|
-
export * from "
|
|
1
|
+
// Auto-generated root barrel file
|
|
2
|
+
export * from "./core/index.js";
|
|
3
|
+
export * from "./state/index.js";
|
|
4
|
+
export * from "./ui/index.js";
|
|
4
5
|
|
|
5
6
|
export declare const version: () => string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "
|
|
3
|
-
export * from "
|
|
1
|
+
// Auto-generated root barrel file
|
|
2
|
+
export * from "./core/index.js";
|
|
3
|
+
export * from "./state/index.js";
|
|
4
|
+
export * from "./ui/index.js";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
import pkg from "../package.json" with { type: "json" };
|
|
7
|
+
export const version = () => pkg.version;
|
package/dist/state/api.svelte.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getContext } from "svelte";
|
|
2
|
-
import { RUNE_LAB_CONTEXT } from "./context";
|
|
2
|
+
import { RUNE_LAB_CONTEXT } from "./context.ts";
|
|
3
3
|
import { DEV } from "esm-env";
|
|
4
4
|
export class ApiStore {
|
|
5
5
|
// State
|
|
@@ -42,7 +42,7 @@ export class ApiStore {
|
|
|
42
42
|
this.connectionState = "connected";
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
catch (
|
|
45
|
+
catch (_e) {
|
|
46
46
|
this.connectionState = "disconnected";
|
|
47
47
|
}
|
|
48
48
|
}
|
package/dist/state/app.svelte.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { AuthConfig, Session, User } from "./types";
|
|
2
|
-
export { createSessionStore, getSessionStore, SessionStore, } from "./session.svelte";
|
|
1
|
+
export type { AuthConfig, Session, User } from "./types.ts";
|
|
2
|
+
export { createSessionStore, getSessionStore, SessionStore, } from "./session.svelte.ts";
|
package/dist/state/auth/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// sdk/state/src/auth/index.ts
|
|
2
|
-
export { createSessionStore, getSessionStore, SessionStore, } from "./session.svelte";
|
|
2
|
+
export { createSessionStore, getSessionStore, SessionStore, } from "./session.svelte.ts";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SessionStore — manages authentication state via Svelte 5 runes.
|
|
3
3
|
// This is a SKELETON — full Better-Auth wiring is deferred to a dedicated spec.
|
|
4
4
|
import { getContext } from "svelte";
|
|
5
|
-
import { RUNE_LAB_CONTEXT } from "../context";
|
|
5
|
+
import { RUNE_LAB_CONTEXT } from "../context.ts";
|
|
6
6
|
/**
|
|
7
7
|
* SessionStore — reactive authentication state.
|
|
8
8
|
*
|
|
@@ -27,26 +27,28 @@ export class SessionStore {
|
|
|
27
27
|
/**
|
|
28
28
|
* Initialize the session — placeholder for Better-Auth client setup
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
init() {
|
|
31
31
|
// TODO: Wire Better-Auth client.getSession() here
|
|
32
32
|
this.isReady = true;
|
|
33
|
+
return Promise.resolve();
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Log in — placeholder
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
login(_credentials) {
|
|
38
39
|
// TODO: Wire Better-Auth client.signIn.email() here
|
|
39
40
|
console.warn("SessionStore.login() is a stub — implement Better-Auth integration");
|
|
40
|
-
return false;
|
|
41
|
+
return Promise.resolve(false);
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* Log out — placeholder
|
|
44
45
|
*/
|
|
45
|
-
|
|
46
|
+
logout() {
|
|
46
47
|
// TODO: Wire Better-Auth client.signOut() here
|
|
47
48
|
this.user = null;
|
|
48
49
|
this.session = null;
|
|
49
50
|
this.isAuthenticated = false;
|
|
51
|
+
return Promise.resolve();
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
export function createSessionStore() {
|
|
@@ -22,7 +22,7 @@ export interface Session {
|
|
|
22
22
|
*/
|
|
23
23
|
export interface AuthConfig {
|
|
24
24
|
/** Better-Auth client instance */
|
|
25
|
-
client?:
|
|
25
|
+
client?: unknown;
|
|
26
26
|
/** Callback when session changes (login, logout, expiry) */
|
|
27
27
|
onSessionChange?: (session: Session | null) => void;
|
|
28
28
|
/** Routes that require authentication */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// sdk/state/src/cart.svelte.ts
|
|
2
2
|
// Generic cart store factory — business-agnostic add/remove/total pattern.
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
|
-
import { RUNE_LAB_CONTEXT } from "./context";
|
|
4
|
+
import { RUNE_LAB_CONTEXT } from "./context.ts";
|
|
5
5
|
import { DEV } from "esm-env";
|
|
6
6
|
/**
|
|
7
7
|
* Generic cart store factory.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AppStore } from "./app.svelte";
|
|
2
|
-
import type { ApiStore } from "./api.svelte";
|
|
3
|
-
import type { ConfigStore } from "./createConfigStore.svelte";
|
|
4
|
-
import type { ToastStore } from "./toast.svelte";
|
|
5
|
-
import type { Theme } from "./theme.svelte";
|
|
6
|
-
import type { Language } from "./language.svelte";
|
|
7
|
-
import type { Currency } from "./currency.svelte";
|
|
1
|
+
import type { AppStore } from "./app.svelte.ts";
|
|
2
|
+
import type { ApiStore } from "./api.svelte.ts";
|
|
3
|
+
import type { ConfigStore } from "./createConfigStore.svelte.ts";
|
|
4
|
+
import type { ToastStore } from "./toast.svelte.ts";
|
|
5
|
+
import type { Theme } from "./theme.svelte.ts";
|
|
6
|
+
import type { Language } from "./language.svelte.ts";
|
|
7
|
+
import type { Currency } from "./currency.svelte.ts";
|
|
8
8
|
/**
|
|
9
9
|
* Command Palette Store
|
|
10
10
|
*/
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
import { type Dinero, type ISO4217Code } from "
|
|
1
|
+
import { type Dinero, type ISO4217Code } from "@internal/core";
|
|
2
2
|
/**
|
|
3
3
|
* Context-aware money composable.
|
|
4
4
|
* Reads CurrencyStore and LanguageStore from rune-lab context.
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
* const { format, toDinero, add, subtract } = useMoney();
|
|
7
|
+
* const { format, toDinero, add, subtract, convert } = useMoney();
|
|
8
8
|
* const display = format(150.00, undefined, 'major'); // "$150.00"
|
|
9
9
|
*/
|
|
10
10
|
export declare function useMoney(): {
|
|
11
11
|
toDinero: (amount: number | null | undefined, currencyCode?: ISO4217Code | string, unit?: "major" | "minor") => Dinero<number>;
|
|
12
|
-
format: (amount: number | null | undefined, currencyCode?: ISO4217Code | string, unit?: "major" | "minor") => string;
|
|
12
|
+
format: (amount: number | null | undefined, currencyCode?: ISO4217Code | string, unit?: "major" | "minor", localeOverride?: string) => string;
|
|
13
13
|
add: (a: number, b: number, currencyCode?: ISO4217Code | string, unit?: "major" | "minor") => Dinero<number>;
|
|
14
14
|
subtract: (a: number, b: number, currencyCode?: ISO4217Code | string, unit?: "major" | "minor") => Dinero<number>;
|
|
15
|
+
convert: (amount: number, fromCode: string, unit?: "major" | "minor") => Dinero<number>;
|
|
16
|
+
formatConverted: (amount: number, fromCode: string, unit?: "major" | "minor") => string;
|
|
17
|
+
toPayload: (amount: number, currencyCode?: string, target?: "stripe" | "paypal" | "adyen" | "square", unit?: "major" | "minor") => {
|
|
18
|
+
amount: number;
|
|
19
|
+
currency: string;
|
|
20
|
+
} | {
|
|
21
|
+
value: string;
|
|
22
|
+
currency_code: string;
|
|
23
|
+
} | {
|
|
24
|
+
value: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
} | {
|
|
27
|
+
amount: bigint;
|
|
28
|
+
currency: string;
|
|
29
|
+
};
|
|
30
|
+
multiply: (amount: number, factor: number, currencyCode?: ISO4217Code | string, unit?: "major" | "minor") => Dinero<number>;
|
|
15
31
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// sdk/state/src/composables/useMoney.ts
|
|
2
2
|
// Context-aware money composable that reads CurrencyStore + LanguageStore
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
|
-
import { RUNE_LAB_CONTEXT } from "../context";
|
|
5
|
-
import { addMoney, createMoney, formatMoney, subtractMoney, toMinorUnit, } from "
|
|
4
|
+
import { RUNE_LAB_CONTEXT } from "../context.ts";
|
|
5
|
+
import { addMoney, convertMoney, createMoney, formatMoney, multiplyMoney, subtractMoney, toAdyenMoney, toMinorUnit, toMoneySnapshot, toPaypalMoney, toSquareMoney, toStripeMoney, } from "@internal/core";
|
|
6
6
|
/**
|
|
7
7
|
* Context-aware money composable.
|
|
8
8
|
* Reads CurrencyStore and LanguageStore from rune-lab context.
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
* const { format, toDinero, add, subtract } = useMoney();
|
|
11
|
+
* const { format, toDinero, add, subtract, convert } = useMoney();
|
|
12
12
|
* const display = format(150.00, undefined, 'major'); // "$150.00"
|
|
13
13
|
*/
|
|
14
14
|
export function useMoney() {
|
|
15
15
|
const currencyStore = getContext(RUNE_LAB_CONTEXT.currency);
|
|
16
16
|
const languageStore = getContext(RUNE_LAB_CONTEXT.language);
|
|
17
|
+
const exchangeRateStore = getContext(RUNE_LAB_CONTEXT.exchangeRate);
|
|
17
18
|
/**
|
|
18
19
|
* Convert amount to a Dinero object using current currency
|
|
19
20
|
*/
|
|
@@ -27,19 +28,73 @@ export function useMoney() {
|
|
|
27
28
|
/**
|
|
28
29
|
* Format an amount as a locale-aware currency string
|
|
29
30
|
*/
|
|
30
|
-
function format(amount, currencyCode, unit = "minor") {
|
|
31
|
+
function format(amount, currencyCode, unit = "minor", localeOverride) {
|
|
31
32
|
if (amount === null || amount === undefined ||
|
|
32
33
|
(typeof amount === "number" && isNaN(amount))) {
|
|
33
34
|
return "—";
|
|
34
35
|
}
|
|
35
36
|
const code = currencyCode ?? String(currencyStore.current);
|
|
36
|
-
const locale = String(languageStore.current) || "en";
|
|
37
|
+
const locale = localeOverride ?? (String(languageStore.current) || "en");
|
|
37
38
|
const minorAmount = unit === "major"
|
|
38
39
|
? toMinorUnit(Number(amount), code)
|
|
39
40
|
: amount;
|
|
40
41
|
const money = createMoney(minorAmount, code);
|
|
41
42
|
return formatMoney(money, locale, code);
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts an amount from fromCode to the current display currency.
|
|
46
|
+
*/
|
|
47
|
+
function convert(amount, fromCode, unit = "minor") {
|
|
48
|
+
const minorAmount = unit === "major"
|
|
49
|
+
? toMinorUnit(amount, fromCode)
|
|
50
|
+
: amount;
|
|
51
|
+
const currentCode = String(currencyStore.current);
|
|
52
|
+
if (!exchangeRateStore?.hasRates || fromCode === currentCode) {
|
|
53
|
+
return createMoney(minorAmount, fromCode);
|
|
54
|
+
}
|
|
55
|
+
const sourceMoney = createMoney(minorAmount, fromCode);
|
|
56
|
+
return convertMoney(sourceMoney, currentCode, exchangeRateStore.rates);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Convenience: converts and formats an amount in one go.
|
|
60
|
+
*/
|
|
61
|
+
function formatConverted(amount, fromCode, unit = "minor") {
|
|
62
|
+
const money = convert(amount, fromCode, unit);
|
|
63
|
+
const locale = String(languageStore.current) || "en";
|
|
64
|
+
const currentCode = String(currencyStore.current);
|
|
65
|
+
const snapshot = toMoneySnapshot(money);
|
|
66
|
+
// If conversion didn't happen (no rates), format as original currency
|
|
67
|
+
const displayCode = exchangeRateStore?.hasRates
|
|
68
|
+
? currentCode
|
|
69
|
+
: snapshot.currency;
|
|
70
|
+
return formatMoney(money, locale, displayCode);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Multiply an amount by a factor.
|
|
74
|
+
*/
|
|
75
|
+
function multiply(amount, factor, currencyCode, unit = "minor") {
|
|
76
|
+
const money = toDinero(amount, currencyCode, unit);
|
|
77
|
+
return multiplyMoney(money, factor);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Format an amount for a specific payment provider payload.
|
|
81
|
+
*/
|
|
82
|
+
function toPayload(amount, currencyCode, target = "stripe", unit = "minor") {
|
|
83
|
+
const code = currencyCode ?? String(currencyStore.current);
|
|
84
|
+
const money = toDinero(amount, code, unit);
|
|
85
|
+
switch (target) {
|
|
86
|
+
case "stripe":
|
|
87
|
+
return toStripeMoney(money);
|
|
88
|
+
case "paypal":
|
|
89
|
+
return toPaypalMoney(money);
|
|
90
|
+
case "adyen":
|
|
91
|
+
return toAdyenMoney(money);
|
|
92
|
+
case "square":
|
|
93
|
+
return toSquareMoney(money);
|
|
94
|
+
default:
|
|
95
|
+
return toStripeMoney(money);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
43
98
|
/**
|
|
44
99
|
* Add two amounts in the current currency
|
|
45
100
|
*/
|
|
@@ -58,5 +113,14 @@ export function useMoney() {
|
|
|
58
113
|
const bMoney = toDinero(b, code, unit);
|
|
59
114
|
return subtractMoney(aMoney, bMoney);
|
|
60
115
|
}
|
|
61
|
-
return {
|
|
116
|
+
return {
|
|
117
|
+
toDinero,
|
|
118
|
+
format,
|
|
119
|
+
add,
|
|
120
|
+
subtract,
|
|
121
|
+
convert,
|
|
122
|
+
formatConverted,
|
|
123
|
+
toPayload,
|
|
124
|
+
multiply,
|
|
125
|
+
};
|
|
62
126
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface MoneyFilterOptions {
|
|
2
|
+
min?: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
unit?: "major" | "minor";
|
|
5
|
+
autoConvertOnChange?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A reactive currency-aware filter composable.
|
|
9
|
+
* Handles min/max thresholds that auto-convert when the display currency changes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useMoneyFilter(options?: MoneyFilterOptions): {
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
readonly displayMin: string;
|
|
15
|
+
readonly displayMax: string;
|
|
16
|
+
setMin: (value: number) => void;
|
|
17
|
+
setMax: (value: number) => void;
|
|
18
|
+
reset: () => void;
|
|
19
|
+
matches: (amount: number, entityCurrency: string) => boolean;
|
|
20
|
+
};
|