@intlayer/core 7.6.0-canary.1 → 8.0.0-canary.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/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +5 -0
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/index.cjs +56 -2
- package/dist/cjs/interpreter/getContent/deepTransform.cjs +1 -0
- package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/getContent.cjs +2 -2
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/plugins.cjs +3 -2
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
- package/dist/cjs/interpreter/getHTML.cjs +106 -0
- package/dist/cjs/interpreter/getHTML.cjs.map +1 -0
- package/dist/cjs/interpreter/getInsertion.cjs +3 -1
- package/dist/cjs/interpreter/getInsertion.cjs.map +1 -1
- package/dist/cjs/interpreter/getTranslation.cjs +2 -2
- package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
- package/dist/cjs/interpreter/index.cjs +2 -0
- package/dist/cjs/localization/getBrowserLocale.cjs +1 -1
- package/dist/cjs/localization/getLocale.cjs +4 -3
- package/dist/cjs/localization/getLocale.cjs.map +1 -1
- package/dist/cjs/markdown/compiler.cjs +806 -0
- package/dist/cjs/markdown/compiler.cjs.map +1 -0
- package/dist/cjs/markdown/constants.cjs +334 -0
- package/dist/cjs/markdown/constants.cjs.map +1 -0
- package/dist/cjs/markdown/index.cjs +49 -0
- package/dist/cjs/markdown/parser.cjs +73 -0
- package/dist/cjs/markdown/parser.cjs.map +1 -0
- package/dist/cjs/markdown/renderer.cjs +68 -0
- package/dist/cjs/markdown/renderer.cjs.map +1 -0
- package/dist/cjs/markdown/types.cjs +0 -0
- package/dist/cjs/markdown/utils.cjs +397 -0
- package/dist/cjs/markdown/utils.cjs.map +1 -0
- package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs +15 -0
- package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs.map +1 -0
- package/dist/cjs/transpiler/html/index.cjs +133 -0
- package/dist/cjs/transpiler/html/index.cjs.map +1 -0
- package/dist/cjs/transpiler/index.cjs +3 -0
- package/dist/cjs/transpiler/insertion/getInsertionValues.cjs +2 -2
- package/dist/cjs/transpiler/insertion/getInsertionValues.cjs.map +1 -1
- package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
- package/dist/cjs/utils/intl.cjs +35 -3
- package/dist/cjs/utils/intl.cjs.map +1 -1
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +5 -0
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/index.mjs +11 -4
- package/dist/esm/interpreter/getContent/deepTransform.mjs +1 -0
- package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/getContent.mjs +2 -2
- package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/plugins.mjs +3 -2
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
- package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
- package/dist/esm/interpreter/getHTML.mjs +105 -0
- package/dist/esm/interpreter/getHTML.mjs.map +1 -0
- package/dist/esm/interpreter/getInsertion.mjs +3 -1
- package/dist/esm/interpreter/getInsertion.mjs.map +1 -1
- package/dist/esm/interpreter/getTranslation.mjs +2 -2
- package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
- package/dist/esm/interpreter/index.mjs +2 -1
- package/dist/esm/localization/getBrowserLocale.mjs +1 -1
- package/dist/esm/localization/getLocale.mjs +2 -1
- package/dist/esm/localization/getLocale.mjs.map +1 -1
- package/dist/esm/markdown/compiler.mjs +804 -0
- package/dist/esm/markdown/compiler.mjs.map +1 -0
- package/dist/esm/markdown/constants.mjs +254 -0
- package/dist/esm/markdown/constants.mjs.map +1 -0
- package/dist/esm/markdown/index.mjs +7 -0
- package/dist/esm/markdown/parser.mjs +73 -0
- package/dist/esm/markdown/parser.mjs.map +1 -0
- package/dist/esm/markdown/renderer.mjs +67 -0
- package/dist/esm/markdown/renderer.mjs.map +1 -0
- package/dist/esm/markdown/types.mjs +0 -0
- package/dist/esm/markdown/utils.mjs +368 -0
- package/dist/esm/markdown/utils.mjs.map +1 -0
- package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs +15 -0
- package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs.map +1 -0
- package/dist/esm/transpiler/html/index.mjs +131 -0
- package/dist/esm/transpiler/html/index.mjs.map +1 -0
- package/dist/esm/transpiler/index.mjs +2 -1
- package/dist/esm/transpiler/insertion/getInsertionValues.mjs +2 -2
- package/dist/esm/transpiler/insertion/getInsertionValues.mjs.map +1 -1
- package/dist/esm/transpiler/insertion/insertion.mjs.map +1 -1
- package/dist/esm/utils/intl.mjs +35 -4
- package/dist/esm/utils/intl.mjs.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +11 -10
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +11 -10
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +11 -10
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/getStorageAttributes.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -3
- package/dist/types/interpreter/getContent/getContent.d.ts +1 -1
- package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/index.d.ts +2 -2
- package/dist/types/interpreter/getContent/plugins.d.ts +58 -18
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/interpreter/getEnumeration.d.ts +1 -1
- package/dist/types/interpreter/getHTML.d.ts +14 -0
- package/dist/types/interpreter/getHTML.d.ts.map +1 -0
- package/dist/types/interpreter/getTranslation.d.ts.map +1 -1
- package/dist/types/interpreter/index.d.ts +3 -2
- package/dist/types/localization/getLocale.d.ts.map +1 -1
- package/dist/types/markdown/compiler.d.ts +10 -0
- package/dist/types/markdown/compiler.d.ts.map +1 -0
- package/dist/types/markdown/constants.d.ts +193 -0
- package/dist/types/markdown/constants.d.ts.map +1 -0
- package/dist/types/markdown/index.d.ts +7 -0
- package/dist/types/markdown/parser.d.ts +17 -0
- package/dist/types/markdown/parser.d.ts.map +1 -0
- package/dist/types/markdown/renderer.d.ts +23 -0
- package/dist/types/markdown/renderer.d.ts.map +1 -0
- package/dist/types/markdown/types.d.ts +367 -0
- package/dist/types/markdown/types.d.ts.map +1 -0
- package/dist/types/markdown/utils.d.ts +141 -0
- package/dist/types/markdown/utils.d.ts.map +1 -0
- package/dist/types/messageFormat/ICU.d.ts.map +1 -1
- package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
- package/dist/types/transpiler/html/getHTMLCustomComponents.d.ts +9 -0
- package/dist/types/transpiler/html/getHTMLCustomComponents.d.ts.map +1 -0
- package/dist/types/transpiler/html/index.d.ts +33 -0
- package/dist/types/transpiler/html/index.d.ts.map +1 -0
- package/dist/types/transpiler/index.d.ts +2 -1
- package/dist/types/utils/intl.d.ts +21 -2
- package/dist/types/utils/intl.d.ts.map +1 -1
- package/package.json +15 -7
package/dist/esm/utils/intl.mjs
CHANGED
|
@@ -18,11 +18,17 @@ const createCachedConstructor = (Ctor) => {
|
|
|
18
18
|
const cache = /* @__PURE__ */ new Map();
|
|
19
19
|
const MAX_CACHE_SIZE = 50;
|
|
20
20
|
function Wrapped(locales, options) {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
let resolvedLocales = locales;
|
|
22
|
+
let resolvedOptions = options;
|
|
23
|
+
if (typeof locales === "object" && !Array.isArray(locales) && locales !== null) {
|
|
24
|
+
resolvedOptions = locales;
|
|
25
|
+
resolvedLocales = locales.locale;
|
|
26
|
+
}
|
|
27
|
+
if (Ctor.name === "DisplayNames" && typeof Intl?.DisplayNames !== "function") {}
|
|
28
|
+
const key = getCacheKey(resolvedLocales, resolvedOptions);
|
|
23
29
|
let instance = cache.get(key);
|
|
24
30
|
if (instance) return instance;
|
|
25
|
-
instance = new Ctor(
|
|
31
|
+
instance = new Ctor(resolvedLocales, resolvedOptions);
|
|
26
32
|
if (cache.size >= MAX_CACHE_SIZE) {
|
|
27
33
|
const oldestKey = cache.keys().next().value;
|
|
28
34
|
if (oldestKey) cache.delete(oldestKey);
|
|
@@ -50,7 +56,32 @@ const createCachedIntl = () => {
|
|
|
50
56
|
} });
|
|
51
57
|
};
|
|
52
58
|
const CachedIntl = createCachedIntl();
|
|
59
|
+
/**
|
|
60
|
+
* Creates a proxied Intl object with a preset locale.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const intl = bindIntl(Locales.FRENCH);
|
|
64
|
+
* new intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' }).format(10);
|
|
65
|
+
* // Uses 'fr' automatically
|
|
66
|
+
*/
|
|
67
|
+
const bindIntl = (locale) => {
|
|
68
|
+
return new Proxy(CachedIntl, { get: (target, prop) => {
|
|
69
|
+
const value = Reflect.get(target, prop);
|
|
70
|
+
if (typeof value === "function" && typeof prop === "string" && /^[A-Z]/.test(prop)) return new Proxy(value, {
|
|
71
|
+
construct: (Ctor, args) => {
|
|
72
|
+
let [locales, options] = args;
|
|
73
|
+
if (typeof locales === "object" && !Array.isArray(locales) && locales !== null) {
|
|
74
|
+
options = locales;
|
|
75
|
+
locales = options.locale ?? locale;
|
|
76
|
+
} else if (locales === void 0) locales = locale;
|
|
77
|
+
return new Ctor(locales, options);
|
|
78
|
+
},
|
|
79
|
+
get: (Ctor, key) => Reflect.get(Ctor, key)
|
|
80
|
+
});
|
|
81
|
+
return value;
|
|
82
|
+
} });
|
|
83
|
+
};
|
|
53
84
|
|
|
54
85
|
//#endregion
|
|
55
|
-
export { CachedIntl, CachedIntl as Intl, createCachedIntl };
|
|
86
|
+
export { CachedIntl, CachedIntl as Intl, bindIntl, createCachedIntl };
|
|
56
87
|
//# sourceMappingURL=intl.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl.mjs","names":[],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["// Cached Intl helper – drop‑in replacement for the global `Intl` object.\n// ‑‑‑\n// • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n// • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n// reuse the same heavy instance instead of reparsing CLDR data every time.\n// • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n// • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n// you can treat `CachedIntl` just like the built‑in `Intl`.\n//\n// Usage examples:\n// ---------------\n// import { CachedIntl } from \"./cached-intl\";\n//\n// const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n// console.log(nf.format(1234));\n//\n// const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n// console.log(dn.of(\"en\")); // → \"anglais\"\n//\n// You can also spin up an isolated instance with its own caches (handy in test suites):\n// const TestIntl = createCachedIntl();\n//\n// ---------------------------------------------------------------------\n\nimport { Locales, type LocalesValues } from '@intlayer/types';\n\n// Helper type that picks just the constructor members off `typeof Intl`.\n// The \"capital‑letter\" heuristic is 100 % accurate today and keeps the\n// mapping short‑lived, so we don't have to manually list every constructor.\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\n// Type wrapper to replace locale arguments with LocalesValues\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? new (\n locales?: LocalesValues,\n options?: Options\n ) => Instance\n : T extends new (\n locales: any\n ) => infer Instance\n ? new (\n locales?: LocalesValues\n ) => Instance\n : T;\n\n// Wrapped Intl type with LocalesValues\ntype WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n// ... (Keep your Type Helper definitions here: IntlConstructors, ReplaceLocaleWithLocalesValues, WrappedIntl) ...\n\n/**\n * Optimized Cache Key Generator\n * 1. Fast path: If no options, just use the locale string.\n * 2. Normal path: JSON.stringify for deterministic object comparison.\n */\nconst getCacheKey = (\n locales: LocalesValues | undefined,\n options: unknown\n): string => {\n const localeKey = locales ? String(locales) : Locales.ENGLISH;\n\n if (!options) return localeKey;\n\n // JSON.stringify is the most robust way to handle nested options objects\n // without a heavy custom hashing function.\n return `${localeKey}|${JSON.stringify(options)}`;\n};\n\n/**\n * Generic wrapper for any `new Intl.*()` constructor.\n */\nconst createCachedConstructor = <T extends new (...args: any[]) => any>(\n Ctor: T\n) => {\n // The cache lives here, inside the closure of the wrapped constructor.\n const cache = new Map<string, InstanceType<T>>();\n const MAX_CACHE_SIZE = 50;\n\n function Wrapped(locales?: LocalesValues, options?: any) {\n // 1. Handle DisplayNames Polyfill warning (Keep your existing logic here)\n if (\n Ctor.name === 'DisplayNames' &&\n typeof (Intl as any)?.DisplayNames !== 'function'\n ) {\n // ... (Your existing polyfill warning logic) ...\n return locales as any;\n }\n\n // 2. Generate Key\n const key = getCacheKey(locales, options);\n\n // 3. Check Cache\n let instance = cache.get(key);\n if (instance) return instance;\n\n // 4. Create New Instance\n instance = new Ctor(locales as never, options as never);\n\n // 5. Smart Eviction (LRU-ish)\n // Map iterates in insertion order. Deleting the first key removes the \"oldest\".\n if (cache.size >= MAX_CACHE_SIZE) {\n const oldestKey = cache.keys().next().value;\n if (oldestKey) cache.delete(oldestKey);\n }\n\n cache.set(key, instance as InstanceType<T>);\n return instance as InstanceType<T>;\n }\n\n // Preserve prototype for `instanceof` checks\n (Wrapped as any).prototype = (Ctor as any).prototype;\n\n return Wrapped as unknown as ReplaceLocaleWithLocalesValues<T>;\n};\n\n/**\n * Factory that turns the global `Intl` into a cached clone.\n */\nexport const createCachedIntl = (): WrappedIntl => {\n // 🔥 CRITICAL OPTIMIZATION:\n // We must cache the *wrapped constructors* themselves.\n // Otherwise, the Proxy creates a new `Wrapped` function (and a new empty Map)\n // on every single property access.\n const constructorCache = new Map<string | symbol, any>();\n\n return new Proxy(Intl as IntlConstructors, {\n get: (target, prop, receiver) => {\n // 1. Fast return if we already wrapped this constructor\n if (constructorCache.has(prop)) {\n return constructorCache.get(prop);\n }\n\n const value = Reflect.get(target, prop, receiver);\n\n // 2. Wrap only Constructors (Heuristic: Function + starts with Uppercase)\n // This prevents wrapping static methods like `Intl.getCanonicalLocales`\n if (\n typeof value === 'function' &&\n typeof prop === 'string' &&\n /^[A-Z]/.test(prop)\n ) {\n const wrapped = createCachedConstructor(value);\n constructorCache.set(prop, wrapped);\n return wrapped;\n }\n\n // 3. Pass through everything else (static methods, constants)\n return value;\n },\n }) as unknown as WrappedIntl;\n};\n\nexport const CachedIntl = createCachedIntl();\n\n// new CachedIntl.DisplayNames(Locales.FRENCH, { type: 'language' });\n// new CachedIntl.DisplayNames('fr', { type: 'language' });\n// new CachedIntl.DateTimeFormat('fr', {\n// year: 'numeric',\n// month: 'long',\n// day: 'numeric',\n// });\n// new CachedIntl.NumberFormat('fr', {\n// style: 'currency',\n// currency: 'EUR',\n// });\n// new CachedIntl.Collator('fr', { sensitivity: 'base' });\n// new CachedIntl.PluralRules('fr');\n// new CachedIntl.RelativeTimeFormat('fr', { numeric: 'auto' });\n// new CachedIntl.ListFormat('fr', { type: 'conjunction' });\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;AAoEA,MAAM,eACJ,SACA,YACW;CACX,MAAM,YAAY,UAAU,OAAO,QAAQ,GAAG,QAAQ;AAEtD,KAAI,CAAC,QAAS,QAAO;AAIrB,QAAO,GAAG,UAAU,GAAG,KAAK,UAAU,QAAQ;;;;;AAMhD,MAAM,2BACJ,SACG;CAEH,MAAM,wBAAQ,IAAI,KAA8B;CAChD,MAAM,iBAAiB;CAEvB,SAAS,QAAQ,SAAyB,SAAe;AAEvD,MACE,KAAK,SAAS,kBACd,OAAQ,MAAc,iBAAiB,WAGvC,QAAO;EAIT,MAAM,MAAM,YAAY,SAAS,QAAQ;EAGzC,IAAI,WAAW,MAAM,IAAI,IAAI;AAC7B,MAAI,SAAU,QAAO;AAGrB,aAAW,IAAI,KAAK,SAAkB,QAAiB;AAIvD,MAAI,MAAM,QAAQ,gBAAgB;GAChC,MAAM,YAAY,MAAM,MAAM,CAAC,MAAM,CAAC;AACtC,OAAI,UAAW,OAAM,OAAO,UAAU;;AAGxC,QAAM,IAAI,KAAK,SAA4B;AAC3C,SAAO;;AAIT,CAAC,QAAgB,YAAa,KAAa;AAE3C,QAAO;;;;;AAMT,MAAa,yBAAsC;CAKjD,MAAM,mCAAmB,IAAI,KAA2B;AAExD,QAAO,IAAI,MAAM,MAA0B,EACzC,MAAM,QAAQ,MAAM,aAAa;AAE/B,MAAI,iBAAiB,IAAI,KAAK,CAC5B,QAAO,iBAAiB,IAAI,KAAK;EAGnC,MAAM,QAAQ,QAAQ,IAAI,QAAQ,MAAM,SAAS;AAIjD,MACE,OAAO,UAAU,cACjB,OAAO,SAAS,YAChB,SAAS,KAAK,KAAK,EACnB;GACA,MAAM,UAAU,wBAAwB,MAAM;AAC9C,oBAAiB,IAAI,MAAM,QAAQ;AACnC,UAAO;;AAIT,SAAO;IAEV,CAAC;;AAGJ,MAAa,aAAa,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"intl.mjs","names":[],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["// Cached Intl helper – drop‑in replacement for the global `Intl` object.\n// ‑‑‑\n// • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n// • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n// reuse the same heavy instance instead of reparsing CLDR data every time.\n// • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n// • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n// you can treat `CachedIntl` just like the built‑in `Intl`.\n//\n// Usage examples:\n// ---------------\n// import { CachedIntl } from \"./cached-intl\";\n//\n// const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n// console.log(nf.format(1234));\n//\n// const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n// console.log(dn.of(\"en\")); // → \"anglais\"\n//\n// You can also spin up an isolated instance with its own caches (handy in test suites):\n// const TestIntl = createCachedIntl();\n//\n// ---------------------------------------------------------------------\n\nimport { Locales, type LocalesValues } from '@intlayer/types';\n\n// Helper type that picks just the constructor members off `typeof Intl`.\n// The \"capital‑letter\" heuristic is 100 % accurate today and keeps the\n// mapping short‑lived, so we don't have to manually list every constructor.\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\n// Type wrapper to replace locale arguments with LocalesValues\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\n// Wrapped Intl type with LocalesValues\ntype WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n// ... (Keep your Type Helper definitions here: IntlConstructors, ReplaceLocaleWithLocalesValues, WrappedIntl) ...\n\n/**\n * Optimized Cache Key Generator\n * 1. Fast path: If no options, just use the locale string.\n * 2. Normal path: JSON.stringify for deterministic object comparison.\n */\nconst getCacheKey = (\n locales: LocalesValues | undefined,\n options: unknown\n): string => {\n const localeKey = locales ? String(locales) : Locales.ENGLISH;\n\n if (!options) return localeKey;\n\n // JSON.stringify is the most robust way to handle nested options objects\n // without a heavy custom hashing function.\n return `${localeKey}|${JSON.stringify(options)}`;\n};\n\n/**\n * Generic wrapper for any `new Intl.*()` constructor.\n */\nconst createCachedConstructor = <T extends new (...args: any[]) => any>(\n Ctor: T\n) => {\n // The cache lives here, inside the closure of the wrapped constructor.\n const cache = new Map<string, InstanceType<T>>();\n const MAX_CACHE_SIZE = 50;\n\n function Wrapped(locales?: LocalesValues | any, options?: any) {\n let resolvedLocales = locales;\n let resolvedOptions = options;\n\n // Handle case where first argument is an options object instead of locales\n if (\n typeof locales === 'object' &&\n !Array.isArray(locales) &&\n locales !== null\n ) {\n resolvedOptions = locales;\n resolvedLocales = locales.locale;\n }\n\n // Handle DisplayNames Polyfill warning\n if (\n Ctor.name === 'DisplayNames' &&\n typeof (Intl as any)?.DisplayNames !== 'function'\n ) {\n // ... (Existing polyfill logic would go here if needed, but let's keep it simple for now as it was empty in the read output)\n // Actually the read output had \"// ... (Your existing polyfill warning logic) ...\"\n // I should check what was there before or just preserve it.\n }\n\n // Generate Key\n const key = getCacheKey(resolvedLocales, resolvedOptions);\n\n // Check Cache\n let instance = cache.get(key);\n if (instance) return instance;\n\n // Create New Instance\n instance = new Ctor(resolvedLocales as never, resolvedOptions as never);\n\n // Smart Eviction (LRU-ish)\n // Map iterates in insertion order. Deleting the first key removes the \"oldest\".\n if (cache.size >= MAX_CACHE_SIZE) {\n const oldestKey = cache.keys().next().value;\n if (oldestKey) cache.delete(oldestKey);\n }\n\n cache.set(key, instance as InstanceType<T>);\n return instance as InstanceType<T>;\n }\n\n // Preserve prototype for `instanceof` checks\n (Wrapped as any).prototype = (Ctor as any).prototype;\n\n return Wrapped as unknown as ReplaceLocaleWithLocalesValues<T>;\n};\n\n/**\n * Factory that turns the global `Intl` into a cached clone.\n */\nexport const createCachedIntl = (): WrappedIntl => {\n // We must cache the *wrapped constructors* themselves.\n // Otherwise, the Proxy creates a new `Wrapped` function (and a new empty Map)\n // on every single property access.\n const constructorCache = new Map<string | symbol, any>();\n\n return new Proxy(Intl as IntlConstructors, {\n get: (target, prop, receiver) => {\n // Fast return if we already wrapped this constructor\n if (constructorCache.has(prop)) {\n return constructorCache.get(prop);\n }\n\n const value = Reflect.get(target, prop, receiver);\n\n // Wrap only Constructors (Heuristic: Function + starts with Uppercase)\n // This prevents wrapping static methods like `Intl.getCanonicalLocales`\n if (\n typeof value === 'function' &&\n typeof prop === 'string' &&\n /^[A-Z]/.test(prop)\n ) {\n const wrapped = createCachedConstructor(value);\n constructorCache.set(prop, wrapped);\n return wrapped;\n }\n\n // Pass through everything else (static methods, constants)\n return value;\n },\n }) as unknown as WrappedIntl;\n};\n\nexport const CachedIntl = createCachedIntl();\n\n/**\n * Creates a proxied Intl object with a preset locale.\n *\n * @example\n * const intl = bindIntl(Locales.FRENCH);\n * new intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' }).format(10);\n * // Uses 'fr' automatically\n */\nexport const bindIntl = (locale: LocalesValues): WrappedIntl => {\n return new Proxy(CachedIntl, {\n get: (target, prop) => {\n const value = Reflect.get(target, prop);\n\n // We only want to intercept Constructors (e.g., NumberFormat, DateTimeFormat)\n // to inject the locale into their arguments.\n if (\n typeof value === 'function' &&\n typeof prop === 'string' &&\n /^[A-Z]/.test(prop)\n ) {\n return new Proxy(value, {\n construct: (Ctor, args) => {\n let [locales, options] = args;\n\n // If the user provided a locale (args[0]), respect it.\n // If args[0] is undefined, inject the bound locale.\n // If args[0] is an object (not array), it's the options object.\n if (\n typeof locales === 'object' &&\n !Array.isArray(locales) &&\n locales !== null\n ) {\n options = locales;\n locales = options.locale ?? locale;\n } else if (locales === undefined) {\n locales = locale;\n }\n\n // We pass it to `CachedIntl` which handles caching logic.\n return new Ctor(locales, options);\n },\n // Ensure static methods (like supportedLocalesOf) still work\n get: (Ctor, key) => Reflect.get(Ctor, key),\n });\n }\n\n // Return constants or static methods as-is\n return value;\n },\n }) as unknown as WrappedIntl;\n};\n\n// new CachedIntl.DisplayNames(Locales.FRENCH, { type: 'language' });\n// new CachedIntl.DisplayNames('fr', { type: 'language' });\n// new CachedIntl.DateTimeFormat('fr', {\n// year: 'numeric',\n// month: 'long',\n// day: 'numeric',\n// });\n// new CachedIntl.NumberFormat('fr', {\n// style: 'currency',\n// currency: 'EUR',\n// });\n// new CachedIntl.Collator('fr', { sensitivity: 'base' });\n// new CachedIntl.PluralRules('fr');\n// new CachedIntl.RelativeTimeFormat('fr', { numeric: 'auto' });\n// new CachedIntl.ListFormat('fr', { type: 'conjunction' });\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;AAqEA,MAAM,eACJ,SACA,YACW;CACX,MAAM,YAAY,UAAU,OAAO,QAAQ,GAAG,QAAQ;AAEtD,KAAI,CAAC,QAAS,QAAO;AAIrB,QAAO,GAAG,UAAU,GAAG,KAAK,UAAU,QAAQ;;;;;AAMhD,MAAM,2BACJ,SACG;CAEH,MAAM,wBAAQ,IAAI,KAA8B;CAChD,MAAM,iBAAiB;CAEvB,SAAS,QAAQ,SAA+B,SAAe;EAC7D,IAAI,kBAAkB;EACtB,IAAI,kBAAkB;AAGtB,MACE,OAAO,YAAY,YACnB,CAAC,MAAM,QAAQ,QAAQ,IACvB,YAAY,MACZ;AACA,qBAAkB;AAClB,qBAAkB,QAAQ;;AAI5B,MACE,KAAK,SAAS,kBACd,OAAQ,MAAc,iBAAiB,YACvC;EAOF,MAAM,MAAM,YAAY,iBAAiB,gBAAgB;EAGzD,IAAI,WAAW,MAAM,IAAI,IAAI;AAC7B,MAAI,SAAU,QAAO;AAGrB,aAAW,IAAI,KAAK,iBAA0B,gBAAyB;AAIvE,MAAI,MAAM,QAAQ,gBAAgB;GAChC,MAAM,YAAY,MAAM,MAAM,CAAC,MAAM,CAAC;AACtC,OAAI,UAAW,OAAM,OAAO,UAAU;;AAGxC,QAAM,IAA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layer/types";
|
|
4
4
|
import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
|
|
@@ -23,13 +23,13 @@ declare const filterMissingTranslationsOnlyPlugin: (localeToCheck: LocalesValues
|
|
|
23
23
|
declare const getFilterMissingTranslationsContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, localeToCheck: L, nodeProps: NodeProps) => any;
|
|
24
24
|
declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
|
|
25
25
|
content: any;
|
|
26
|
-
$schema?:
|
|
27
|
-
id?:
|
|
26
|
+
$schema?: "https://intlayer.org/schema.json";
|
|
27
|
+
id?: _intlayer_types0.DictionaryId;
|
|
28
28
|
projectIds?: string[];
|
|
29
|
-
localId?:
|
|
30
|
-
localIds?:
|
|
31
|
-
format?:
|
|
32
|
-
key:
|
|
29
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
30
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
31
|
+
format?: _intlayer_types0.DictionaryFormat;
|
|
32
|
+
key: _intlayer_types0.DictionaryKey;
|
|
33
33
|
title?: string;
|
|
34
34
|
description?: string;
|
|
35
35
|
versions?: string[];
|
|
@@ -37,11 +37,12 @@ declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, l
|
|
|
37
37
|
filePath?: string;
|
|
38
38
|
tags?: string[];
|
|
39
39
|
locale?: LocalesValues;
|
|
40
|
-
fill?:
|
|
40
|
+
fill?: _intlayer_types0.Fill;
|
|
41
41
|
filled?: true;
|
|
42
42
|
priority?: number;
|
|
43
|
-
|
|
44
|
-
location?:
|
|
43
|
+
importMode?: "static" | "dynamic" | "live";
|
|
44
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
45
|
+
schema: undefined;
|
|
45
46
|
};
|
|
46
47
|
//#endregion
|
|
47
48
|
export { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeepTransformContent, NodeProps, Plugins } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types6 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, DeclaredLocales, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts
|
|
@@ -15,13 +15,13 @@ declare const filterTranslationsOnlyPlugin: (locale: LocalesValues, fallback?: L
|
|
|
15
15
|
declare const getFilterTranslationsOnlyContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
16
16
|
declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, locale?: LocalesValues, fallback?: LocalesValues) => {
|
|
17
17
|
content: any;
|
|
18
|
-
$schema?:
|
|
19
|
-
id?:
|
|
18
|
+
$schema?: "https://intlayer.org/schema.json";
|
|
19
|
+
id?: _intlayer_types6.DictionaryId;
|
|
20
20
|
projectIds?: string[];
|
|
21
|
-
localId?:
|
|
22
|
-
localIds?:
|
|
23
|
-
format?:
|
|
24
|
-
key:
|
|
21
|
+
localId?: _intlayer_types6.LocalDictionaryId;
|
|
22
|
+
localIds?: _intlayer_types6.LocalDictionaryId[];
|
|
23
|
+
format?: _intlayer_types6.DictionaryFormat;
|
|
24
|
+
key: _intlayer_types6.DictionaryKey;
|
|
25
25
|
title?: string;
|
|
26
26
|
description?: string;
|
|
27
27
|
versions?: string[];
|
|
@@ -29,11 +29,12 @@ declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, loca
|
|
|
29
29
|
filePath?: string;
|
|
30
30
|
tags?: string[];
|
|
31
31
|
locale?: LocalesValues;
|
|
32
|
-
fill?:
|
|
32
|
+
fill?: _intlayer_types6.Fill;
|
|
33
33
|
filled?: true;
|
|
34
34
|
priority?: number;
|
|
35
|
-
|
|
36
|
-
location?:
|
|
35
|
+
importMode?: "static" | "dynamic" | "live";
|
|
36
|
+
location?: _intlayer_types6.DictionaryLocation;
|
|
37
|
+
schema: undefined;
|
|
37
38
|
};
|
|
38
39
|
//#endregion
|
|
39
40
|
export { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAoCa,uCACH,0BACG,kBACV;;AAHH;;;;;AAuFa,cAAA,gCAkBZ,EAAA,CAAA,UAjBW,WAiBX,EAAA,UAhBW,aAgBX,GAhB2B,eAgB3B,CAAA,CAAA,IAAA,EAdO,CAcP,EAAA,MAAA,EAbS,CAaT,EAAA,SAAA,EAZY,SAYZ,EAAA,QAAA,CAAA,EAXY,aAWZ,EAAA,GADO,oBACP,CAD4B,CAC5B,CAAA;AAjBW,cAmBC,mCAnBD,EAAA,CAAA,UAAA,EAoBE,UApBF,EAAA,MAAA,CAAA,EAqBF,aArBE,EAAA,QAAA,CAAA,EAuBC,aAvBD,EAAA,GAAA;EACA,OAAA,EAAA,GAAA;EAAgB,OAAA,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"getFilterTranslationsOnlyContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":[],"mappings":";;;;;;;cAoCa,uCACH,0BACG,kBACV;;AAHH;;;;;AAuFa,cAAA,gCAkBZ,EAAA,CAAA,UAjBW,WAiBX,EAAA,UAhBW,aAgBX,GAhB2B,eAgB3B,CAAA,CAAA,IAAA,EAdO,CAcP,EAAA,MAAA,EAbS,CAaT,EAAA,SAAA,EAZY,SAYZ,EAAA,QAAA,CAAA,EAXY,aAWZ,EAAA,GADO,oBACP,CAD4B,CAC5B,CAAA;AAjBW,cAmBC,mCAnBD,EAAA,CAAA,UAAA,EAoBE,UApBF,EAAA,MAAA,CAAA,EAqBF,aArBE,EAAA,QAAA,CAAA,EAuBC,aAvBD,EAAA,GAAA;EACA,OAAA,EAAA,GAAA;EAAgB,OAAA,CAAA,EAAA,kCAAA;EAEpB,EAAA,CAAA,EAoBkB,gBAAA,CAAA,YApBlB;EACE,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,oCAAA;EACA,QAAA,CAAA,sCAAA;EAUgB,MAAA,CAAA,mCAAA;EAArB,GAAA,gCAAA;EAAoB,KAAA,CAAA,EAAA,MAAA;EAGf,WAAA,CAAA,EAAA,MAAA;EACC,QAAA,CAAA,EAAA,MAAA,EAAA;EACJ,OAAA,CAAA,EAAA,MAAA;EAEG,QAAA,CAAA,EAAA,MAAA;EAAa,IAAA,CAAA,EAAA,MAAA,EAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { NodeProps } from "../interpreter/getContent/plugins.js";
|
|
2
2
|
import "../interpreter/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _intlayer_types13 from "@intlayer/types";
|
|
4
4
|
import { ContentNode, Dictionary, LocalesValues } from "@intlayer/types";
|
|
5
5
|
|
|
6
6
|
//#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
|
|
7
7
|
declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesValues | LocalesValues[], nodeProps: NodeProps) => any;
|
|
8
8
|
declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
|
|
9
9
|
content: any;
|
|
10
|
-
$schema?:
|
|
11
|
-
id?:
|
|
10
|
+
$schema?: "https://intlayer.org/schema.json";
|
|
11
|
+
id?: _intlayer_types13.DictionaryId;
|
|
12
12
|
projectIds?: string[];
|
|
13
|
-
localId?:
|
|
14
|
-
localIds?:
|
|
15
|
-
format?:
|
|
16
|
-
key:
|
|
13
|
+
localId?: _intlayer_types13.LocalDictionaryId;
|
|
14
|
+
localIds?: _intlayer_types13.LocalDictionaryId[];
|
|
15
|
+
format?: _intlayer_types13.DictionaryFormat;
|
|
16
|
+
key: _intlayer_types13.DictionaryKey;
|
|
17
17
|
title?: string;
|
|
18
18
|
description?: string;
|
|
19
19
|
versions?: string[];
|
|
@@ -21,11 +21,12 @@ declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: Loc
|
|
|
21
21
|
filePath?: string;
|
|
22
22
|
tags?: string[];
|
|
23
23
|
locale?: LocalesValues;
|
|
24
|
-
fill?:
|
|
24
|
+
fill?: _intlayer_types13.Fill;
|
|
25
25
|
filled?: true;
|
|
26
26
|
priority?: number;
|
|
27
|
-
|
|
28
|
-
location?:
|
|
27
|
+
importMode?: "static" | "dynamic" | "live";
|
|
28
|
+
location?: _intlayer_types13.DictionaryLocation;
|
|
29
|
+
schema: undefined;
|
|
29
30
|
};
|
|
30
31
|
//#endregion
|
|
31
32
|
export { getFilteredLocalesContent, getFilteredLocalesDictionary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;;cAsCa,kCACL,sBACG,gBAAgB,4BACd;cAwBA,2CACC,oBACJ,gBAAgB;;;EA7Bb,EAAA,CAAA,EA6B0B,
|
|
1
|
+
{"version":3,"file":"getFilteredLocalesContent.d.ts","names":[],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":[],"mappings":";;;;;;cAsCa,kCACL,sBACG,gBAAgB,4BACd;cAwBA,2CACC,oBACJ,gBAAgB;;;EA7Bb,EAAA,CAAA,EA6B0B,iBAAA,CAAA,YAbtC;EAfO,UAAA,CAAA,EAAA,MAAA,EAAA;EACG,OAAA,CAAA,qCAAA;EAAgB,QAAA,CAAA,uCAAA;EACd,MAAA,CAAA,oCAAA;EAAS,GAAA,iCAAA;EAwBT,KAAA,CAAA,EAAA,MAAA;EACC,WAAA,CAAA,EAAA,MAAA;EACJ,QAAA,CAAA,EAAA,MAAA,EAAA;EAAgB,OAAA,CAAA,EAAA,MAAA;EAAa,QAAA,CAAA,EAAA,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStorageAttributes.d.ts","names":[],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":[],"mappings":";;;KAWK,WAAA;;EAAA,UAAA,EAES,IAFE,CAEG,iBAAA,EAAA,MAAA,
|
|
1
|
+
{"version":3,"file":"getStorageAttributes.d.ts","names":[],"sources":["../../src/getStorageAttributes.ts"],"sourcesContent":[],"mappings":";;;KAWK,WAAA;;EAAA,UAAA,EAES,IAFE,CAEG,iBAAA,EAAA,MAAA,GAAA,MAAD,CAAA;AAAA,CAAA;AAGE,KAAf,eAAA,GAIW;EAIJ,IAAA,EAAA,MAAA;CACD;KALN,WAAA,GAMW;EACE,IAAA,EAAA,MAAA;CACP;AAAW,KAJV,0BAAA,GAIU;EAuLT,OAAA,EA1LF,WA0LE,EAAA;gBAzLG;kBACE;WACP;;;;;;;;cAuLE,gCACF,yCACR"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ConditionContent, ConditionContentStates, cond as condition } from "./t
|
|
|
2
2
|
import { EnterFormat, EnumerationContent, EnumerationContentState, enu as enumeration } from "./transpiler/enumeration/enumeration.js";
|
|
3
3
|
import { FileContent, FileContentConstructor, file, fileContent } from "./transpiler/file/file.js";
|
|
4
4
|
import { Gender, GenderContent, GenderContentStates, gender } from "./transpiler/gender/gender.js";
|
|
5
|
+
import { HTMLContent, HTMLContentConstructor, HTMLTagDefault, HTML_TAGS, html } from "./transpiler/html/index.js";
|
|
5
6
|
import { getInsertionValues } from "./transpiler/insertion/getInsertionValues.js";
|
|
6
7
|
import { InsertionContent, InsertionContentConstructor, insert as insertion } from "./transpiler/insertion/insertion.js";
|
|
7
8
|
import { getMarkdownMetadata } from "./transpiler/markdown/getMarkdownMetadata.js";
|
|
@@ -11,11 +12,12 @@ import { TranslationContent, t as translation } from "./transpiler/translation/t
|
|
|
11
12
|
import "./transpiler/index.js";
|
|
12
13
|
import { getCondition } from "./interpreter/getCondition.js";
|
|
13
14
|
import { GetNestingResult, getNesting } from "./interpreter/getNesting.js";
|
|
14
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./interpreter/getContent/plugins.js";
|
|
15
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, HTMLCond, HTMLTagComponent, HTMLTagComponentProps, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./interpreter/getContent/plugins.js";
|
|
15
16
|
import { deepTransformNode } from "./interpreter/getContent/deepTransform.js";
|
|
16
17
|
import { getContent } from "./interpreter/getContent/getContent.js";
|
|
17
18
|
import { getDictionary } from "./interpreter/getDictionary.js";
|
|
18
19
|
import { findMatchingCondition, getEnumeration } from "./interpreter/getEnumeration.js";
|
|
20
|
+
import { getHTML } from "./interpreter/getHTML.js";
|
|
19
21
|
import { getIntlayer } from "./interpreter/getIntlayer.js";
|
|
20
22
|
import { getTranslation } from "./interpreter/getTranslation.js";
|
|
21
23
|
import "./interpreter/index.js";
|
|
@@ -69,10 +71,16 @@ import { localeFlatMap, localeMap, localeRecord } from "./localization/localeMap
|
|
|
69
71
|
import { localeResolver } from "./localization/localeResolver.js";
|
|
70
72
|
import { validatePrefix } from "./localization/validatePrefix.js";
|
|
71
73
|
import "./localization/index.js";
|
|
74
|
+
import { BlockQuoteNode, BoldTextNode, BreakLineNode, BreakThematicNode, CodeBlockNode, CodeInlineNode, CompileOptions, CustomComponentNode, ElementType, FootnoteNode, FootnoteReferenceNode, GFMTaskNode, HTMLNode, HTMLSelfClosingNode, HTMLTag, HeadingNode, ImageNode, ItalicTextNode, LinkNode, MarkdownContext, MarkdownOptions, MarkdownRuntime, MarkedTextNode, NestedParser, NewlineNode, OrderedListNode, Overrides, ParagraphNode, ParseState, ParserResult, ReferenceImageNode, ReferenceLinkNode, ReferenceNode, RenderRuleHook, Rule, RuleOutput, Rules, StrikethroughTextNode, TableNode, TableSeparatorNode, TextNode, UnorderedListNode } from "./markdown/types.js";
|
|
75
|
+
import { compile, compileWithOptions, createCompiler } from "./markdown/compiler.js";
|
|
76
|
+
import { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, ListType, NAMED_CODES_TO_UNICODE, ORDERED, Priority, PriorityValue, RuleType, RuleTypeValue, UNORDERED } from "./markdown/constants.js";
|
|
77
|
+
import { parserFor } from "./markdown/parser.js";
|
|
78
|
+
import { createRenderer, renderFor } from "./markdown/renderer.js";
|
|
79
|
+
import { allowInline, anyScopeRegex, attributeValueToNodePropValue, blockRegex, captureNothing, cx, get, inlineRegex, normalizeAttributeKey, normalizeWhitespace, parseBlock, parseCaptureInline, parseInline, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableCells, parseTableRow, qualifies, renderNothing, sanitizer, simpleInlineRegex, slugify, some, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, unquote } from "./markdown/utils.js";
|
|
72
80
|
import { checkIsURLAbsolute } from "./utils/checkIsURLAbsolute.js";
|
|
73
81
|
import { getCookie } from "./utils/getCookie.js";
|
|
74
|
-
import { CachedIntl, createCachedIntl } from "./utils/intl.js";
|
|
82
|
+
import { CachedIntl, bindIntl, createCachedIntl } from "./utils/intl.js";
|
|
75
83
|
import { isSameKeyPath } from "./utils/isSameKeyPath.js";
|
|
76
84
|
import { isValidElement } from "./utils/isValidReactElement.js";
|
|
77
85
|
import { parseYaml } from "./utils/parseYaml.js";
|
|
78
|
-
export { CachedIntl, CachedIntl as Intl, ConditionCond, ConditionContent, ConditionContentStates, DeepTransformContent, DotPath, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, GetPrefixOptions, GetPrefixResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, NestedCond, NestedContent, NestedContentState, NodeProps, Plugins, ProcessedStorageAttributes, RequestContext, TranslationCond, TranslationContent, ValidDotPathsFor, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPrefix, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren, validatePrefix };
|
|
86
|
+
export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, BlockQuoteNode, BoldTextNode, BreakLineNode, BreakThematicNode, CachedIntl, CachedIntl as Intl, CodeBlockNode, CodeInlineNode, CompileOptions, ConditionCond, ConditionContent, ConditionContentStates, CustomComponentNode, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, DeepTransformContent, DotPath, ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, FootnoteNode, FootnoteReferenceNode, GFMTaskNode, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, GetPrefixOptions, GetPrefixResult, HTMLCond, HTMLContent, HTMLContentConstructor, HTMLNode, HTMLSelfClosingNode, HTMLTag, HTMLTagComponent, HTMLTagComponentProps, HTMLTagDefault, HTML_TAGS, HeadingNode, IInterpreterPlugin, IInterpreterPluginState, ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, ItalicTextNode, LinkNode, ListType, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, MarkdownContext, MarkdownOptions, MarkdownRuntime, MarkedTextNode, NAMED_CODES_TO_UNICODE, NestedCond, NestedContent, NestedContentState, NestedParser, NewlineNode, NodeProps, ORDERED, OrderedListNode, Overrides, ParagraphNode, ParseState, ParserResult, Plugins, Priority, PriorityValue, ProcessedStorageAttributes, ReferenceImageNode, ReferenceLinkNode, ReferenceNode, RenderRuleHook, RequestContext, Rule, RuleOutput, RuleType, RuleTypeValue, Rules, StrikethroughTextNode, TableNode, TableSeparatorNode, TextNode, TranslationCond, TranslationContent, UNORDERED, UnorderedListNode, ValidDotPathsFor, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, compile, compileWithOptions, condition as cond, conditionPlugin, createCachedIntl, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, get, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPrefix, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, html, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseInline, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableCells, parseTableRow, parseYaml, parserFor, percentage, qualifies, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderNothing, sanitizer, setLocaleInStorage, simpleInlineRegex, slugify, some, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validatePrefix };
|
|
@@ -9,7 +9,7 @@ import { ContentNode, DeclaredLocales, LocalesValues } from "@intlayer/types";
|
|
|
9
9
|
* @param node The node to transform.
|
|
10
10
|
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
11
11
|
*/
|
|
12
|
-
declare const getContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, nodeProps: NodeProps, locale?: L) => DeepTransformContent<T, IInterpreterPluginState, L>;
|
|
12
|
+
declare const getContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, nodeProps: NodeProps, locale?: L, fallback?: boolean) => DeepTransformContent<T, IInterpreterPluginState, L>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { getContent };
|
|
15
15
|
//# sourceMappingURL=getContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContent.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":[],"mappings":";;;;;;;AA0BA;;;;AAIQ,cAJK,UAIL,EAAA,CAAA,UAHI,WAGJ,EAAA,UAFI,aAEJ,GAFoB,eAEpB,CAAA,CAAA,IAAA,EAAA,CAAA,EAAA,SAAA,EACK,SADL,EAAA,MAAA,CAAA,EAEG,CAFH,EAAA,
|
|
1
|
+
{"version":3,"file":"getContent.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":[],"mappings":";;;;;;;AA0BA;;;;AAIQ,cAJK,UAIL,EAAA,CAAA,UAHI,WAGJ,EAAA,UAFI,aAEJ,GAFoB,eAEpB,CAAA,CAAA,IAAA,EAAA,CAAA,EAAA,SAAA,EACK,SADL,EAAA,MAAA,CAAA,EAEG,CAFH,EAAA,QAAA,CAAA,EAAA,OAAA,EAAA,GAuBA,oBAvBA,CAuBqB,CAvBrB,EAuBwB,uBAvBxB,EAuBiD,CAvBjD,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./plugins.js";
|
|
1
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, HTMLCond, HTMLTagComponent, HTMLTagComponentProps, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./plugins.js";
|
|
2
2
|
import { deepTransformNode } from "./deepTransform.js";
|
|
3
3
|
import { getContent } from "./getContent.js";
|
|
4
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, deepTransformNode, enumerationPlugin, filePlugin, genderPlugin, getContent, insertionPlugin, nestedPlugin, translationPlugin };
|
|
4
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, HTMLCond, HTMLTagComponent, HTMLTagComponentProps, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, deepTransformNode, enumerationPlugin, filePlugin, genderPlugin, getContent, insertionPlugin, nestedPlugin, translationPlugin };
|
|
@@ -9,11 +9,11 @@ import { DeclaredLocales, DictionaryKeys, KeyPath, Locale, LocalesValues, NodeTy
|
|
|
9
9
|
* PLUGIN DEFINITION
|
|
10
10
|
* --------------------------------------------- */
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* A plugin/transformer that can optionally transform a node during a single DFS pass.
|
|
13
|
+
* - `canHandle` decides if the node is transformable by this plugin.
|
|
14
|
+
* - `transform` returns the transformed node (and does not recurse further).
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* > `transformFn` is a function that can be used to deeply transform inside the plugin.
|
|
17
17
|
*/
|
|
18
18
|
type Plugins = {
|
|
19
19
|
id: string;
|
|
@@ -28,7 +28,7 @@ type TranslationCond<T, S, L extends LocalesValues> = T extends {
|
|
|
28
28
|
[NodeType.Translation]: infer U;
|
|
29
29
|
} ? U extends Record<PropertyKey, unknown> ? L extends keyof U ? DeepTransformContent<U[L], S> : DeepTransformContent<U[keyof U], S> : never : never;
|
|
30
30
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
31
|
-
declare const translationPlugin: (locale: LocalesValues, fallback?: LocalesValues
|
|
31
|
+
declare const translationPlugin: (locale: LocalesValues, fallback?: LocalesValues) => Plugins;
|
|
32
32
|
/** ---------------------------------------------
|
|
33
33
|
* ENUMERATION PLUGIN
|
|
34
34
|
* --------------------------------------------- */
|
|
@@ -61,9 +61,10 @@ declare const genderPlugin: Plugins;
|
|
|
61
61
|
* --------------------------------------------- */
|
|
62
62
|
type InsertionCond<T, S, L> = T extends {
|
|
63
63
|
nodeType: NodeType | string;
|
|
64
|
-
[NodeType.Insertion]:
|
|
65
|
-
fields
|
|
66
|
-
} ?
|
|
64
|
+
[NodeType.Insertion]: string;
|
|
65
|
+
fields: readonly string[];
|
|
66
|
+
} ? (values: { [K in T['fields'][number]]: string | number }) => DeepTransformContent<string, S> : never;
|
|
67
|
+
/** Insertion plugin. Replaces node with a function that takes quantity => string. */
|
|
67
68
|
declare const insertionPlugin: Plugins;
|
|
68
69
|
/** ---------------------------------------------
|
|
69
70
|
* NESTED PLUGIN
|
|
@@ -77,6 +78,43 @@ type NestedCond<T, S, L> = T extends {
|
|
|
77
78
|
} ? GetNestingResult<K, P, S> : never : never;
|
|
78
79
|
/** Nested plugin. Replaces node with the result of `getNesting`. */
|
|
79
80
|
declare const nestedPlugin: (locale?: LocalesValues) => Plugins;
|
|
81
|
+
/** ---------------------------------------------
|
|
82
|
+
* HTML PLUGIN
|
|
83
|
+
* --------------------------------------------- */
|
|
84
|
+
/**
|
|
85
|
+
* Props for HTML tag components.
|
|
86
|
+
* Includes children and an index signature for attributes.
|
|
87
|
+
*/
|
|
88
|
+
type HTMLTagComponentProps = {
|
|
89
|
+
children?: any;
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* A component that can be used to replace an HTML tag.
|
|
94
|
+
* Can be a string (tag name) or a functional component.
|
|
95
|
+
*/
|
|
96
|
+
type HTMLTagComponent = string | ((props: HTMLTagComponentProps) => any);
|
|
97
|
+
type HTMLCond<T, S, L> = T extends {
|
|
98
|
+
nodeType: NodeType | string;
|
|
99
|
+
[NodeType.HTML]: string;
|
|
100
|
+
customComponents?: infer U;
|
|
101
|
+
} ? {
|
|
102
|
+
use: U extends readonly string[] ? U extends readonly [] ? (components?: Partial<Record<string, HTMLTagComponent>>) => any : (components: { [K in U[number]]: HTMLTagComponent } & Partial<Record<string, HTMLTagComponent>>) => any : (components?: Record<string, HTMLTagComponent>) => any;
|
|
103
|
+
} & any : never;
|
|
104
|
+
/**
|
|
105
|
+
* Note: The `htmlPlugin` is NOT defined at the core level.
|
|
106
|
+
* Each framework (react-intlayer, vue-intlayer, svelte-intlayer, solid-intlayer)
|
|
107
|
+
* must implement their own `htmlPlugin` to provide default HTML tag components
|
|
108
|
+
* (e.g., h1, p, span, etc.) using their native element creation APIs.
|
|
109
|
+
*
|
|
110
|
+
* The framework-specific plugins should:
|
|
111
|
+
* 1. Create default components for standard HTML tags
|
|
112
|
+
* 2. Merge user-provided components with defaults (user takes priority)
|
|
113
|
+
* 3. Call `getHTML(node[NodeType.HTML], mergedComponents)`
|
|
114
|
+
*/
|
|
115
|
+
/** ---------------------------------------------
|
|
116
|
+
* FILE PLUGIN
|
|
117
|
+
* --------------------------------------------- */
|
|
80
118
|
type FileCond<T> = T extends {
|
|
81
119
|
nodeType: NodeType | string;
|
|
82
120
|
[NodeType.File]: string;
|
|
@@ -85,11 +123,11 @@ type FileCond<T> = T extends {
|
|
|
85
123
|
/** File plugin. Replaces node with the result of `getNesting`. */
|
|
86
124
|
declare const filePlugin: Plugins;
|
|
87
125
|
/**
|
|
88
|
-
*
|
|
126
|
+
* PLUGIN RESULT
|
|
89
127
|
*/
|
|
90
128
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
129
|
+
* Interface that defines the properties of a node.
|
|
130
|
+
* This interface can be augmented in other packages, such as `react-intlayer`.
|
|
93
131
|
*/
|
|
94
132
|
interface NodeProps {
|
|
95
133
|
dictionaryKey: string;
|
|
@@ -100,8 +138,8 @@ interface NodeProps {
|
|
|
100
138
|
children?: any;
|
|
101
139
|
}
|
|
102
140
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
141
|
+
* Interface that defines the plugins that can be used to transform a node.
|
|
142
|
+
* This interface can be augmented in other packages, such as `react-intlayer`.
|
|
105
143
|
*/
|
|
106
144
|
interface IInterpreterPlugin<T, S, L extends LocalesValues> {
|
|
107
145
|
translation: TranslationCond<T, S, L>;
|
|
@@ -109,9 +147,10 @@ interface IInterpreterPlugin<T, S, L extends LocalesValues> {
|
|
|
109
147
|
enumeration: EnumerationCond<T, S, L>;
|
|
110
148
|
condition: ConditionCond<T, S, L>;
|
|
111
149
|
nested: NestedCond<T, S, L>;
|
|
150
|
+
html: HTMLCond<T, S, L>;
|
|
112
151
|
}
|
|
113
152
|
/**
|
|
114
|
-
*
|
|
153
|
+
* Allow to avoid overwriting import from `intlayer` package when `IInterpreterPlugin<T>` interface is augmented in another package, such as `react-intlayer`.
|
|
115
154
|
*/
|
|
116
155
|
type IInterpreterPluginState = {
|
|
117
156
|
translation: true;
|
|
@@ -119,20 +158,21 @@ type IInterpreterPluginState = {
|
|
|
119
158
|
condition: true;
|
|
120
159
|
insertion: true;
|
|
121
160
|
nested: true;
|
|
161
|
+
html: true;
|
|
122
162
|
};
|
|
123
163
|
/**
|
|
124
|
-
*
|
|
164
|
+
* Utility type to check if a plugin can be applied to a node.
|
|
125
165
|
*/
|
|
126
166
|
type CheckApplyPlugin<T, K$1 extends keyof IInterpreterPlugin<T, S, L>, S, L extends LocalesValues = DeclaredLocales> = K$1 extends keyof S ? S[K$1] extends true ? IInterpreterPlugin<T, S, L>[K$1] extends never ? never : IInterpreterPlugin<T, S, L>[K$1] : never : never;
|
|
127
167
|
/**
|
|
128
|
-
*
|
|
168
|
+
* Traverse recursively through an object or array, applying each plugin as needed.
|
|
129
169
|
*/
|
|
130
170
|
type Traverse<T, S, L extends LocalesValues = DeclaredLocales> = T extends ReadonlyArray<infer U> ? Array<DeepTransformContent<U, S, L>> : T extends object ? { [K in keyof T]: DeepTransformContent<T[K], S, L> } : T;
|
|
131
171
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
132
172
|
/**
|
|
133
|
-
*
|
|
173
|
+
* Traverse recursively through an object or array, applying each plugin as needed.
|
|
134
174
|
*/
|
|
135
175
|
type DeepTransformContent<T, S = IInterpreterPluginState, L extends LocalesValues = DeclaredLocales> = IsAny<T> extends true ? T : CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S, L>, S> extends never ? Traverse<T, S, L> : IInterpreterPlugin<T, S, L>[keyof IInterpreterPlugin<T, S, L>];
|
|
136
176
|
//#endregion
|
|
137
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin };
|
|
177
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, HTMLCond, HTMLTagComponent, HTMLTagComponentProps, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin };
|
|
138
178
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;AAcA;;;;;;AAIc,KAlBF,OAAA,GAkBE;EACR,EAAA,EAAA,MAAA;EAAgB,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,OAAA;EACO,SAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAflB,SAekB,EAAA,WAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,KAAA,EAdO,SAcP,EAAA,GAAA,GAAA,EAAA,GAAA,GAAA;CAAE;;;;AACM,KAPzB,eAOyB,CAAA,CAAA,EAAA,CAAA,EAAA,UAPO,aAOP,CAAA,GAPwB,CAOxB,SAAA;EAAI,QAAA,EAN7B,QAM6B,GAAA,MAAA;EAAjC,CALL,QAAA,CAAS,WAAA,CAKJ,EAAA,KAAA,EAAA;CAAoB,GAAA,CAAA,SAHd,MAGc,CAHP,WAGO,EAAA,OAAA,CAAA,GAFtB,CAEsB,SAAA,MAFN,CAEM,GADpB,oBACoB,CADC,CACD,CADG,CACH,CAAA,EADO,CACP,CAAA,GAApB,oBAAoB,CAAC,CAAD,CAAA,MAAS,CAAT,CAAA,EAAa,CAAb,CAAA,GAAA,KAAA,GAAA,KAAA;AAK5B;AACU,cADG,iBACH,EAAA,CAAA,MAAA,EAAA,aAAA,EAAA,QAAA,CAAA,EACG,aADH,EAAA,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","names":[],"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;AAcA;;;;;;AAIc,KA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,GAahB,CAbgB,GAchB,gBAdgB,CAcC,CAdD,EAAA,MAcU,kBAdV,CAc6B,CAd7B,EAcgC,CAdhC,EAcmC,CAdnC,CAAA,EAcuC,CAdvC,CAAA,SAAA,KAAA,GAgBd,QAhBc,CAgBL,CAhBK,EAgBF,CAhBE,EAgBC,CAhBD,CAAA,GAkBd,kBAlBc,CAkBK,CAlBL,EAkBQ,CAlBR,EAkBW,CAlBX,CAAA,CAAA,MAkBoB,kBAlBpB,CAkBuC,CAlBvC,EAkB0C,CAlB1C,EAkB6C,CAlB7C,CAAA,CAAA"}
|
|
@@ -30,7 +30,7 @@ import "../transpiler/index.js";
|
|
|
30
30
|
*
|
|
31
31
|
* If no keys match, the default key is '1'.
|
|
32
32
|
*/
|
|
33
|
-
declare const findMatchingCondition: <Content>(enumerationContent: EnumerationContentState<Content>, quantity: number) => EnterFormat;
|
|
33
|
+
declare const findMatchingCondition: <Content>(enumerationContent: EnumerationContentState<Content>, quantity: number) => EnterFormat | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* Allow to pick a content based on a quantity.
|
|
36
36
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/interpreter/getHTML.d.ts
|
|
2
|
+
type Component = (props: any) => any;
|
|
3
|
+
type ComponentObject = {
|
|
4
|
+
tag: string;
|
|
5
|
+
props?: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
type Components = Record<string, Component | string | ComponentObject>;
|
|
8
|
+
/**
|
|
9
|
+
* Allow to interpret HTML/JSX-like strings and replace tags with components.
|
|
10
|
+
*/
|
|
11
|
+
declare const getHTML: (content: string, values: Components) => any;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getHTML };
|
|
14
|
+
//# sourceMappingURL=getHTML.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHTML.d.ts","names":[],"sources":["../../../src/interpreter/getHTML.ts"],"sourcesContent":[],"mappings":";KAAK,SAAA;KACA,eAAA,GADS;EACT,GAAA,EAAA,MAAA;EAIA,KAAA,CAAA,EAFK,MAEK,CAAA,MAAA,EAAA,GAAA,CAAA;CAAkB;KAA5B,UAAA,GAAa,MAAoC,CAAA,MAAA,EAArB,SAAqB,GAAA,MAAA,GAAA,eAAA,CAAA;;;AAsBtD;cAAa,mCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTranslation.d.ts","names":[],"sources":["../../../src/interpreter/getTranslation.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"getTranslation.d.ts","names":[],"sources":["../../../src/interpreter/getTranslation.ts"],"sourcesContent":[],"mappings":";;;;;;AAoHA;;;;;;;;;;;;;;;;;;;cAAa,oDACM,oBAAoB,kBAC7B,0BACG,kBACV"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { getCondition } from "./getCondition.js";
|
|
2
2
|
import { GetNestingResult, getNesting } from "./getNesting.js";
|
|
3
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./getContent/plugins.js";
|
|
3
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, HTMLCond, HTMLTagComponent, HTMLTagComponentProps, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, enumerationPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./getContent/plugins.js";
|
|
4
4
|
import { deepTransformNode } from "./getContent/deepTransform.js";
|
|
5
5
|
import { getContent } from "./getContent/getContent.js";
|
|
6
6
|
import "./getContent/index.js";
|
|
7
7
|
import { getDictionary } from "./getDictionary.js";
|
|
8
8
|
import { findMatchingCondition, getEnumeration } from "./getEnumeration.js";
|
|
9
|
+
import { getHTML } from "./getHTML.js";
|
|
9
10
|
import { getIntlayer } from "./getIntlayer.js";
|
|
10
11
|
import { getTranslation } from "./getTranslation.js";
|
|
11
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, deepTransformNode, enumerationPlugin, filePlugin, findMatchingCondition, genderPlugin, getCondition, getContent, getDictionary, getEnumeration, getIntlayer, getNesting, getTranslation, insertionPlugin, nestedPlugin, translationPlugin };
|
|
12
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, HTMLCond, HTMLTagComponent, HTMLTagComponentProps, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, conditionPlugin, deepTransformNode, enumerationPlugin, filePlugin, findMatchingCondition, genderPlugin, getCondition, getContent, getDictionary, getEnumeration, getHTML, getIntlayer, getNesting, getTranslation, insertionPlugin, nestedPlugin, translationPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocale.d.ts","names":[],"sources":["../../../src/localization/getLocale.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getLocale.d.ts","names":[],"sources":["../../../src/localization/getLocale.ts"],"sourcesContent":[],"mappings":";;;KAOY,cAAA;;EAAA,SAAA,CAAA,EAAA,CAAA,IAAc,EAAA,MAAA,EAAA,GAAA,MAAA,GAAA,IAAA,GAAA,SAAA;AAK1B,CAAA;AAAqC,cAAxB,SAAwB,EAAA,CAAA,GAAA,CAAA,EAAA,cAAA,EAAA,GAAsB,OAAtB,CAA8B,MAA9B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CompileOptions, MarkdownContext, MarkdownOptions, MarkdownRuntime } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/markdown/compiler.d.ts
|
|
4
|
+
|
|
5
|
+
declare const compile: (markdown: string, ctx: MarkdownContext, options?: MarkdownOptions) => unknown;
|
|
6
|
+
declare const createCompiler: (ctx: MarkdownContext) => (markdown: string, options?: MarkdownOptions) => unknown;
|
|
7
|
+
declare const compileWithOptions: (markdown: string, runtime: MarkdownRuntime, options?: CompileOptions) => unknown;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { compile, compileWithOptions, createCompiler };
|
|
10
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","names":[],"sources":["../../../src/markdown/compiler.ts"],"sourcesContent":[],"mappings":";;;;cAmgCa,iCAEN,2BACI;cA4ME,sBACL,iDACuB;cAGlB,gDAEF,2BACA"}
|