@juo/blocks 1.5.2 → 1.6.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/core.js CHANGED
@@ -154,6 +154,16 @@ async function loadBlockRegistry(options = {}) {
154
154
  });
155
155
  }
156
156
  }
157
+ function createCustomerService(options) {
158
+ const current = d(null);
159
+ const accountOrdersUrl = d(options.getAccountOrdersUrl());
160
+ const service = {
161
+ current,
162
+ accountOrdersUrl
163
+ };
164
+ return service;
165
+ }
166
+ const CustomerServiceContext = createContext("services/customer");
157
167
  const PARAMS = {
158
168
  DELETGATED_TOKEN: "delegated-token",
159
169
  REDIRECT_TO: "redirect-to",
@@ -696,6 +706,57 @@ function createProductService(adapter) {
696
706
  }
697
707
  };
698
708
  }
709
+ function routeNameTableFromPages(pages) {
710
+ const table = {};
711
+ for (const page of pages) {
712
+ const names = page.routeNames;
713
+ if (names.length === 0) continue;
714
+ for (const name of names) {
715
+ table[name] = page.path;
716
+ }
717
+ }
718
+ return table;
719
+ }
720
+ function createRouterService(options) {
721
+ const { pages, pushImplementation } = options;
722
+ const routeNameToPagePath = routeNameTableFromPages(pages);
723
+ const pathSet = new Set(pages.map((p2) => p2.path));
724
+ const navigationSubscribers = [];
725
+ function notifySubscribers(logicalPath) {
726
+ for (const cb of navigationSubscribers) cb({ path: logicalPath });
727
+ }
728
+ function notifyRouteName(routeName) {
729
+ const pagePath = routeNameToPagePath[String(routeName)];
730
+ if (pagePath != null) notifySubscribers(pagePath);
731
+ }
732
+ function notifyLogicalPath(logicalPath) {
733
+ if (pathSet.has(logicalPath)) notifySubscribers(logicalPath);
734
+ }
735
+ const routerService = {
736
+ push(to) {
737
+ pushImplementation(to);
738
+ },
739
+ subscribe(callback) {
740
+ navigationSubscribers.push(callback);
741
+ return () => {
742
+ const idx = navigationSubscribers.indexOf(callback);
743
+ if (idx !== -1) navigationSubscribers.splice(idx, 1);
744
+ };
745
+ },
746
+ getPages() {
747
+ return pages;
748
+ }
749
+ };
750
+ return { routerService, notifyRouteName, notifyLogicalPath };
751
+ }
752
+ const RouterServiceContext = createContext("services/router");
753
+ function createMockRouterService() {
754
+ return createRouterService({
755
+ pages: [],
756
+ pushImplementation: () => {
757
+ }
758
+ }).routerService;
759
+ }
699
760
  function createMockSubscriptionAdapter() {
700
761
  const mockSubscriptions = [
701
762
  {
@@ -989,13 +1050,6 @@ function createSubscriptionService(adapter) {
989
1050
  };
990
1051
  return service;
991
1052
  }
992
- const CustomerServiceContext = createContext("services/customer");
993
- function createCustomerService() {
994
- const current = d(null);
995
- const service = { current };
996
- return service;
997
- }
998
- const RouterServiceContext = createContext("services/router");
999
1053
  const MOCK_FLOWS = {
1000
1054
  cancellation: [
1001
1055
  {
@@ -1273,9 +1327,11 @@ export {
1273
1327
  createContext,
1274
1328
  createCustomerService,
1275
1329
  createMockProductAdapter,
1330
+ createMockRouterService,
1276
1331
  createMockSubscriptionAdapter,
1277
1332
  createMockWorkflowApiAdapter,
1278
1333
  createProductService,
1334
+ createRouterService,
1279
1335
  i as createSelectedBlock,
1280
1336
  createState,
1281
1337
  createSubscriptionService,
@@ -1,4 +1,16 @@
1
1
  import { ContextType } from '../../context';
2
- import { CustomerServiceContext } from './types';
3
- export declare function createCustomerService(): ContextType<typeof CustomerServiceContext>;
2
+ import { CustomerService } from './types';
3
+ type CreateCustomerServiceOptions = {
4
+ /**
5
+ * Absolute storefront URL for account / orders (Header `<a href>` + `target="_parent"`).
6
+ * Called once when the service is created; hosts that need reactivity (portal) update
7
+ * `accountOrdersUrl` in their own `watchEffect` after `createCustomerService`.
8
+ */
9
+ getAccountOrdersUrl: () => string;
10
+ };
11
+ export declare function createCustomerService(options: CreateCustomerServiceOptions): ContextType<typeof CustomerServiceContext>;
12
+ export declare const CustomerServiceContext: {
13
+ __context__: CustomerService;
14
+ };
15
+ export {};
4
16
  //# sourceMappingURL=customerService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGjD,wBAAgB,qBAAqB,IAAI,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAMlF"}
1
+ {"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAU5C;AAED,eAAO,MAAM,sBAAsB;;CACkB,CAAC"}
@@ -1,3 +1,3 @@
1
- export { CustomerServiceContext, type CustomerService, type Customer, } from './types';
2
- export { createCustomerService, } from './customerService';
1
+ export { type CustomerService, type Customer } from './types';
2
+ export { createCustomerService, CustomerServiceContext, } from './customerService';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,QAAQ,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,qBAAqB,GACtB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { Signal } from '@preact/signals-core';
2
+ /** Signed-in customer identity for blocks such as Header (name / email display). */
2
3
  export type Customer = {
3
4
  id: string;
4
5
  name: string;
@@ -6,8 +7,6 @@ export type Customer = {
6
7
  };
7
8
  export type CustomerService = {
8
9
  current: Signal<Customer | null>;
9
- };
10
- export declare const CustomerServiceContext: {
11
- __context__: CustomerService;
10
+ accountOrdersUrl: Signal<string>;
12
11
  };
13
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAAsD,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,oFAAoF;AACpF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC"}
@@ -1,6 +1,6 @@
1
+ export * from './customer';
1
2
  export * from './login';
2
3
  export * from './product';
3
- export * from './subscription';
4
- export * from './customer';
5
4
  export * from './router';
5
+ export * from './subscription';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { RouterService } from './types';
2
+ /** Editor / theme preview / tests: avoid real navigation. */
3
+ export declare function createMockRouterService(): RouterService;
4
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/router/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,6DAA6D;AAC7D,wBAAgB,uBAAuB,IAAI,aAAa,CAKvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.test.d.ts","sourceRoot":"","sources":["../../../src/services/router/adapter.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createRouterService.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRouterService.test.d.ts","sourceRoot":"","sources":["../../../src/services/router/createRouterService.test.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
- export type { RouterPushTarget, RouterNavigationEvent, RouterPageRegistration, RouterService, } from './types';
2
- export { RouterServiceContext } from './routerService';
1
+ export type { RouterPushTarget, RouterPageRegistration, RouterService, } from './types';
2
+ export { createRouterService, RouterServiceContext, type CreateRouterServiceOptions, } from './routerService';
3
+ export { createMockRouterService } from './adapter';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/router/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/router/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,0BAA0B,GAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC"}
@@ -1,4 +1,18 @@
1
- import { RouterService } from './types';
1
+ import { RouterPageRegistration, RouterPushTarget, RouterService } from './types';
2
+ export type CreateRouterServiceOptions = {
3
+ pages: readonly RouterPageRegistration[];
4
+ pushImplementation: (to: RouterPushTarget) => void;
5
+ };
6
+ /**
7
+ * Builds the {@link RouterService} wired to embedded blocks plus a separate
8
+ * host callback to emit logical navigations after route changes (e.g. vue-router
9
+ * {@code afterEach}).
10
+ */
11
+ export declare function createRouterService(options: CreateRouterServiceOptions): {
12
+ routerService: RouterService;
13
+ notifyRouteName: (routeName: string | symbol | null | undefined) => void;
14
+ notifyLogicalPath: (logicalPath: string) => void;
15
+ };
2
16
  export declare const RouterServiceContext: {
3
17
  __context__: RouterService;
4
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"routerService.d.ts","sourceRoot":"","sources":["../../../src/services/router/routerService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,oBAAoB;;CACgB,CAAC"}
1
+ {"version":3,"file":"routerService.d.ts","sourceRoot":"","sources":["../../../src/services/router/routerService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACzC,kBAAkB,EAAE,CAAC,EAAE,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACpD,CAAC;AAgBF;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B;;iCAaC,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;qCAM9B,MAAM;EAqB/C;AAED,eAAO,MAAM,oBAAoB;;CACgB,CAAC"}
@@ -17,6 +17,12 @@ export type RouterPageRegistration = {
17
17
  path: string;
18
18
  block: string;
19
19
  title: string;
20
+ /**
21
+ * Host router route {@code name} values (e.g. vue-router {@code RouteRecordName})
22
+ * that resolve this logical {@code path} for blocks navigation sync.
23
+ * Use an empty tuple when this page should not react to named host routes.
24
+ */
25
+ routeNames: readonly string[];
20
26
  };
21
27
  export interface RouterService {
22
28
  push(to: RouterPushTarget): void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/router/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACxE,QAAQ,IAAI,SAAS,sBAAsB,EAAE,CAAC;CAC/C"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/router/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEtF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACxE,QAAQ,IAAI,SAAS,sBAAsB,EAAE,CAAC;CAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IA+C5B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CAQrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
1
+ {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CAQrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/runtime/InlineText.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,iBAAiB;IAqCjB,oBAAoB;CAIrB"}
1
+ {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/runtime/InlineText.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,iBAAiB;IAsCjB,oBAAoB;CAIrB"}
@@ -84,7 +84,8 @@ const _InlineText = class _InlineText extends HTMLElement {
84
84
  if (!service) return;
85
85
  void service.locale.value;
86
86
  const resolved = service.resolve(this.blockType, this.blockId, key);
87
- const value = resolved === key && fallbackText.trim().length > 0 ? fallbackText : resolved;
87
+ const isMissing = resolved === key || this.hasAttribute("fallback-on-empty") && resolved.trim() === "";
88
+ const value = isMissing && fallbackText.trim().length > 0 ? fallbackText : resolved;
88
89
  this.textContent = value;
89
90
  this.lastValue = value;
90
91
  });
@@ -28,7 +28,8 @@ class InlineText extends HTMLElement {
28
28
  this.dispose = E(() => {
29
29
  void service.locale.value;
30
30
  const resolved = service.resolve(blockType, blockId, key);
31
- const value = resolved === key && fallbackText.trim().length > 0 ? fallbackText : resolved;
31
+ const isMissing = resolved === key || this.hasAttribute("fallback-on-empty") && resolved.trim() === "";
32
+ const value = isMissing && fallbackText.trim().length > 0 ? fallbackText : resolved;
32
33
  this.textContent = value;
33
34
  if (this.hasAttribute("hide-parent-if-empty") && this.parentElement) {
34
35
  this.parentElement.hidden = value.trim() === "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@juo/blocks",
3
3
  "private": false,
4
- "version": "1.5.2",
4
+ "version": "1.6.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"