@localess/react 3.0.1-dev.20260412201733 → 3.0.1-dev.20260425070339

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.
@@ -1,5 +1,5 @@
1
- import { ContentData, ContentFetchParams } from '@localess/client';
2
- import { Content } from '../models';
1
+ import { ContentFetchParams } from '@localess/client';
2
+ import { Content, ContentData } from '../models';
3
3
  /**
4
4
  * Options for {@link useLocaless}.
5
5
  * Extends {@link ContentFetchParams} with any future hook-specific settings.
@@ -1 +1 @@
1
- const e=require(`../state.js`);let t=require(`@localess/client`),n=require(`react`);var r=(r,i={})=>{let[a,o]=(0,n.useState)(),s=e.getLocalessClient(),c;return c=Array.isArray(r)?r.join(`/`):r,(0,n.useEffect)(()=>{async function n(){let n=await s.getContentBySlug(c,i);o(n),e.isSyncEnabled()&&(0,t.isBrowser)()&&window.localess?.on([`input`,`change`],e=>{(e.type===`change`||e.type===`input`)&&o({...n,data:e.data})})}n()},[r,i,s]),a};exports.useLocaless=r;
1
+ const e=require(`../state.js`);let t=require(`react`),n=require(`@localess/client`);var r=(r,i={})=>{let[a,o]=(0,t.useState)(),s=e.getLocalessClient(),c;return c=Array.isArray(r)?r.join(`/`):r,(0,t.useEffect)(()=>{async function t(){let t=await s.getContentBySlug(c,i);o(t),e.isSyncEnabled()&&(0,n.isBrowser)()&&(0,n.isIframe)()&&window.localess?.on([`input`,`change`],e=>{(e.type===`change`||e.type===`input`)&&o({...t,data:e.data})})}t()},[r,i,s]),a};exports.useLocaless=r;
@@ -1,14 +1,14 @@
1
1
  import { getLocalessClient as e, isSyncEnabled as t } from "../state.mjs";
2
- import { isBrowser as n } from "@localess/client";
3
- import { useEffect as r, useState as i } from "react";
2
+ import { isBrowser as n, isIframe as r } from "../utils/index.mjs";
3
+ import { useEffect as i, useState as a } from "react";
4
4
  //#region src/core/hooks/use-localess.ts
5
- var a = (a, o = {}) => {
6
- let [s, c] = i(), l = e(), u;
7
- return u = Array.isArray(a) ? a.join("/") : a, r(() => {
5
+ var o = (o, s = {}) => {
6
+ let [c, l] = a(), u = e(), d;
7
+ return d = Array.isArray(o) ? o.join("/") : o, i(() => {
8
8
  async function e() {
9
- let e = await l.getContentBySlug(u, o);
10
- c(e), t() && n() && window.localess?.on(["input", "change"], (t) => {
11
- (t.type === "change" || t.type === "input") && c({
9
+ let e = await u.getContentBySlug(d, s);
10
+ l(e), t() && n() && r() && window.localess?.on(["input", "change"], (t) => {
11
+ (t.type === "change" || t.type === "input") && l({
12
12
  ...e,
13
13
  data: t.data
14
14
  });
@@ -16,10 +16,10 @@ var a = (a, o = {}) => {
16
16
  }
17
17
  e();
18
18
  }, [
19
- a,
20
19
  o,
21
- l
22
- ]), s;
20
+ s,
21
+ u
22
+ ]), c;
23
23
  };
24
24
  //#endregion
25
- export { a as useLocaless };
25
+ export { o as useLocaless };
@@ -1 +1 @@
1
- "use client";let e=require(`@localess/client`),t=require(`react`);var n=(n=>(console.info(`LocalessSync:init`),(0,t.useEffect)(()=>{console.info(`LocalessSync:effect`,n.enableSync,(0,e.isBrowser)(),(0,e.isIframe)()),n.enableSync&&(0,e.isBrowser)()&&(0,e.isIframe)()&&((0,e.loadLocalessSync)(n.origin),window.localess?.on([`input`,`change`],e=>{console.info(`LocalessSync:change:`,e),(e.type===`change`||e.type===`input`)&&(n.document.data=e.data)}))},[]),null));exports.LocalessSync=n;
1
+ "use client";let e=require(`@localess/client`),t=require(`react`);var n=(n=>(console.info(`LocalessSync:init`),(0,t.useEffect)(()=>{async function t(){n.enableSync&&(0,e.isBrowser)()&&(0,e.isIframe)()&&(await(0,e.loadLocalessSync)(n.origin),window.localess?.on([`input`,`change`],e=>{console.info(`LocalessSync:change:`,e),(e.type===`change`||e.type===`input`)&&(n.document.data=e.data)}))}t()},[]),null));exports.LocalessSync=n;
@@ -4,9 +4,12 @@ import { loadLocalessSync as n } from "@localess/client";
4
4
  import { useEffect as r } from "react";
5
5
  //#region src/rsc/localess-sync.tsx
6
6
  var i = ((i) => (console.info("LocalessSync:init"), r(() => {
7
- console.info("LocalessSync:effect", i.enableSync, e(), t()), i.enableSync && e() && t() && (n(i.origin), window.localess?.on(["input", "change"], (e) => {
8
- console.info("LocalessSync:change:", e), (e.type === "change" || e.type === "input") && (i.document.data = e.data);
9
- }));
7
+ async function r() {
8
+ i.enableSync && e() && t() && (await n(i.origin), window.localess?.on(["input", "change"], (e) => {
9
+ console.info("LocalessSync:change:", e), (e.type === "change" || e.type === "input") && (i.document.data = e.data);
10
+ }));
11
+ }
12
+ r();
10
13
  }, []), null));
11
14
  //#endregion
12
15
  export { i as LocalessSync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/react",
3
- "version": "3.0.1-dev.20260412201733",
3
+ "version": "3.0.1-dev.20260425070339",
4
4
  "description": "ReactJS JavaScript/TypeScript SDK for Localess's API.",
5
5
  "keywords": [
6
6
  "localess",
@@ -61,7 +61,7 @@
61
61
  "react-dom": "^17 || ^18 || ^19"
62
62
  },
63
63
  "dependencies": {
64
- "@localess/client": "3.0.1-dev.20260412201733",
64
+ "@localess/client": "3.0.1-dev.20260425070339",
65
65
  "@tiptap/extension-bold": "^3.20.1",
66
66
  "@tiptap/extension-bullet-list": "^3.20.1",
67
67
  "@tiptap/extension-code": "^3.20.1",