@medialane/ui 0.373.4 → 0.374.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/components/accounts-page.cjs +1 -1
- package/dist/components/accounts-page.cjs.map +1 -1
- package/dist/components/accounts-page.js +1 -1
- package/dist/components/accounts-page.js.map +1 -1
- package/dist/components/activity-row.cjs +8 -7
- package/dist/components/activity-row.cjs.map +1 -1
- package/dist/components/activity-row.js +8 -7
- package/dist/components/activity-row.js.map +1 -1
- package/dist/components/asset-access-cards.cjs +3 -1
- package/dist/components/asset-access-cards.cjs.map +1 -1
- package/dist/components/asset-access-cards.js +3 -1
- package/dist/components/asset-access-cards.js.map +1 -1
- package/dist/components/asset-type-panels.cjs +1 -1
- package/dist/components/asset-type-panels.cjs.map +1 -1
- package/dist/components/asset-type-panels.js +1 -1
- package/dist/components/asset-type-panels.js.map +1 -1
- package/dist/components/claim-route-shell.cjs +4 -2
- package/dist/components/claim-route-shell.cjs.map +1 -1
- package/dist/components/claim-route-shell.d.cts +1 -1
- package/dist/components/claim-route-shell.d.ts +1 -1
- package/dist/components/claim-route-shell.js +4 -2
- package/dist/components/claim-route-shell.js.map +1 -1
- package/dist/components/coin-guarantees.cjs +2 -2
- package/dist/components/coin-guarantees.cjs.map +1 -1
- package/dist/components/coin-guarantees.js +2 -2
- package/dist/components/coin-guarantees.js.map +1 -1
- package/dist/components/coins-explorer.cjs +1 -1
- package/dist/components/coins-explorer.cjs.map +1 -1
- package/dist/components/coins-explorer.js +1 -1
- package/dist/components/coins-explorer.js.map +1 -1
- package/dist/components/collection-filters.cjs +1 -1
- package/dist/components/collection-filters.cjs.map +1 -1
- package/dist/components/collection-filters.js +1 -1
- package/dist/components/collection-filters.js.map +1 -1
- package/dist/components/collection-provenance-tab.cjs +4 -3
- package/dist/components/collection-provenance-tab.cjs.map +1 -1
- package/dist/components/collection-provenance-tab.js +4 -3
- package/dist/components/collection-provenance-tab.js.map +1 -1
- package/dist/components/collection-settings.cjs +3 -3
- package/dist/components/collection-settings.cjs.map +1 -1
- package/dist/components/collection-settings.js +3 -3
- package/dist/components/collection-settings.js.map +1 -1
- package/dist/components/collection-showcase.cjs +1 -1
- package/dist/components/collection-showcase.cjs.map +1 -1
- package/dist/components/collection-showcase.js +1 -1
- package/dist/components/collection-showcase.js.map +1 -1
- package/dist/components/collections-page.cjs +2 -2
- package/dist/components/collections-page.cjs.map +1 -1
- package/dist/components/collections-page.js +2 -2
- package/dist/components/collections-page.js.map +1 -1
- package/dist/components/create-form-primitives.cjs +20 -1
- package/dist/components/create-form-primitives.cjs.map +1 -1
- package/dist/components/create-form-primitives.js +20 -1
- package/dist/components/create-form-primitives.js.map +1 -1
- package/dist/components/create-sponsorship-aside.cjs +6 -6
- package/dist/components/create-sponsorship-aside.cjs.map +1 -1
- package/dist/components/create-sponsorship-aside.js +6 -6
- package/dist/components/create-sponsorship-aside.js.map +1 -1
- package/dist/components/creator-header.cjs +5 -2
- package/dist/components/creator-header.cjs.map +1 -1
- package/dist/components/creator-header.js +5 -2
- package/dist/components/creator-header.js.map +1 -1
- package/dist/components/discover-collections-strip.cjs +6 -3
- package/dist/components/discover-collections-strip.cjs.map +1 -1
- package/dist/components/discover-collections-strip.js +6 -3
- package/dist/components/discover-collections-strip.js.map +1 -1
- package/dist/components/discover-community-section.cjs +5 -3
- package/dist/components/discover-community-section.cjs.map +1 -1
- package/dist/components/discover-community-section.js +5 -3
- package/dist/components/discover-community-section.js.map +1 -1
- package/dist/components/discover-features.cjs +2 -2
- package/dist/components/discover-features.cjs.map +1 -1
- package/dist/components/discover-features.js +2 -2
- package/dist/components/discover-features.js.map +1 -1
- package/dist/components/discover-feed-section.cjs +3 -2
- package/dist/components/discover-feed-section.cjs.map +1 -1
- package/dist/components/discover-feed-section.js +3 -2
- package/dist/components/discover-feed-section.js.map +1 -1
- package/dist/components/drop/create/artwork-section.d.cts +2 -0
- package/dist/components/drop/create/artwork-section.d.ts +2 -0
- package/dist/components/drop/create/details-section.d.cts +2 -0
- package/dist/components/drop/create/details-section.d.ts +2 -0
- package/dist/components/drop/create/drop-create.cjs +1 -1
- package/dist/components/drop/create/drop-create.cjs.map +1 -1
- package/dist/components/drop/create/drop-create.d.cts +2 -0
- package/dist/components/drop/create/drop-create.d.ts +2 -0
- package/dist/components/drop/create/drop-create.js +2 -2
- package/dist/components/drop/create/drop-create.js.map +1 -1
- package/dist/components/drop/create/launch-dialog.cjs +1 -1
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
- package/dist/components/drop/create/launch-dialog.d.cts +2 -0
- package/dist/components/drop/create/launch-dialog.d.ts +2 -0
- package/dist/components/drop/create/launch-dialog.js +2 -2
- package/dist/components/drop/create/launch-dialog.js.map +1 -1
- package/dist/components/drop/create/list-section.d.cts +2 -0
- package/dist/components/drop/create/list-section.d.ts +2 -0
- package/dist/components/drop/create/sale-section.d.cts +2 -0
- package/dist/components/drop/create/sale-section.d.ts +2 -0
- package/dist/components/drop/drop-features.cjs +8 -6
- package/dist/components/drop/drop-features.cjs.map +1 -1
- package/dist/components/drop/drop-features.js +8 -6
- package/dist/components/drop/drop-features.js.map +1 -1
- package/dist/components/drop/drop-listing.cjs +3 -3
- package/dist/components/drop/drop-listing.cjs.map +1 -1
- package/dist/components/drop/drop-listing.js +3 -3
- package/dist/components/drop/drop-listing.js.map +1 -1
- package/dist/components/drop/my-drops.cjs +1 -1
- package/dist/components/drop/my-drops.cjs.map +1 -1
- package/dist/components/drop/my-drops.js +1 -1
- package/dist/components/drop/my-drops.js.map +1 -1
- package/dist/components/drop/page/drop-manage.cjs +3 -3
- package/dist/components/drop/page/drop-manage.cjs.map +1 -1
- package/dist/components/drop/page/drop-manage.js +3 -3
- package/dist/components/drop/page/drop-manage.js.map +1 -1
- package/dist/components/drop-item-list.cjs +2 -2
- package/dist/components/drop-item-list.cjs.map +1 -1
- package/dist/components/drop-item-list.js +2 -2
- package/dist/components/drop-item-list.js.map +1 -1
- package/dist/components/empty-or-error.cjs +2 -2
- package/dist/components/empty-or-error.cjs.map +1 -1
- package/dist/components/empty-or-error.js +2 -2
- package/dist/components/empty-or-error.js.map +1 -1
- package/dist/components/fast-mint/dropzone.cjs +2 -2
- package/dist/components/fast-mint/dropzone.cjs.map +1 -1
- package/dist/components/fast-mint/dropzone.js +2 -2
- package/dist/components/fast-mint/dropzone.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +3 -3
- package/dist/components/fast-mint/formats/nft.cjs.map +1 -1
- package/dist/components/fast-mint/formats/nft.js +3 -3
- package/dist/components/fast-mint/formats/nft.js.map +1 -1
- package/dist/components/fast-mint/formats/pop.cjs +3 -3
- package/dist/components/fast-mint/formats/pop.cjs.map +1 -1
- package/dist/components/fast-mint/formats/pop.js +3 -3
- package/dist/components/fast-mint/formats/pop.js.map +1 -1
- package/dist/components/fast-mint/formats/tiers.cjs +5 -5
- package/dist/components/fast-mint/formats/tiers.cjs.map +1 -1
- package/dist/components/fast-mint/formats/tiers.js +5 -5
- package/dist/components/fast-mint/formats/tiers.js.map +1 -1
- package/dist/components/fast-mint/licensing-section.cjs +6 -27
- package/dist/components/fast-mint/licensing-section.cjs.map +1 -1
- package/dist/components/fast-mint/licensing-section.d.cts +1 -6
- package/dist/components/fast-mint/licensing-section.d.ts +1 -6
- package/dist/components/fast-mint/licensing-section.js +2 -22
- package/dist/components/fast-mint/licensing-section.js.map +1 -1
- package/dist/components/featured-carousel.cjs +3 -2
- package/dist/components/featured-carousel.cjs.map +1 -1
- package/dist/components/featured-carousel.js +3 -2
- package/dist/components/featured-carousel.js.map +1 -1
- package/dist/components/gated-content.cjs +1 -1
- package/dist/components/gated-content.cjs.map +1 -1
- package/dist/components/gated-content.js +1 -1
- package/dist/components/gated-content.js.map +1 -1
- package/dist/components/ip-type-badge.cjs +4 -2
- package/dist/components/ip-type-badge.cjs.map +1 -1
- package/dist/components/ip-type-badge.js +4 -2
- package/dist/components/ip-type-badge.js.map +1 -1
- package/dist/components/ip-type-nav.cjs +3 -2
- package/dist/components/ip-type-nav.cjs.map +1 -1
- package/dist/components/ip-type-nav.js +3 -2
- package/dist/components/ip-type-nav.js.map +1 -1
- package/dist/components/ip-type-page.cjs +2 -2
- package/dist/components/ip-type-page.cjs.map +1 -1
- package/dist/components/ip-type-page.js +2 -2
- package/dist/components/ip-type-page.js.map +1 -1
- package/dist/components/journey-content.cjs +1 -1
- package/dist/components/journey-content.cjs.map +1 -1
- package/dist/components/journey-content.js +1 -1
- package/dist/components/journey-content.js.map +1 -1
- package/dist/components/launchpad/coin-create.cjs +1 -1
- package/dist/components/launchpad/coin-create.cjs.map +1 -1
- package/dist/components/launchpad/coin-create.js +1 -1
- package/dist/components/launchpad/coin-create.js.map +1 -1
- package/dist/components/launchpad/collection-create-form.cjs +1 -1
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +1 -1
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/collection-create-presets.cjs +1 -1
- package/dist/components/launchpad/collection-create-presets.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-presets.js +1 -1
- package/dist/components/launchpad/collection-create-presets.js.map +1 -1
- package/dist/components/launchpad/edition-mint.cjs +1 -1
- package/dist/components/launchpad/edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint.js +1 -1
- package/dist/components/launchpad/edition-mint.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.js +1 -1
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +1 -1
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +1 -1
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad-strip.cjs +3 -2
- package/dist/components/launchpad-strip.cjs.map +1 -1
- package/dist/components/launchpad-strip.js +3 -2
- package/dist/components/launchpad-strip.js.map +1 -1
- package/dist/components/marketplace-filters.cjs +2 -1
- package/dist/components/marketplace-filters.cjs.map +1 -1
- package/dist/components/marketplace-filters.js +2 -1
- package/dist/components/marketplace-filters.js.map +1 -1
- package/dist/components/new-collection-menu.cjs +5 -4
- package/dist/components/new-collection-menu.cjs.map +1 -1
- package/dist/components/new-collection-menu.js +5 -4
- package/dist/components/new-collection-menu.js.map +1 -1
- package/dist/components/order-sort-control.cjs +7 -4
- package/dist/components/order-sort-control.cjs.map +1 -1
- package/dist/components/order-sort-control.js +7 -4
- package/dist/components/order-sort-control.js.map +1 -1
- package/dist/components/portfolio-orders.cjs +16 -16
- package/dist/components/portfolio-orders.cjs.map +1 -1
- package/dist/components/portfolio-orders.js +16 -16
- package/dist/components/portfolio-orders.js.map +1 -1
- package/dist/components/price-history-chart.cjs +1 -1
- package/dist/components/price-history-chart.cjs.map +1 -1
- package/dist/components/price-history-chart.js +1 -1
- package/dist/components/price-history-chart.js.map +1 -1
- package/dist/components/report-dialog.cjs +1 -1
- package/dist/components/report-dialog.cjs.map +1 -1
- package/dist/components/report-dialog.js +1 -1
- package/dist/components/report-dialog.js.map +1 -1
- package/dist/components/rewards/level-badge.cjs +3 -1
- package/dist/components/rewards/level-badge.cjs.map +1 -1
- package/dist/components/rewards/level-badge.js +3 -1
- package/dist/components/rewards/level-badge.js.map +1 -1
- package/dist/components/rewards/rewards-dashboard.cjs +24 -24
- package/dist/components/rewards/rewards-dashboard.cjs.map +1 -1
- package/dist/components/rewards/rewards-dashboard.js +24 -24
- package/dist/components/rewards/rewards-dashboard.js.map +1 -1
- package/dist/components/rewards-section.cjs +5 -5
- package/dist/components/rewards-section.cjs.map +1 -1
- package/dist/components/rewards-section.js +5 -5
- package/dist/components/rewards-section.js.map +1 -1
- package/dist/components/section-heading.cjs +5 -2
- package/dist/components/section-heading.cjs.map +1 -1
- package/dist/components/section-heading.js +5 -2
- package/dist/components/section-heading.js.map +1 -1
- package/dist/components/sponsorship-offers-page.cjs +5 -4
- package/dist/components/sponsorship-offers-page.cjs.map +1 -1
- package/dist/components/sponsorship-offers-page.js +5 -4
- package/dist/components/sponsorship-offers-page.js.map +1 -1
- package/dist/components/transaction-dialog.cjs +1 -1
- package/dist/components/transaction-dialog.cjs.map +1 -1
- package/dist/components/transaction-dialog.js +1 -1
- package/dist/components/transaction-dialog.js.map +1 -1
- package/dist/components/transfer-collection-ownership.cjs +1 -1
- package/dist/components/transfer-collection-ownership.cjs.map +1 -1
- package/dist/components/transfer-collection-ownership.js +1 -1
- package/dist/components/transfer-collection-ownership.js.map +1 -1
- package/dist/components/wallet/self-fund-consent-dialog.cjs +1 -1
- package/dist/components/wallet/self-fund-consent-dialog.cjs.map +1 -1
- package/dist/components/wallet/self-fund-consent-dialog.js +1 -1
- package/dist/components/wallet/self-fund-consent-dialog.js.map +1 -1
- package/dist/data/launchpad-services.cjs +1 -1
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.js +1 -1
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/i18n/catalog/pt.cjs +1715 -0
- package/dist/i18n/catalog/pt.cjs.map +1 -0
- package/dist/i18n/catalog/pt.d.cts +5 -0
- package/dist/i18n/catalog/pt.d.ts +5 -0
- package/dist/i18n/catalog/pt.js +1695 -0
- package/dist/i18n/catalog/pt.js.map +1 -0
- package/dist/i18n/catalogs.cjs +13 -1
- package/dist/i18n/catalogs.cjs.map +1 -1
- package/dist/i18n/catalogs.js +3 -1
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/locales.cjs +4 -1
- package/dist/i18n/locales.cjs.map +1 -1
- package/dist/i18n/locales.js +4 -1
- package/dist/i18n/locales.js.map +1 -1
- package/dist/i18n/tools/scan.cjs +80 -0
- package/dist/i18n/tools/scan.cjs.map +1 -0
- package/dist/i18n/tools/scan.d.cts +8 -0
- package/dist/i18n/tools/scan.d.ts +8 -0
- package/dist/i18n/tools/scan.js +45 -0
- package/dist/i18n/tools/scan.js.map +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/utils/drop/draft.cjs +5 -0
- package/dist/utils/drop/draft.cjs.map +1 -1
- package/dist/utils/drop/draft.d.cts +4 -1
- package/dist/utils/drop/draft.d.ts +4 -1
- package/dist/utils/drop/draft.js +4 -0
- package/dist/utils/drop/draft.js.map +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var scan_exports = {};
|
|
30
|
+
__export(scan_exports, {
|
|
31
|
+
readSources: () => readSources,
|
|
32
|
+
scanSentences: () => scanSentences
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(scan_exports);
|
|
35
|
+
var import_typescript = __toESM(require("typescript"), 1);
|
|
36
|
+
var import_node_fs = require("node:fs");
|
|
37
|
+
var import_node_path = require("node:path");
|
|
38
|
+
const literalText = (node) => node && (import_typescript.default.isStringLiteral(node) || import_typescript.default.isNoSubstitutionTemplateLiteral(node)) ? node.text : null;
|
|
39
|
+
function scanSentences(files) {
|
|
40
|
+
const sentences = /* @__PURE__ */ new Set();
|
|
41
|
+
const plurals = /* @__PURE__ */ new Set();
|
|
42
|
+
for (const [name, text] of Object.entries(files)) {
|
|
43
|
+
const kind = name.endsWith("x") ? import_typescript.default.ScriptKind.TSX : import_typescript.default.ScriptKind.TS;
|
|
44
|
+
const source = import_typescript.default.createSourceFile(name, text, import_typescript.default.ScriptTarget.Latest, true, kind);
|
|
45
|
+
const visit = (node) => {
|
|
46
|
+
if (import_typescript.default.isCallExpression(node)) {
|
|
47
|
+
const callee = node.expression;
|
|
48
|
+
if (import_typescript.default.isIdentifier(callee) && (callee.text === "t" || callee.text === "msg")) {
|
|
49
|
+
const sentence = literalText(node.arguments[0]);
|
|
50
|
+
if (sentence !== null) sentences.add(sentence);
|
|
51
|
+
} else if (import_typescript.default.isPropertyAccessExpression(callee) && import_typescript.default.isIdentifier(callee.expression) && callee.expression.text === "t") {
|
|
52
|
+
const first = literalText(node.arguments[0]);
|
|
53
|
+
if (first !== null && callee.name.text === "plural") plurals.add(first);
|
|
54
|
+
if (first !== null && callee.name.text === "rich") sentences.add(first);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
import_typescript.default.forEachChild(node, visit);
|
|
58
|
+
};
|
|
59
|
+
visit(source);
|
|
60
|
+
}
|
|
61
|
+
return { sentences, plurals };
|
|
62
|
+
}
|
|
63
|
+
function readSources(dir, skip = /* @__PURE__ */ new Set(["catalog"])) {
|
|
64
|
+
const files = {};
|
|
65
|
+
for (const name of (0, import_node_fs.readdirSync)(dir)) {
|
|
66
|
+
const path = (0, import_node_path.join)(dir, name);
|
|
67
|
+
if ((0, import_node_fs.statSync)(path).isDirectory()) {
|
|
68
|
+
if (!skip.has(name) && name !== "node_modules") Object.assign(files, readSources(path, skip));
|
|
69
|
+
} else if (/\.tsx?$/.test(name) && !/\.test\.tsx?$/.test(name)) {
|
|
70
|
+
files[path] = (0, import_node_fs.readFileSync)(path, "utf8");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return files;
|
|
74
|
+
}
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
readSources,
|
|
78
|
+
scanSentences
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=scan.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/i18n/tools/scan.ts"],"sourcesContent":["import ts from \"typescript\";\nimport { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface Scan {\n sentences: Set<string>;\n plurals: Set<string>;\n}\n\nconst literalText = (node: ts.Node | undefined): string | null =>\n node && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : null;\n\nexport function scanSentences(files: Record<string, string>): Scan {\n const sentences = new Set<string>();\n const plurals = new Set<string>();\n for (const [name, text] of Object.entries(files)) {\n const kind = name.endsWith(\"x\") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const source = ts.createSourceFile(name, text, ts.ScriptTarget.Latest, true, kind);\n const visit = (node: ts.Node) => {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n if (ts.isIdentifier(callee) && (callee.text === \"t\" || callee.text === \"msg\")) {\n const sentence = literalText(node.arguments[0]);\n if (sentence !== null) sentences.add(sentence);\n } else if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression) && callee.expression.text === \"t\") {\n const first = literalText(node.arguments[0]);\n if (first !== null && callee.name.text === \"plural\") plurals.add(first);\n if (first !== null && callee.name.text === \"rich\") sentences.add(first);\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(source);\n }\n return { sentences, plurals };\n}\n\nexport function readSources(dir: string, skip: ReadonlySet<string> = new Set([\"catalog\"])): Record<string, string> {\n const files: Record<string, string> = {};\n for (const name of readdirSync(dir)) {\n const path = join(dir, name);\n if (statSync(path).isDirectory()) {\n if (!skip.has(name) && name !== \"node_modules\") Object.assign(files, readSources(path, skip));\n } else if (/\\.tsx?$/.test(name) && !/\\.test\\.tsx?$/.test(name)) {\n files[path] = readFileSync(path, \"utf8\");\n }\n }\n return files;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAe;AACf,qBAAoD;AACpD,uBAAqB;AAOrB,MAAM,cAAc,CAAC,SACnB,SAAS,kBAAAA,QAAG,gBAAgB,IAAI,KAAK,kBAAAA,QAAG,gCAAgC,IAAI,KAAK,KAAK,OAAO;AAExF,SAAS,cAAc,OAAqC;AACjE,QAAM,YAAY,oBAAI,IAAY;AAClC,QAAM,UAAU,oBAAI,IAAY;AAChC,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,UAAM,OAAO,KAAK,SAAS,GAAG,IAAI,kBAAAA,QAAG,WAAW,MAAM,kBAAAA,QAAG,WAAW;AACpE,UAAM,SAAS,kBAAAA,QAAG,iBAAiB,MAAM,MAAM,kBAAAA,QAAG,aAAa,QAAQ,MAAM,IAAI;AACjF,UAAM,QAAQ,CAAC,SAAkB;AAC/B,UAAI,kBAAAA,QAAG,iBAAiB,IAAI,GAAG;AAC7B,cAAM,SAAS,KAAK;AACpB,YAAI,kBAAAA,QAAG,aAAa,MAAM,MAAM,OAAO,SAAS,OAAO,OAAO,SAAS,QAAQ;AAC7E,gBAAM,WAAW,YAAY,KAAK,UAAU,CAAC,CAAC;AAC9C,cAAI,aAAa,KAAM,WAAU,IAAI,QAAQ;AAAA,QAC/C,WAAW,kBAAAA,QAAG,2BAA2B,MAAM,KAAK,kBAAAA,QAAG,aAAa,OAAO,UAAU,KAAK,OAAO,WAAW,SAAS,KAAK;AACxH,gBAAM,QAAQ,YAAY,KAAK,UAAU,CAAC,CAAC;AAC3C,cAAI,UAAU,QAAQ,OAAO,KAAK,SAAS,SAAU,SAAQ,IAAI,KAAK;AACtE,cAAI,UAAU,QAAQ,OAAO,KAAK,SAAS,OAAQ,WAAU,IAAI,KAAK;AAAA,QACxE;AAAA,MACF;AACA,wBAAAA,QAAG,aAAa,MAAM,KAAK;AAAA,IAC7B;AACA,UAAM,MAAM;AAAA,EACd;AACA,SAAO,EAAE,WAAW,QAAQ;AAC9B;AAEO,SAAS,YAAY,KAAa,OAA4B,oBAAI,IAAI,CAAC,SAAS,CAAC,GAA2B;AACjH,QAAM,QAAgC,CAAC;AACvC,aAAW,YAAQ,4BAAY,GAAG,GAAG;AACnC,UAAM,WAAO,uBAAK,KAAK,IAAI;AAC3B,YAAI,yBAAS,IAAI,EAAE,YAAY,GAAG;AAChC,UAAI,CAAC,KAAK,IAAI,IAAI,KAAK,SAAS,eAAgB,QAAO,OAAO,OAAO,YAAY,MAAM,IAAI,CAAC;AAAA,IAC9F,WAAW,UAAU,KAAK,IAAI,KAAK,CAAC,gBAAgB,KAAK,IAAI,GAAG;AAC9D,YAAM,IAAI,QAAI,6BAAa,MAAM,MAAM;AAAA,IACzC;AAAA,EACF;AACA,SAAO;AACT;","names":["ts"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Scan {
|
|
2
|
+
sentences: Set<string>;
|
|
3
|
+
plurals: Set<string>;
|
|
4
|
+
}
|
|
5
|
+
declare function scanSentences(files: Record<string, string>): Scan;
|
|
6
|
+
declare function readSources(dir: string, skip?: ReadonlySet<string>): Record<string, string>;
|
|
7
|
+
|
|
8
|
+
export { type Scan, readSources, scanSentences };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Scan {
|
|
2
|
+
sentences: Set<string>;
|
|
3
|
+
plurals: Set<string>;
|
|
4
|
+
}
|
|
5
|
+
declare function scanSentences(files: Record<string, string>): Scan;
|
|
6
|
+
declare function readSources(dir: string, skip?: ReadonlySet<string>): Record<string, string>;
|
|
7
|
+
|
|
8
|
+
export { type Scan, readSources, scanSentences };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const literalText = (node) => node && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : null;
|
|
5
|
+
function scanSentences(files) {
|
|
6
|
+
const sentences = /* @__PURE__ */ new Set();
|
|
7
|
+
const plurals = /* @__PURE__ */ new Set();
|
|
8
|
+
for (const [name, text] of Object.entries(files)) {
|
|
9
|
+
const kind = name.endsWith("x") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
|
|
10
|
+
const source = ts.createSourceFile(name, text, ts.ScriptTarget.Latest, true, kind);
|
|
11
|
+
const visit = (node) => {
|
|
12
|
+
if (ts.isCallExpression(node)) {
|
|
13
|
+
const callee = node.expression;
|
|
14
|
+
if (ts.isIdentifier(callee) && (callee.text === "t" || callee.text === "msg")) {
|
|
15
|
+
const sentence = literalText(node.arguments[0]);
|
|
16
|
+
if (sentence !== null) sentences.add(sentence);
|
|
17
|
+
} else if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression) && callee.expression.text === "t") {
|
|
18
|
+
const first = literalText(node.arguments[0]);
|
|
19
|
+
if (first !== null && callee.name.text === "plural") plurals.add(first);
|
|
20
|
+
if (first !== null && callee.name.text === "rich") sentences.add(first);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
ts.forEachChild(node, visit);
|
|
24
|
+
};
|
|
25
|
+
visit(source);
|
|
26
|
+
}
|
|
27
|
+
return { sentences, plurals };
|
|
28
|
+
}
|
|
29
|
+
function readSources(dir, skip = /* @__PURE__ */ new Set(["catalog"])) {
|
|
30
|
+
const files = {};
|
|
31
|
+
for (const name of readdirSync(dir)) {
|
|
32
|
+
const path = join(dir, name);
|
|
33
|
+
if (statSync(path).isDirectory()) {
|
|
34
|
+
if (!skip.has(name) && name !== "node_modules") Object.assign(files, readSources(path, skip));
|
|
35
|
+
} else if (/\.tsx?$/.test(name) && !/\.test\.tsx?$/.test(name)) {
|
|
36
|
+
files[path] = readFileSync(path, "utf8");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return files;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
readSources,
|
|
43
|
+
scanSentences
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/i18n/tools/scan.ts"],"sourcesContent":["import ts from \"typescript\";\nimport { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface Scan {\n sentences: Set<string>;\n plurals: Set<string>;\n}\n\nconst literalText = (node: ts.Node | undefined): string | null =>\n node && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : null;\n\nexport function scanSentences(files: Record<string, string>): Scan {\n const sentences = new Set<string>();\n const plurals = new Set<string>();\n for (const [name, text] of Object.entries(files)) {\n const kind = name.endsWith(\"x\") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;\n const source = ts.createSourceFile(name, text, ts.ScriptTarget.Latest, true, kind);\n const visit = (node: ts.Node) => {\n if (ts.isCallExpression(node)) {\n const callee = node.expression;\n if (ts.isIdentifier(callee) && (callee.text === \"t\" || callee.text === \"msg\")) {\n const sentence = literalText(node.arguments[0]);\n if (sentence !== null) sentences.add(sentence);\n } else if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression) && callee.expression.text === \"t\") {\n const first = literalText(node.arguments[0]);\n if (first !== null && callee.name.text === \"plural\") plurals.add(first);\n if (first !== null && callee.name.text === \"rich\") sentences.add(first);\n }\n }\n ts.forEachChild(node, visit);\n };\n visit(source);\n }\n return { sentences, plurals };\n}\n\nexport function readSources(dir: string, skip: ReadonlySet<string> = new Set([\"catalog\"])): Record<string, string> {\n const files: Record<string, string> = {};\n for (const name of readdirSync(dir)) {\n const path = join(dir, name);\n if (statSync(path).isDirectory()) {\n if (!skip.has(name) && name !== \"node_modules\") Object.assign(files, readSources(path, skip));\n } else if (/\\.tsx?$/.test(name) && !/\\.test\\.tsx?$/.test(name)) {\n files[path] = readFileSync(path, \"utf8\");\n }\n }\n return files;\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,SAAS,aAAa,cAAc,gBAAgB;AACpD,SAAS,YAAY;AAOrB,MAAM,cAAc,CAAC,SACnB,SAAS,GAAG,gBAAgB,IAAI,KAAK,GAAG,gCAAgC,IAAI,KAAK,KAAK,OAAO;AAExF,SAAS,cAAc,OAAqC;AACjE,QAAM,YAAY,oBAAI,IAAY;AAClC,QAAM,UAAU,oBAAI,IAAY;AAChC,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,UAAM,OAAO,KAAK,SAAS,GAAG,IAAI,GAAG,WAAW,MAAM,GAAG,WAAW;AACpE,UAAM,SAAS,GAAG,iBAAiB,MAAM,MAAM,GAAG,aAAa,QAAQ,MAAM,IAAI;AACjF,UAAM,QAAQ,CAAC,SAAkB;AAC/B,UAAI,GAAG,iBAAiB,IAAI,GAAG;AAC7B,cAAM,SAAS,KAAK;AACpB,YAAI,GAAG,aAAa,MAAM,MAAM,OAAO,SAAS,OAAO,OAAO,SAAS,QAAQ;AAC7E,gBAAM,WAAW,YAAY,KAAK,UAAU,CAAC,CAAC;AAC9C,cAAI,aAAa,KAAM,WAAU,IAAI,QAAQ;AAAA,QAC/C,WAAW,GAAG,2BAA2B,MAAM,KAAK,GAAG,aAAa,OAAO,UAAU,KAAK,OAAO,WAAW,SAAS,KAAK;AACxH,gBAAM,QAAQ,YAAY,KAAK,UAAU,CAAC,CAAC;AAC3C,cAAI,UAAU,QAAQ,OAAO,KAAK,SAAS,SAAU,SAAQ,IAAI,KAAK;AACtE,cAAI,UAAU,QAAQ,OAAO,KAAK,SAAS,OAAQ,WAAU,IAAI,KAAK;AAAA,QACxE;AAAA,MACF;AACA,SAAG,aAAa,MAAM,KAAK;AAAA,IAC7B;AACA,UAAM,MAAM;AAAA,EACd;AACA,SAAO,EAAE,WAAW,QAAQ;AAC9B;AAEO,SAAS,YAAY,KAAa,OAA4B,oBAAI,IAAI,CAAC,SAAS,CAAC,GAA2B;AACjH,QAAM,QAAgC,CAAC;AACvC,aAAW,QAAQ,YAAY,GAAG,GAAG;AACnC,UAAM,OAAO,KAAK,KAAK,IAAI;AAC3B,QAAI,SAAS,IAAI,EAAE,YAAY,GAAG;AAChC,UAAI,CAAC,KAAK,IAAI,IAAI,KAAK,SAAS,eAAgB,QAAO,OAAO,OAAO,YAAY,MAAM,IAAI,CAAC;AAAA,IAC9F,WAAW,UAAU,KAAK,IAAI,KAAK,CAAC,gBAAgB,KAAK,IAAI,GAAG;AAC9D,YAAM,IAAI,IAAI,aAAa,MAAM,MAAM;AAAA,IACzC;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -323,11 +323,11 @@ import 'input-otp';
|
|
|
323
323
|
import 'react-hook-form';
|
|
324
324
|
import 'zod';
|
|
325
325
|
import './utils/drop/draft.cjs';
|
|
326
|
+
import './i18n/make-t.cjs';
|
|
327
|
+
import './i18n/translate.cjs';
|
|
326
328
|
import './utils/drop/metadata.cjs';
|
|
327
329
|
import './utils/drop/sale.cjs';
|
|
328
330
|
import 'starknet';
|
|
329
|
-
import './i18n/make-t.cjs';
|
|
330
|
-
import './i18n/translate.cjs';
|
|
331
331
|
import 'class-variance-authority/types';
|
|
332
332
|
import 'class-variance-authority';
|
|
333
333
|
import '@radix-ui/react-label';
|
package/dist/index.d.ts
CHANGED
|
@@ -323,11 +323,11 @@ import 'input-otp';
|
|
|
323
323
|
import 'react-hook-form';
|
|
324
324
|
import 'zod';
|
|
325
325
|
import './utils/drop/draft.js';
|
|
326
|
+
import './i18n/make-t.js';
|
|
327
|
+
import './i18n/translate.js';
|
|
326
328
|
import './utils/drop/metadata.js';
|
|
327
329
|
import './utils/drop/sale.js';
|
|
328
330
|
import 'starknet';
|
|
329
|
-
import './i18n/make-t.js';
|
|
330
|
-
import './i18n/translate.js';
|
|
331
331
|
import 'class-variance-authority/types';
|
|
332
332
|
import 'class-variance-authority';
|
|
333
333
|
import '@radix-ui/react-label';
|
|
@@ -20,6 +20,7 @@ var draft_exports = {};
|
|
|
20
20
|
__export(draft_exports, {
|
|
21
21
|
EMPTY_DRAFT: () => EMPTY_DRAFT,
|
|
22
22
|
draftSupply: () => draftSupply,
|
|
23
|
+
supplyLabel: () => supplyLabel,
|
|
23
24
|
validateDropDraft: () => validateDropDraft
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(draft_exports);
|
|
@@ -80,10 +81,14 @@ function validateDropDraft(d, now) {
|
|
|
80
81
|
if (d.gated.enabled && !/^https:\/\//.test(d.gated.url)) e.gated = "Add a link starting with https://";
|
|
81
82
|
return e;
|
|
82
83
|
}
|
|
84
|
+
function supplyLabel(t, kind, supply, formatted) {
|
|
85
|
+
return kind === "edition" ? t.plural("{count} copy", "{count} copies", supply, { count: formatted }) : t.plural("{count} item", "{count} items", supply, { count: formatted });
|
|
86
|
+
}
|
|
83
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
84
88
|
0 && (module.exports = {
|
|
85
89
|
EMPTY_DRAFT,
|
|
86
90
|
draftSupply,
|
|
91
|
+
supplyLabel,
|
|
87
92
|
validateDropDraft
|
|
88
93
|
});
|
|
89
94
|
//# sourceMappingURL=draft.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/drop/draft.ts"],"sourcesContent":["import type { DraftItem } from \"../../components/drop-item-list.js\";\nimport { isPositiveInteger, isSymbol } from \"../launchpad-rules.js\";\nimport { parseAllowlist } from \"./allowlist.js\";\nimport { MAX_DROP_SUPPLY, type DropKind, type DropLicense } from \"./metadata.js\";\nimport { EMPTY_SALE, validateSale, type SaleDraft, type SaleErrors } from \"./sale.js\";\nimport { formatNumber } from \"../../i18n/format.js\";\n\nexport interface DropDraft {\n kind: DropKind;\n edition: File | null;\n supply: string;\n items: DraftItem[];\n cover: File | null;\n name: string;\n symbol: string;\n description: string;\n license: DropLicense;\n sale: SaleDraft;\n listOnly: boolean;\n allowlist: string;\n gated: { enabled: boolean; title: string; url: string; type: string };\n}\n\nexport const EMPTY_DRAFT: DropDraft = {\n kind: \"edition\",\n edition: null,\n supply: \"100\",\n items: [],\n cover: null,\n name: \"\",\n symbol: \"\",\n description: \"\",\n license: {\n ipType: \"Art\", licenseType: \"CC BY-SA\", commercialUse: \"Yes\", derivatives: \"Share-Alike\",\n attribution: \"Required\", geographicScope: \"Worldwide\", aiPolicy: \"Allowed\", royalty: \"0\",\n },\n sale: EMPTY_SALE,\n listOnly: false,\n allowlist: \"\",\n gated: { enabled: false, title: \"\", url: \"\", type: \"\" },\n};\n\nexport type DropDraftErrors = SaleErrors & Partial<Record<\"artwork\" | \"supply\" | \"name\" | \"symbol\" | \"allowlist\" | \"gated\", string>>;\n\nexport function draftSupply(d: DropDraft): number {\n return d.kind === \"edition\" ? Number(d.supply) : d.items.length;\n}\n\nconst thousands = formatNumber(MAX_DROP_SUPPLY);\n\nexport function validateDropDraft(d: DropDraft, now: number): DropDraftErrors {\n const e: DropDraftErrors = { ...validateSale(d.sale, now) };\n if (d.kind === \"edition\") {\n if (!d.edition) e.artwork = \"Add the artwork\";\n if (!isPositiveInteger(d.supply) || Number(d.supply) > MAX_DROP_SUPPLY) e.supply = `Enter a supply from 1 to ${thousands}`;\n } else if (d.items.length === 0) {\n e.artwork = \"Add at least one item\";\n } else if (d.items.length > MAX_DROP_SUPPLY) {\n e.artwork = `A collection holds up to ${thousands} items`;\n }\n if (!d.name.trim()) e.name = \"Name your drop\";\n if (!isSymbol(d.symbol)) e.symbol = \"Use 1–10 capital letters or digits\";\n if (d.listOnly) {\n const list = parseAllowlist(d.allowlist);\n if (list.invalid.length > 0) {\n const n = list.invalid.length;\n e.allowlist = `${n} line${n === 1 ? \" isn't a wallet address\" : \"s aren't wallet addresses\"}: ${list.invalid.slice(0, 3).join(\", \")}`;\n } else if (list.addresses.length === 0) {\n e.allowlist = \"Add at least one wallet address\";\n }\n }\n if (d.gated.enabled && !/^https:\\/\\//.test(d.gated.url)) e.gated = \"Add a link starting with https://\";\n return e;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/drop/draft.ts"],"sourcesContent":["import type { T } from \"../../i18n/make-t.js\";\nimport type { DraftItem } from \"../../components/drop-item-list.js\";\nimport { isPositiveInteger, isSymbol } from \"../launchpad-rules.js\";\nimport { parseAllowlist } from \"./allowlist.js\";\nimport { MAX_DROP_SUPPLY, type DropKind, type DropLicense } from \"./metadata.js\";\nimport { EMPTY_SALE, validateSale, type SaleDraft, type SaleErrors } from \"./sale.js\";\nimport { formatNumber } from \"../../i18n/format.js\";\n\nexport interface DropDraft {\n kind: DropKind;\n edition: File | null;\n supply: string;\n items: DraftItem[];\n cover: File | null;\n name: string;\n symbol: string;\n description: string;\n license: DropLicense;\n sale: SaleDraft;\n listOnly: boolean;\n allowlist: string;\n gated: { enabled: boolean; title: string; url: string; type: string };\n}\n\nexport const EMPTY_DRAFT: DropDraft = {\n kind: \"edition\",\n edition: null,\n supply: \"100\",\n items: [],\n cover: null,\n name: \"\",\n symbol: \"\",\n description: \"\",\n license: {\n ipType: \"Art\", licenseType: \"CC BY-SA\", commercialUse: \"Yes\", derivatives: \"Share-Alike\",\n attribution: \"Required\", geographicScope: \"Worldwide\", aiPolicy: \"Allowed\", royalty: \"0\",\n },\n sale: EMPTY_SALE,\n listOnly: false,\n allowlist: \"\",\n gated: { enabled: false, title: \"\", url: \"\", type: \"\" },\n};\n\nexport type DropDraftErrors = SaleErrors & Partial<Record<\"artwork\" | \"supply\" | \"name\" | \"symbol\" | \"allowlist\" | \"gated\", string>>;\n\nexport function draftSupply(d: DropDraft): number {\n return d.kind === \"edition\" ? Number(d.supply) : d.items.length;\n}\n\nconst thousands = formatNumber(MAX_DROP_SUPPLY);\n\nexport function validateDropDraft(d: DropDraft, now: number): DropDraftErrors {\n const e: DropDraftErrors = { ...validateSale(d.sale, now) };\n if (d.kind === \"edition\") {\n if (!d.edition) e.artwork = \"Add the artwork\";\n if (!isPositiveInteger(d.supply) || Number(d.supply) > MAX_DROP_SUPPLY) e.supply = `Enter a supply from 1 to ${thousands}`;\n } else if (d.items.length === 0) {\n e.artwork = \"Add at least one item\";\n } else if (d.items.length > MAX_DROP_SUPPLY) {\n e.artwork = `A collection holds up to ${thousands} items`;\n }\n if (!d.name.trim()) e.name = \"Name your drop\";\n if (!isSymbol(d.symbol)) e.symbol = \"Use 1–10 capital letters or digits\";\n if (d.listOnly) {\n const list = parseAllowlist(d.allowlist);\n if (list.invalid.length > 0) {\n const n = list.invalid.length;\n e.allowlist = `${n} line${n === 1 ? \" isn't a wallet address\" : \"s aren't wallet addresses\"}: ${list.invalid.slice(0, 3).join(\", \")}`;\n } else if (list.addresses.length === 0) {\n e.allowlist = \"Add at least one wallet address\";\n }\n }\n if (d.gated.enabled && !/^https:\\/\\//.test(d.gated.url)) e.gated = \"Add a link starting with https://\";\n return e;\n}\n\nexport function supplyLabel(t: T, kind: DropKind, supply: number, formatted: string): string {\n return kind === \"edition\"\n ? t.plural(\"{count} copy\", \"{count} copies\", supply, { count: formatted })\n : t.plural(\"{count} item\", \"{count} items\", supply, { count: formatted });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,6BAA4C;AAC5C,uBAA+B;AAC/B,sBAAiE;AACjE,kBAA0E;AAC1E,oBAA6B;AAkBtB,MAAM,cAAyB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,IACP,QAAQ;AAAA,IAAO,aAAa;AAAA,IAAY,eAAe;AAAA,IAAO,aAAa;AAAA,IAC3E,aAAa;AAAA,IAAY,iBAAiB;AAAA,IAAa,UAAU;AAAA,IAAW,SAAS;AAAA,EACvF;AAAA,EACA,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,OAAO,EAAE,SAAS,OAAO,OAAO,IAAI,KAAK,IAAI,MAAM,GAAG;AACxD;AAIO,SAAS,YAAY,GAAsB;AAChD,SAAO,EAAE,SAAS,YAAY,OAAO,EAAE,MAAM,IAAI,EAAE,MAAM;AAC3D;AAEA,MAAM,gBAAY,4BAAa,+BAAe;AAEvC,SAAS,kBAAkB,GAAc,KAA8B;AAC5E,QAAM,IAAqB,EAAE,OAAG,0BAAa,EAAE,MAAM,GAAG,EAAE;AAC1D,MAAI,EAAE,SAAS,WAAW;AACxB,QAAI,CAAC,EAAE,QAAS,GAAE,UAAU;AAC5B,QAAI,KAAC,0CAAkB,EAAE,MAAM,KAAK,OAAO,EAAE,MAAM,IAAI,gCAAiB,GAAE,SAAS,4BAA4B,SAAS;AAAA,EAC1H,WAAW,EAAE,MAAM,WAAW,GAAG;AAC/B,MAAE,UAAU;AAAA,EACd,WAAW,EAAE,MAAM,SAAS,iCAAiB;AAC3C,MAAE,UAAU,4BAA4B,SAAS;AAAA,EACnD;AACA,MAAI,CAAC,EAAE,KAAK,KAAK,EAAG,GAAE,OAAO;AAC7B,MAAI,KAAC,iCAAS,EAAE,MAAM,EAAG,GAAE,SAAS;AACpC,MAAI,EAAE,UAAU;AACd,UAAM,WAAO,iCAAe,EAAE,SAAS;AACvC,QAAI,KAAK,QAAQ,SAAS,GAAG;AAC3B,YAAM,IAAI,KAAK,QAAQ;AACvB,QAAE,YAAY,GAAG,CAAC,QAAQ,MAAM,IAAI,4BAA4B,2BAA2B,KAAK,KAAK,QAAQ,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,IACrI,WAAW,KAAK,UAAU,WAAW,GAAG;AACtC,QAAE,YAAY;AAAA,IAChB;AAAA,EACF;AACA,MAAI,EAAE,MAAM,WAAW,CAAC,cAAc,KAAK,EAAE,MAAM,GAAG,EAAG,GAAE,QAAQ;AACnE,SAAO;AACT;AAEO,SAAS,YAAY,GAAM,MAAgB,QAAgB,WAA2B;AAC3F,SAAO,SAAS,YACZ,EAAE,OAAO,gBAAgB,kBAAkB,QAAQ,EAAE,OAAO,UAAU,CAAC,IACvE,EAAE,OAAO,gBAAgB,iBAAiB,QAAQ,EAAE,OAAO,UAAU,CAAC;AAC5E;","names":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { T } from '../../i18n/make-t.cjs';
|
|
1
2
|
import { DraftItem } from '../../components/drop-item-list.cjs';
|
|
2
3
|
import { DropKind, DropLicense } from './metadata.cjs';
|
|
3
4
|
import { SaleDraft, SaleErrors } from './sale.cjs';
|
|
5
|
+
import '../../i18n/translate.cjs';
|
|
4
6
|
import 'react/jsx-runtime';
|
|
5
7
|
import '@medialane/sdk';
|
|
6
8
|
|
|
@@ -28,5 +30,6 @@ declare const EMPTY_DRAFT: DropDraft;
|
|
|
28
30
|
type DropDraftErrors = SaleErrors & Partial<Record<"artwork" | "supply" | "name" | "symbol" | "allowlist" | "gated", string>>;
|
|
29
31
|
declare function draftSupply(d: DropDraft): number;
|
|
30
32
|
declare function validateDropDraft(d: DropDraft, now: number): DropDraftErrors;
|
|
33
|
+
declare function supplyLabel(t: T, kind: DropKind, supply: number, formatted: string): string;
|
|
31
34
|
|
|
32
|
-
export { type DropDraft, type DropDraftErrors, EMPTY_DRAFT, draftSupply, validateDropDraft };
|
|
35
|
+
export { type DropDraft, type DropDraftErrors, EMPTY_DRAFT, draftSupply, supplyLabel, validateDropDraft };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { T } from '../../i18n/make-t.js';
|
|
1
2
|
import { DraftItem } from '../../components/drop-item-list.js';
|
|
2
3
|
import { DropKind, DropLicense } from './metadata.js';
|
|
3
4
|
import { SaleDraft, SaleErrors } from './sale.js';
|
|
5
|
+
import '../../i18n/translate.js';
|
|
4
6
|
import 'react/jsx-runtime';
|
|
5
7
|
import '@medialane/sdk';
|
|
6
8
|
|
|
@@ -28,5 +30,6 @@ declare const EMPTY_DRAFT: DropDraft;
|
|
|
28
30
|
type DropDraftErrors = SaleErrors & Partial<Record<"artwork" | "supply" | "name" | "symbol" | "allowlist" | "gated", string>>;
|
|
29
31
|
declare function draftSupply(d: DropDraft): number;
|
|
30
32
|
declare function validateDropDraft(d: DropDraft, now: number): DropDraftErrors;
|
|
33
|
+
declare function supplyLabel(t: T, kind: DropKind, supply: number, formatted: string): string;
|
|
31
34
|
|
|
32
|
-
export { type DropDraft, type DropDraftErrors, EMPTY_DRAFT, draftSupply, validateDropDraft };
|
|
35
|
+
export { type DropDraft, type DropDraftErrors, EMPTY_DRAFT, draftSupply, supplyLabel, validateDropDraft };
|
package/dist/utils/drop/draft.js
CHANGED
|
@@ -55,9 +55,13 @@ function validateDropDraft(d, now) {
|
|
|
55
55
|
if (d.gated.enabled && !/^https:\/\//.test(d.gated.url)) e.gated = "Add a link starting with https://";
|
|
56
56
|
return e;
|
|
57
57
|
}
|
|
58
|
+
function supplyLabel(t, kind, supply, formatted) {
|
|
59
|
+
return kind === "edition" ? t.plural("{count} copy", "{count} copies", supply, { count: formatted }) : t.plural("{count} item", "{count} items", supply, { count: formatted });
|
|
60
|
+
}
|
|
58
61
|
export {
|
|
59
62
|
EMPTY_DRAFT,
|
|
60
63
|
draftSupply,
|
|
64
|
+
supplyLabel,
|
|
61
65
|
validateDropDraft
|
|
62
66
|
};
|
|
63
67
|
//# sourceMappingURL=draft.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/drop/draft.ts"],"sourcesContent":["import type { DraftItem } from \"../../components/drop-item-list.js\";\nimport { isPositiveInteger, isSymbol } from \"../launchpad-rules.js\";\nimport { parseAllowlist } from \"./allowlist.js\";\nimport { MAX_DROP_SUPPLY, type DropKind, type DropLicense } from \"./metadata.js\";\nimport { EMPTY_SALE, validateSale, type SaleDraft, type SaleErrors } from \"./sale.js\";\nimport { formatNumber } from \"../../i18n/format.js\";\n\nexport interface DropDraft {\n kind: DropKind;\n edition: File | null;\n supply: string;\n items: DraftItem[];\n cover: File | null;\n name: string;\n symbol: string;\n description: string;\n license: DropLicense;\n sale: SaleDraft;\n listOnly: boolean;\n allowlist: string;\n gated: { enabled: boolean; title: string; url: string; type: string };\n}\n\nexport const EMPTY_DRAFT: DropDraft = {\n kind: \"edition\",\n edition: null,\n supply: \"100\",\n items: [],\n cover: null,\n name: \"\",\n symbol: \"\",\n description: \"\",\n license: {\n ipType: \"Art\", licenseType: \"CC BY-SA\", commercialUse: \"Yes\", derivatives: \"Share-Alike\",\n attribution: \"Required\", geographicScope: \"Worldwide\", aiPolicy: \"Allowed\", royalty: \"0\",\n },\n sale: EMPTY_SALE,\n listOnly: false,\n allowlist: \"\",\n gated: { enabled: false, title: \"\", url: \"\", type: \"\" },\n};\n\nexport type DropDraftErrors = SaleErrors & Partial<Record<\"artwork\" | \"supply\" | \"name\" | \"symbol\" | \"allowlist\" | \"gated\", string>>;\n\nexport function draftSupply(d: DropDraft): number {\n return d.kind === \"edition\" ? Number(d.supply) : d.items.length;\n}\n\nconst thousands = formatNumber(MAX_DROP_SUPPLY);\n\nexport function validateDropDraft(d: DropDraft, now: number): DropDraftErrors {\n const e: DropDraftErrors = { ...validateSale(d.sale, now) };\n if (d.kind === \"edition\") {\n if (!d.edition) e.artwork = \"Add the artwork\";\n if (!isPositiveInteger(d.supply) || Number(d.supply) > MAX_DROP_SUPPLY) e.supply = `Enter a supply from 1 to ${thousands}`;\n } else if (d.items.length === 0) {\n e.artwork = \"Add at least one item\";\n } else if (d.items.length > MAX_DROP_SUPPLY) {\n e.artwork = `A collection holds up to ${thousands} items`;\n }\n if (!d.name.trim()) e.name = \"Name your drop\";\n if (!isSymbol(d.symbol)) e.symbol = \"Use 1–10 capital letters or digits\";\n if (d.listOnly) {\n const list = parseAllowlist(d.allowlist);\n if (list.invalid.length > 0) {\n const n = list.invalid.length;\n e.allowlist = `${n} line${n === 1 ? \" isn't a wallet address\" : \"s aren't wallet addresses\"}: ${list.invalid.slice(0, 3).join(\", \")}`;\n } else if (list.addresses.length === 0) {\n e.allowlist = \"Add at least one wallet address\";\n }\n }\n if (d.gated.enabled && !/^https:\\/\\//.test(d.gated.url)) e.gated = \"Add a link starting with https://\";\n return e;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/drop/draft.ts"],"sourcesContent":["import type { T } from \"../../i18n/make-t.js\";\nimport type { DraftItem } from \"../../components/drop-item-list.js\";\nimport { isPositiveInteger, isSymbol } from \"../launchpad-rules.js\";\nimport { parseAllowlist } from \"./allowlist.js\";\nimport { MAX_DROP_SUPPLY, type DropKind, type DropLicense } from \"./metadata.js\";\nimport { EMPTY_SALE, validateSale, type SaleDraft, type SaleErrors } from \"./sale.js\";\nimport { formatNumber } from \"../../i18n/format.js\";\n\nexport interface DropDraft {\n kind: DropKind;\n edition: File | null;\n supply: string;\n items: DraftItem[];\n cover: File | null;\n name: string;\n symbol: string;\n description: string;\n license: DropLicense;\n sale: SaleDraft;\n listOnly: boolean;\n allowlist: string;\n gated: { enabled: boolean; title: string; url: string; type: string };\n}\n\nexport const EMPTY_DRAFT: DropDraft = {\n kind: \"edition\",\n edition: null,\n supply: \"100\",\n items: [],\n cover: null,\n name: \"\",\n symbol: \"\",\n description: \"\",\n license: {\n ipType: \"Art\", licenseType: \"CC BY-SA\", commercialUse: \"Yes\", derivatives: \"Share-Alike\",\n attribution: \"Required\", geographicScope: \"Worldwide\", aiPolicy: \"Allowed\", royalty: \"0\",\n },\n sale: EMPTY_SALE,\n listOnly: false,\n allowlist: \"\",\n gated: { enabled: false, title: \"\", url: \"\", type: \"\" },\n};\n\nexport type DropDraftErrors = SaleErrors & Partial<Record<\"artwork\" | \"supply\" | \"name\" | \"symbol\" | \"allowlist\" | \"gated\", string>>;\n\nexport function draftSupply(d: DropDraft): number {\n return d.kind === \"edition\" ? Number(d.supply) : d.items.length;\n}\n\nconst thousands = formatNumber(MAX_DROP_SUPPLY);\n\nexport function validateDropDraft(d: DropDraft, now: number): DropDraftErrors {\n const e: DropDraftErrors = { ...validateSale(d.sale, now) };\n if (d.kind === \"edition\") {\n if (!d.edition) e.artwork = \"Add the artwork\";\n if (!isPositiveInteger(d.supply) || Number(d.supply) > MAX_DROP_SUPPLY) e.supply = `Enter a supply from 1 to ${thousands}`;\n } else if (d.items.length === 0) {\n e.artwork = \"Add at least one item\";\n } else if (d.items.length > MAX_DROP_SUPPLY) {\n e.artwork = `A collection holds up to ${thousands} items`;\n }\n if (!d.name.trim()) e.name = \"Name your drop\";\n if (!isSymbol(d.symbol)) e.symbol = \"Use 1–10 capital letters or digits\";\n if (d.listOnly) {\n const list = parseAllowlist(d.allowlist);\n if (list.invalid.length > 0) {\n const n = list.invalid.length;\n e.allowlist = `${n} line${n === 1 ? \" isn't a wallet address\" : \"s aren't wallet addresses\"}: ${list.invalid.slice(0, 3).join(\", \")}`;\n } else if (list.addresses.length === 0) {\n e.allowlist = \"Add at least one wallet address\";\n }\n }\n if (d.gated.enabled && !/^https:\\/\\//.test(d.gated.url)) e.gated = \"Add a link starting with https://\";\n return e;\n}\n\nexport function supplyLabel(t: T, kind: DropKind, supply: number, formatted: string): string {\n return kind === \"edition\"\n ? t.plural(\"{count} copy\", \"{count} copies\", supply, { count: formatted })\n : t.plural(\"{count} item\", \"{count} items\", supply, { count: formatted });\n}\n"],"mappings":"AAEA,SAAS,mBAAmB,gBAAgB;AAC5C,SAAS,sBAAsB;AAC/B,SAAS,uBAAwD;AACjE,SAAS,YAAY,oBAAqD;AAC1E,SAAS,oBAAoB;AAkBtB,MAAM,cAAyB;AAAA,EACpC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,IACP,QAAQ;AAAA,IAAO,aAAa;AAAA,IAAY,eAAe;AAAA,IAAO,aAAa;AAAA,IAC3E,aAAa;AAAA,IAAY,iBAAiB;AAAA,IAAa,UAAU;AAAA,IAAW,SAAS;AAAA,EACvF;AAAA,EACA,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,OAAO,EAAE,SAAS,OAAO,OAAO,IAAI,KAAK,IAAI,MAAM,GAAG;AACxD;AAIO,SAAS,YAAY,GAAsB;AAChD,SAAO,EAAE,SAAS,YAAY,OAAO,EAAE,MAAM,IAAI,EAAE,MAAM;AAC3D;AAEA,MAAM,YAAY,aAAa,eAAe;AAEvC,SAAS,kBAAkB,GAAc,KAA8B;AAC5E,QAAM,IAAqB,EAAE,GAAG,aAAa,EAAE,MAAM,GAAG,EAAE;AAC1D,MAAI,EAAE,SAAS,WAAW;AACxB,QAAI,CAAC,EAAE,QAAS,GAAE,UAAU;AAC5B,QAAI,CAAC,kBAAkB,EAAE,MAAM,KAAK,OAAO,EAAE,MAAM,IAAI,gBAAiB,GAAE,SAAS,4BAA4B,SAAS;AAAA,EAC1H,WAAW,EAAE,MAAM,WAAW,GAAG;AAC/B,MAAE,UAAU;AAAA,EACd,WAAW,EAAE,MAAM,SAAS,iBAAiB;AAC3C,MAAE,UAAU,4BAA4B,SAAS;AAAA,EACnD;AACA,MAAI,CAAC,EAAE,KAAK,KAAK,EAAG,GAAE,OAAO;AAC7B,MAAI,CAAC,SAAS,EAAE,MAAM,EAAG,GAAE,SAAS;AACpC,MAAI,EAAE,UAAU;AACd,UAAM,OAAO,eAAe,EAAE,SAAS;AACvC,QAAI,KAAK,QAAQ,SAAS,GAAG;AAC3B,YAAM,IAAI,KAAK,QAAQ;AACvB,QAAE,YAAY,GAAG,CAAC,QAAQ,MAAM,IAAI,4BAA4B,2BAA2B,KAAK,KAAK,QAAQ,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,IACrI,WAAW,KAAK,UAAU,WAAW,GAAG;AACtC,QAAE,YAAY;AAAA,IAChB;AAAA,EACF;AACA,MAAI,EAAE,MAAM,WAAW,CAAC,cAAc,KAAK,EAAE,MAAM,GAAG,EAAG,GAAE,QAAQ;AACnE,SAAO;AACT;AAEO,SAAS,YAAY,GAAM,MAAgB,QAAgB,WAA2B;AAC3F,SAAO,SAAS,YACZ,EAAE,OAAO,gBAAgB,kBAAkB,QAAQ,EAAE,OAAO,UAAU,CAAC,IACvE,EAAE,OAAO,gBAAgB,iBAAiB,QAAQ,EAAE,OAAO,UAAU,CAAC;AAC5E;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medialane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.374.1",
|
|
4
4
|
"description": "Shared UI components for Medialane apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"import": "./dist/i18n/index.js",
|
|
25
25
|
"require": "./dist/i18n/index.cjs"
|
|
26
26
|
},
|
|
27
|
+
"./i18n-tools": {
|
|
28
|
+
"types": "./dist/i18n/tools/scan.d.ts",
|
|
29
|
+
"import": "./dist/i18n/tools/scan.js",
|
|
30
|
+
"require": "./dist/i18n/tools/scan.cjs"
|
|
31
|
+
},
|
|
27
32
|
"./utils/*": {
|
|
28
33
|
"types": "./dist/utils/*.d.ts",
|
|
29
34
|
"import": "./dist/utils/*.js",
|