svelte-intlayer 7.1.8-canary.0 → 7.1.9-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.
Files changed (107) hide show
  1. package/dist/IntlayerNodeWrapper.svelte +10 -0
  2. package/dist/IntlayerNodeWrapper.svelte.d.ts +22 -0
  3. package/dist/client/IntlayerProvider.svelte +24 -0
  4. package/dist/client/IntlayerProvider.svelte.d.ts +30 -0
  5. package/dist/{types/client → client}/getBrowserLocale.d.ts +1 -1
  6. package/dist/client/getBrowserLocale.js +17 -0
  7. package/dist/client/index.js +12 -0
  8. package/dist/{types/client → client}/intlayerContext.d.ts +2 -1
  9. package/dist/client/intlayerContext.js +8 -0
  10. package/dist/client/intlayerStore.d.ts +11 -0
  11. package/dist/client/intlayerStore.js +19 -0
  12. package/dist/{types/client → client}/useDictionary.d.ts +3 -3
  13. package/dist/client/useDictionary.js +18 -0
  14. package/dist/{types/client → client}/useDictionaryAsync.d.ts +2 -2
  15. package/dist/client/useDictionaryAsync.js +38 -0
  16. package/dist/{types/client → client}/useDictionaryDynamic.d.ts +2 -2
  17. package/dist/client/useDictionaryDynamic.js +38 -0
  18. package/dist/{types/client → client}/useIntlayer.d.ts +4 -3
  19. package/dist/client/useIntlayer.js +18 -0
  20. package/dist/client/useLocale.d.ts +16 -0
  21. package/dist/client/useLocale.js +33 -0
  22. package/dist/client/useLocaleStorage.d.ts +39 -0
  23. package/dist/client/useLocaleStorage.js +52 -0
  24. package/dist/editor/ContentSelector.svelte +125 -0
  25. package/dist/editor/ContentSelector.svelte.d.ts +35 -0
  26. package/dist/editor/ContentSelectorWrapper.svelte +69 -0
  27. package/dist/editor/ContentSelectorWrapper.svelte.d.ts +31 -0
  28. package/dist/editor/communicator.d.ts +9 -0
  29. package/dist/editor/communicator.js +54 -0
  30. package/dist/editor/dictionariesRecord.d.ts +5 -0
  31. package/dist/editor/dictionariesRecord.js +16 -0
  32. package/dist/editor/editorEnabled.d.ts +14 -0
  33. package/dist/editor/editorEnabled.js +41 -0
  34. package/dist/editor/focusDictionary.d.ts +15 -0
  35. package/dist/editor/focusDictionary.js +22 -0
  36. package/dist/editor/index.d.ts +9 -0
  37. package/dist/editor/index.js +9 -0
  38. package/dist/editor/useCrossFrameMessageListener.d.ts +2 -0
  39. package/dist/editor/useCrossFrameMessageListener.js +65 -0
  40. package/dist/editor/useCrossFrameState.d.ts +7 -0
  41. package/dist/editor/useCrossFrameState.js +82 -0
  42. package/dist/editor/useEditor.d.ts +1 -0
  43. package/dist/editor/useEditor.js +46 -0
  44. package/dist/editor/useIframeClickInterceptor.d.ts +2 -0
  45. package/dist/editor/useIframeClickInterceptor.js +29 -0
  46. package/dist/{types/getDictionary.d.ts → getDictionary.d.ts} +3 -3
  47. package/dist/getDictionary.js +18 -0
  48. package/dist/{types/getIntlayer.d.ts → getIntlayer.d.ts} +3 -3
  49. package/dist/getIntlayer.js +18 -0
  50. package/dist/{types/index.d.ts → index.d.ts} +4 -2
  51. package/dist/index.js +7 -0
  52. package/dist/index.test.d.ts +1 -0
  53. package/dist/index.test.js +6 -0
  54. package/dist/markdown/MarkdownMetadataRenderer.svelte +21 -0
  55. package/dist/markdown/MarkdownMetadataRenderer.svelte.d.ts +25 -0
  56. package/dist/markdown/MarkdownMetadataWithSelector.svelte +21 -0
  57. package/dist/markdown/MarkdownMetadataWithSelector.svelte.d.ts +24 -0
  58. package/dist/markdown/MarkdownProvider.svelte +9 -0
  59. package/dist/markdown/MarkdownProvider.svelte.d.ts +29 -0
  60. package/dist/markdown/MarkdownRenderer.svelte +11 -0
  61. package/dist/markdown/MarkdownRenderer.svelte.d.ts +20 -0
  62. package/dist/markdown/MarkdownWithSelector.svelte +15 -0
  63. package/dist/markdown/MarkdownWithSelector.svelte.d.ts +23 -0
  64. package/dist/markdown/context.d.ts +6 -0
  65. package/dist/markdown/context.js +10 -0
  66. package/dist/markdown/index.d.ts +4 -0
  67. package/dist/markdown/index.js +4 -0
  68. package/dist/plugins.d.ts +42 -0
  69. package/dist/plugins.js +87 -0
  70. package/dist/renderIntlayerNode.d.ts +13 -0
  71. package/dist/renderIntlayerNode.js +44 -0
  72. package/dist/setIntlayerMarkdown.d.ts +1 -0
  73. package/dist/setIntlayerMarkdown.js +2 -0
  74. package/package.json +22 -29
  75. package/dist/cjs/client/getBrowserLocale.cjs +0 -1
  76. package/dist/cjs/client/index.cjs +0 -1
  77. package/dist/cjs/client/intlayerContext.cjs +0 -1
  78. package/dist/cjs/client/intlayerStore.cjs +0 -1
  79. package/dist/cjs/client/useDictionary.cjs +0 -1
  80. package/dist/cjs/client/useDictionaryAsync.cjs +0 -1
  81. package/dist/cjs/client/useDictionaryDynamic.cjs +0 -1
  82. package/dist/cjs/client/useIntlayer.cjs +0 -1
  83. package/dist/cjs/client/useLocale.cjs +0 -1
  84. package/dist/cjs/getDictionary.cjs +0 -1
  85. package/dist/cjs/getIntlayer.cjs +0 -1
  86. package/dist/cjs/index.cjs +0 -1
  87. package/dist/cjs/markdown/index.cjs +0 -1
  88. package/dist/cjs/plugins.cjs +0 -1
  89. package/dist/esm/client/getBrowserLocale.mjs +0 -9
  90. package/dist/esm/client/index.mjs +0 -19
  91. package/dist/esm/client/intlayerContext.mjs +0 -8
  92. package/dist/esm/client/intlayerStore.mjs +0 -16
  93. package/dist/esm/client/useDictionary.mjs +0 -14
  94. package/dist/esm/client/useDictionaryAsync.mjs +0 -27
  95. package/dist/esm/client/useDictionaryDynamic.mjs +0 -27
  96. package/dist/esm/client/useIntlayer.mjs +0 -14
  97. package/dist/esm/client/useLocale.mjs +0 -22
  98. package/dist/esm/getDictionary.mjs +0 -18
  99. package/dist/esm/getIntlayer.mjs +0 -14
  100. package/dist/esm/index.mjs +0 -30
  101. package/dist/esm/markdown/index.mjs +0 -10
  102. package/dist/esm/plugins.mjs +0 -18
  103. package/dist/types/client/intlayerStore.d.ts +0 -11
  104. package/dist/types/client/useLocale.d.ts +0 -15
  105. package/dist/types/markdown/index.d.ts +0 -27
  106. package/dist/types/plugins.d.ts +0 -27
  107. /package/dist/{types/client → client}/index.d.ts +0 -0
