@blocklet/pages-kit 0.2.320 → 0.2.321

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 (32) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +11 -4
  2. package/lib/cjs/builtin/async/ai-runtime/locales/index.js +4 -0
  3. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +29 -17
  4. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +36 -17
  5. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +84 -77
  6. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +2 -2
  7. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +7 -5
  8. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +4 -4
  9. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +4 -1
  10. package/lib/cjs/builtin/iconify/react.js +8 -2
  11. package/lib/cjs/components/CustomComponentRenderer/state.js +14 -0
  12. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  13. package/lib/cjs/utils/inject-global-components-dump-json.js +8 -3
  14. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +11 -4
  15. package/lib/esm/builtin/async/ai-runtime/locales/index.js +4 -0
  16. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +29 -17
  17. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +36 -17
  18. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +84 -78
  19. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +2 -2
  20. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +7 -5
  21. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +4 -4
  22. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +4 -1
  23. package/lib/esm/builtin/iconify/react.js +7 -1
  24. package/lib/esm/components/CustomComponentRenderer/state.js +11 -0
  25. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  26. package/lib/esm/utils/inject-global-components-dump-json.js +8 -3
  27. package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +4 -0
  28. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +1 -5
  29. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +1 -0
  30. package/lib/types/builtin/iconify/react.d.ts +2 -1
  31. package/lib/types/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +1 -1
@@ -1,5 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Icon = void 0;
4
- var react_1 = require("@iconify/react");
5
- Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return react_1.Icon; } });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@iconify/react");
6
+ const material_1 = require("@mui/material");
7
+ function Icon(props) {
8
+ return (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_1.Icon }, props));
9
+ }
10
+ exports.Icon = Icon;
11
+ exports.default = Icon;
@@ -42,8 +42,12 @@ var __rest = (this && this.__rest) || function (s, e) {
42
42
  }
43
43
  return t;
44
44
  };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
45
48
  Object.defineProperty(exports, "__esModule", { value: true });
46
49
  exports.transpileAndLoadScript = exports.useComponent = exports.customComponentStates = void 0;
50
+ const set_1 = __importDefault(require("lodash/set"));
47
51
  const react_1 = require("react");
48
52
  const zustand_1 = require("zustand");
49
53
  const immer_1 = require("zustand/middleware/immer");
@@ -203,6 +207,16 @@ function useTranspileComponent({ componentId, locale, properties, dev: { default
203
207
  if (typeof (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA) === 'object' && (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA.length)) {
204
208
  propertiesFromCode = {};
205
209
  m.PROPERTIES_SCHEMA.forEach((data, index) => {
210
+ var _a, _b, _c;
211
+ // @ts-ignore
212
+ (_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.blocklet) === null || _a === void 0 ? void 0 : _a.languages) === null || _b === void 0 ? void 0 : _b.forEach) === null || _c === void 0 ? void 0 : _c.call(_b, (item) => {
213
+ var _a, _b;
214
+ const { code: localKey } = item;
215
+ if (!((_a = data === null || data === void 0 ? void 0 : data.locales) === null || _a === void 0 ? void 0 : _a[localKey])) {
216
+ // fallback to en
217
+ (0, set_1.default)(data, `locales.${localKey}`, (_b = data.locales) === null || _b === void 0 ? void 0 : _b.en);
218
+ }
219
+ });
206
220
  propertiesFromCode[data.id] = {
207
221
  index,
208
222
  data,