@@ -1,19 +0,0 @@
1
- import { getBrowserLocale as o } from "./getBrowserLocale.mjs";
2
- import { getIntlayerContext as n, setIntlayerContext as a } from "./intlayerContext.mjs";
3
- import { intlayerStore as m } from "./intlayerStore.mjs";
4
- import { useDictionary as f } from "./useDictionary.mjs";
5
- import { useDictionaryAsync as p } from "./useDictionaryAsync.mjs";
6
- import { useDictionaryDynamic as c } from "./useDictionaryDynamic.mjs";
7
- import { useIntlayer as u } from "./useIntlayer.mjs";
8
- import { useLocale as I } from "./useLocale.mjs";
9
- export {
10
- o as getBrowserLocale,
11
- n as getIntlayerContext,
12
- m as intlayerStore,
13
- a as setIntlayerContext,
14
- f as useDictionary,
15
- p as useDictionaryAsync,
16
- c as useDictionaryDynamic,
17
- u as useIntlayer,
18
- I as useLocale
19
- };
@@ -1,8 +0,0 @@
1
- import { getContext as n, setContext as o } from "svelte";
2
- const t = Symbol("intlayer"), s = (e) => {
3
- o(t, e);
4
- }, x = () => n(t);
5
- export {
6
- x as getIntlayerContext,
7
- s as setIntlayerContext
8
- };
@@ -1,16 +0,0 @@
1
- import { writable as a, derived as c } from "svelte/store";
2
- const n = () => {
3
- const { subscribe: t, set: r, update: o } = a({
4
- locale: "en"
5
- // Default locale
6
- });
7
- return {
8
- subscribe: t,
9
- setLocale: (e) => o((l) => ({ ...l, locale: e })),
10
- getLocale: () => c({ subscribe: t }, (e) => e.locale),
11
- reset: () => r({ locale: "en" })
12
- };
13
- }, i = n();
14
- export {
15
- i as intlayerStore
16
- };
@@ -1,14 +0,0 @@
1
- import { derived as i } from "svelte/store";
2
- import { getDictionary as c } from "../getDictionary.mjs";
3
- import { getIntlayerContext as a } from "./intlayerContext.mjs";
4
- import { intlayerStore as m } from "./intlayerStore.mjs";
5
- const y = (t, o) => {
6
- const r = a();
7
- return i([m], ([e]) => {
8
- const n = o ?? r?.locale ?? e.locale;
9
- return c(t, n);
10
- });
11
- };
12
- export {
13
- y as useDictionary
14
- };
@@ -1,27 +0,0 @@
1
- import { writable as l, derived as s } from "svelte/store";
2
- import { getIntlayerContext as y } from "./intlayerContext.mjs";
3
- import { intlayerStore as d } from "./intlayerStore.mjs";
4
- const D = async (e, n) => {
5
- const a = y(), o = l(null);
6
- return s([d], ([c]) => {
7
- const r = n ?? a?.locale ?? c.locale;
8
- return (async () => {
9
- try {
10
- const t = e[r];
11
- if (t) {
12
- const i = await t();
13
- o.set(i);
14
- } else
15
- o.set(null);
16
- } catch (t) {
17
- console.error(
18
- `Failed to load dictionary for key: ${String(r)}`,
19
- t
20
- ), o.set(null);
21
- }
22
- })(), null;
23
- });
24
- };
25
- export {
26
- D as useDictionaryAsync
27
- };
@@ -1,27 +0,0 @@
1
- import { writable as s, derived as y } from "svelte/store";
2
- import { getIntlayerContext as d } from "./intlayerContext.mjs";
3
- import { intlayerStore as m } from "./intlayerStore.mjs";
4
- const g = (r, e, n) => {
5
- const a = d(), o = s(null);
6
- return y([m], ([i]) => {
7
- const c = n ?? a?.locale ?? i.locale;
8
- return (async () => {
9
- try {
10
- const t = r[c];
11
- if (t) {
12
- const l = await t();
13
- o.set(l);
14
- } else
15
- o.set(null);
16
- } catch (t) {
17
- console.error(
18
- `Failed to load dictionary for key: ${String(e)}`,
19
- t
20
- ), o.set(null);
21
- }
22
- })(), null;
23
- });
24
- };
25
- export {
26
- g as useDictionaryDynamic
27
- };
@@ -1,14 +0,0 @@
1
- import { derived as l } from "svelte/store";
2
- import { getIntlayer as a } from "../getIntlayer.mjs";
3
- import { getIntlayerContext as m } from "./intlayerContext.mjs";
4
- import { intlayerStore as c } from "./intlayerStore.mjs";
5
- const y = (t, r) => {
6
- const e = m();
7
- return l([c], ([o]) => {
8
- const n = r ?? e?.locale ?? o.locale;
9
- return a(t, n);
10
- });
11
- };
12
- export {
13
- y as useIntlayer
14
- };
@@ -1,22 +0,0 @@
1
- import r from "@intlayer/config/built";
2
- import { derived as c } from "svelte/store";
3
- import { getIntlayerContext as n } from "./intlayerContext.mjs";
4
- import { intlayerStore as o } from "./intlayerStore.mjs";
5
- const f = () => {
6
- const e = n(), { defaultLocale: t, locales: l } = r?.internationalization ?? {};
7
- return e ? {
8
- locale: c(
9
- [o],
10
- ([a]) => e.locale || a.locale
11
- ),
12
- setLocale: e.setLocale
13
- } : {
14
- locale: o.getLocale(),
15
- setLocale: o.setLocale,
16
- defaultLocale: t,
17
- availableLocales: l
18
- };
19
- };
20
- export {
21
- f as useLocale
22
- };
@@ -1,18 +0,0 @@
1
- import { getDictionary as r } from "@intlayer/core";
2
- import { intlayerNodePlugins as e, svelteNodePlugins as g, markdownPlugin as s } from "./plugins.mjs";
3
- const c = (t, i, o) => {
4
- const n = [
5
- e,
6
- g,
7
- s,
8
- ...o ?? []
9
- ];
10
- return r(
11
- t,
12
- i,
13
- n
14
- );
15
- };
16
- export {
17
- c as getDictionary
18
- };
@@ -1,14 +0,0 @@
1
- import { getIntlayer as o } from "@intlayer/core";
2
- import { intlayerNodePlugins as l, svelteNodePlugins as g, markdownPlugin as i } from "./plugins.mjs";
3
- const m = (t, e, n) => {
4
- const r = [
5
- l,
6
- g,
7
- i,
8
- ...n ?? []
9
- ];
10
- return o(t, e, r);
11
- };
12
- export {
13
- m as getIntlayer
14
- };
@@ -1,30 +0,0 @@
1
- import { getBrowserLocale as o } from "./client/getBrowserLocale.mjs";
2
- import { getIntlayerContext as n, setIntlayerContext as a } from "./client/intlayerContext.mjs";
3
- import { intlayerStore as m } from "./client/intlayerStore.mjs";
4
- import { useDictionary as f } from "./client/useDictionary.mjs";
5
- import { useDictionaryAsync as p } from "./client/useDictionaryAsync.mjs";
6
- import { useDictionaryDynamic as y } from "./client/useDictionaryDynamic.mjs";
7
- import { useIntlayer as u } from "./client/useIntlayer.mjs";
8
- import { useLocale as g } from "./client/useLocale.mjs";
9
- import { getDictionary as w } from "./getDictionary.mjs";
10
- import { getIntlayer as k } from "./getIntlayer.mjs";
11
- import { defaultMarkdownRenderer as C, processMarkdown as L } from "./markdown/index.mjs";
12
- import { intlayerNodePlugins as N, markdownPlugin as v, svelteNodePlugins as A } from "./plugins.mjs";
13
- export {
14
- C as defaultMarkdownRenderer,
15
- o as getBrowserLocale,
16
- w as getDictionary,
17
- k as getIntlayer,
18
- n as getIntlayerContext,
19
- N as intlayerNodePlugins,
20
- m as intlayerStore,
21
- v as markdownPlugin,
22
- L as processMarkdown,
23
- a as setIntlayerContext,
24
- A as svelteNodePlugins,
25
- f as useDictionary,
26
- p as useDictionaryAsync,
27
- y as useDictionaryDynamic,
28
- u as useIntlayer,
29
- g as useLocale
30
- };
@@ -1,10 +0,0 @@
1
- const e = (r) => r, n = {
2
- render: e,
3
- configure: (r) => {
4
- console.log("Configuring markdown renderer with options:", r);
5
- }
6
- };
7
- export {
8
- n as defaultMarkdownRenderer,
9
- e as processMarkdown
10
- };
@@ -1,18 +0,0 @@
1
- const e = {
2
- id: "svelte-node-plugin",
3
- canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
4
- transform: (n, { children: t, ...r }) => t ?? n
5
- }, i = {
6
- id: "intlayer-node-plugin",
7
- canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
8
- transform: (n, { children: t, ...r }) => t ?? n
9
- }, o = {
10
- id: "markdown-plugin",
11
- canHandle: (n) => typeof n == "string",
12
- transform: (n, t) => n
13
- };
14
- export {
15
- i as intlayerNodePlugins,
16
- o as markdownPlugin,
17
- e as svelteNodePlugins
18
- };
@@ -1,11 +0,0 @@
1
- import { LocalesValues } from '@intlayer/types';
2
- import { Readable } from 'svelte/store';
3
- export interface IntlayerStoreType {
4
- locale: LocalesValues;
5
- }
6
- export declare const intlayerStore: {
7
- subscribe: (this: void, run: import('svelte/store').Subscriber<IntlayerStoreType>, invalidate?: () => void) => import('svelte/store').Unsubscriber;
8
- setLocale: (locale: LocalesValues) => void;
9
- getLocale: () => Readable<LocalesValues>;
10
- reset: () => void;
11
- };
@@ -1,15 +0,0 @@
1
- /**
2
- * Hook to get and set the current locale in Svelte applications
3
- * @returns Readable store with current locale and setter function
4
- */
5
- export declare const useLocale: () => {
6
- locale: import('svelte/store').Readable<import('@intlayer/types').LocalesValues>;
7
- setLocale: (locale: import('@intlayer/types').LocalesValues) => void;
8
- defaultLocale?: undefined;
9
- availableLocales?: undefined;
10
- } | {
11
- locale: import('svelte/store').Readable<import('@intlayer/types').LocalesValues>;
12
- setLocale: (locale: import('@intlayer/types').LocalesValues) => void;
13
- defaultLocale: import('@intlayer/types').Locale;
14
- availableLocales: import('@intlayer/types').Locale[];
15
- };
@@ -1,27 +0,0 @@
1
- /**
2
- * Markdown support for Svelte Intlayer
3
- * This module provides markdown rendering capabilities for Svelte applications
4
- */
5
- export interface MarkdownProps {
6
- children: string;
7
- [key: string]: any;
8
- }
9
- /**
10
- * Basic markdown processor for Svelte
11
- * This can be extended to use more sophisticated markdown libraries
12
- * @param content Markdown content to process
13
- * @returns Processed content (for now, returns as-is)
14
- */
15
- export declare const processMarkdown: (content: string) => string;
16
- /**
17
- * Markdown renderer component interface for Svelte
18
- * This defines the expected interface for a markdown component
19
- */
20
- export interface MarkdownRenderer {
21
- render: (content: string) => string;
22
- configure?: (options: any) => void;
23
- }
24
- /**
25
- * Default markdown renderer implementation
26
- */
27
- export declare const defaultMarkdownRenderer: MarkdownRenderer;
@@ -1,27 +0,0 @@
1
- import { DeepTransformContent as DeepTransformContentCore, IInterpreterPluginState as IInterpreterPluginStateCore, Plugins } from '@intlayer/core';
2
- import { DeclaredLocales, LocalesValues } from '@intlayer/types';
3
- /**
4
- * Interface for Svelte-specific plugin functionality
5
- * This interface can be augmented to add more Svelte-specific transformations
6
- */
7
- export type IInterpreterPluginState = IInterpreterPluginStateCore & {};
8
- /**
9
- * Type that represents the deep transformation of content for Svelte
10
- * This applies Svelte-specific transformations recursively to all content
11
- */
12
- export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContentCore<T, IInterpreterPluginState, L>;
13
- /**
14
- * Svelte-specific node plugins for handling basic content types
15
- * These plugins handle strings, numbers, and bigints in Svelte applications
16
- */
17
- export declare const svelteNodePlugins: Plugins;
18
- /**
19
- * Basic Intlayer node plugins for content handling
20
- * These handle the core content transformation logic
21
- */
22
- export declare const intlayerNodePlugins: Plugins;
23
- /**
24
- * Markdown plugin for handling markdown content in Svelte
25
- * This can be extended to integrate with Svelte markdown processors
26
- */
27
- export declare const markdownPlugin: Plugins;
File without changes