@makeswift/runtime 0.20.3 → 0.20.4-canary.1

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 (41) hide show
  1. package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
  2. package/dist/cjs/runtimes/react/controls.js +59 -475
  3. package/dist/cjs/runtimes/react/controls.js.map +1 -1
  4. package/dist/cjs/runtimes/react/legacy-controls.js +344 -0
  5. package/dist/cjs/runtimes/react/legacy-controls.js.map +1 -0
  6. package/dist/cjs/utils/deepEqual.js +2 -29
  7. package/dist/cjs/utils/deepEqual.js.map +1 -1
  8. package/dist/cjs/utils/is.js +3 -6
  9. package/dist/cjs/utils/is.js.map +1 -1
  10. package/dist/cjs/utils/partition.js +48 -0
  11. package/dist/cjs/utils/partition.js.map +1 -0
  12. package/dist/cjs/utils/shallowEqual.js +2 -28
  13. package/dist/cjs/utils/shallowEqual.js.map +1 -1
  14. package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
  15. package/dist/esm/runtimes/react/controls.js +58 -507
  16. package/dist/esm/runtimes/react/controls.js.map +1 -1
  17. package/dist/esm/runtimes/react/legacy-controls.js +356 -0
  18. package/dist/esm/runtimes/react/legacy-controls.js.map +1 -0
  19. package/dist/esm/utils/deepEqual.js +1 -18
  20. package/dist/esm/utils/deepEqual.js.map +1 -1
  21. package/dist/esm/utils/is.js +3 -6
  22. package/dist/esm/utils/is.js.map +1 -1
  23. package/dist/esm/utils/partition.js +23 -0
  24. package/dist/esm/utils/partition.js.map +1 -0
  25. package/dist/esm/utils/shallowEqual.js +1 -17
  26. package/dist/esm/utils/shallowEqual.js.map +1 -1
  27. package/dist/types/runtimes/react/controls.d.ts +0 -6
  28. package/dist/types/runtimes/react/controls.d.ts.map +1 -1
  29. package/dist/types/runtimes/react/legacy-controls.d.ts +7 -0
  30. package/dist/types/runtimes/react/legacy-controls.d.ts.map +1 -0
  31. package/dist/types/utils/__tests__/partition.test.d.ts +2 -0
  32. package/dist/types/utils/__tests__/partition.test.d.ts.map +1 -0
  33. package/dist/types/utils/deepEqual.d.ts +1 -1
  34. package/dist/types/utils/deepEqual.d.ts.map +1 -1
  35. package/dist/types/utils/is.d.ts +2 -1
  36. package/dist/types/utils/is.d.ts.map +1 -1
  37. package/dist/types/utils/partition.d.ts +19 -0
  38. package/dist/types/utils/partition.d.ts.map +1 -0
  39. package/dist/types/utils/shallowEqual.d.ts +1 -1
  40. package/dist/types/utils/shallowEqual.d.ts.map +1 -1
  41. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/partition.ts"],"sourcesContent":["type Predicate<T, U extends T> = (value: T) => value is U\n\n/**\n * Splits the array into two based on the predicate's result. Returns a tuple of arrays with\n * matching and non-matching elements, maintaining the original order within each group.\n *\n * If the predicate includes a type assertion, the resulting arrays will be typed accordingly.\n */\nexport function partition<T, U extends T>(\n array: readonly T[],\n predicate: Predicate<T, U>,\n): [U[], Exclude<T, U>[]]\n\nexport function partition<T>(array: readonly T[], predicate: (value: T) => boolean): [T[], T[]]\n\nexport function partition(\n array: readonly unknown[],\n predicate: (value: unknown) => boolean,\n): [unknown[], unknown[]] {\n return array.reduce(\n (result: [unknown[], unknown[]], value) => {\n result[predicate(value) ? 0 : 1].push(value)\n return result\n },\n [[], []],\n )\n}\n\ntype R = Record<string, unknown>\n\n/**\n * Splits the record into two based on the predicate's result. Returns a tuple of records with\n * matching and non-matching elements.\n *\n * If the predicate includes a type assertion, the resulting records will be typed accordingly.\n */\nexport function partitionRecord<T, U extends T>(\n obj: Record<string, T>,\n predicate: Predicate<T, U>,\n): [Record<string, U>, Record<string, Exclude<T, U>>]\n\nexport function partitionRecord<T>(\n obj: Record<string, T>,\n predicate: (value: T) => boolean,\n): [Record<string, T>, Record<string, T>]\n\nexport function partitionRecord(obj: R, predicate: (value: unknown) => boolean): [R, R] {\n return Object.entries(obj).reduce(\n (result, [key, value]) => {\n result[predicate(value) ? 0 : 1][key] = value\n return result\n },\n [{}, {}] as [R, R],\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,UACd,OACA,WACwB;AACxB,SAAO,MAAM;AAAA,IACX,CAAC,QAAgC,UAAU;AACzC,aAAO,UAAU,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,KAAK;AAC3C,aAAO;AAAA,IACT;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;AAoBO,SAAS,gBAAgB,KAAQ,WAAgD;AACtF,SAAO,OAAO,QAAQ,GAAG,EAAE;AAAA,IACzB,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM;AACxB,aAAO,UAAU,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI;AACxC,aAAO;AAAA,IACT;AAAA,IACA,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,EACT;AACF;","names":[]}
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,36 +15,12 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var shallowEqual_exports = {};
30
20
  __export(shallowEqual_exports, {
31
21
  default: () => shallowEqual_default
32
22
  });
33
23
  module.exports = __toCommonJS(shallowEqual_exports);
34
- var import_is = __toESM(require("./is"));
35
- const { hasOwnProperty } = Object.prototype;
36
- const shallowEqual = (a, b) => {
37
- if ((0, import_is.default)(a, b))
38
- return true;
39
- if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
40
- return false;
41
- const keysA = Object.keys(a);
42
- const keysB = Object.keys(b);
43
- if (keysA.length !== keysB.length)
44
- return false;
45
- for (let i = 0; i < keysA.length; i += 1) {
46
- if (!hasOwnProperty.call(b, keysA[i]) || !(0, import_is.default)(a[keysA[i]], b[keysA[i]]))
47
- return false;
48
- }
49
- return true;
50
- };
51
- var shallowEqual_default = shallowEqual;
24
+ var import_controls = require("@makeswift/controls");
25
+ var shallowEqual_default = import_controls.shallowEqual;
52
26
  //# sourceMappingURL=shallowEqual.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/shallowEqual.ts"],"sourcesContent":["import is from './is'\n\nconst { hasOwnProperty } = Object.prototype\n\nconst shallowEqual = (a: unknown, b: unknown): boolean => {\n if (is(a, b)) return true\n\n if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) return false\n\n const keysA = Object.keys(a)\n const keysB = Object.keys(b)\n\n if (keysA.length !== keysB.length) return false\n\n for (let i = 0; i < keysA.length; i += 1) {\n // @ts-expect-error: {}[string] is OK.\n if (!hasOwnProperty.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]])) return false\n }\n\n return true\n}\n\nexport default shallowEqual\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AAEf,MAAM,EAAE,eAAe,IAAI,OAAO;AAElC,MAAM,eAAe,CAAC,GAAY,MAAwB;AACxD,UAAI,UAAAA,SAAG,GAAG,CAAC;AAAG,WAAO;AAErB,MAAI,OAAO,MAAM,YAAY,MAAM,QAAQ,OAAO,MAAM,YAAY,MAAM;AAAM,WAAO;AAEvF,QAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC;AAE3B,MAAI,MAAM,WAAW,MAAM;AAAQ,WAAO;AAE1C,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;AAExC,QAAI,CAAC,eAAe,KAAK,GAAG,MAAM,CAAC,CAAC,KAAK,KAAC,UAAAA,SAAG,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AAAG,aAAO;AAAA,EACjF;AAEA,SAAO;AACT;AAEA,IAAO,uBAAQ;","names":["is"]}
1
+ {"version":3,"sources":["../../../src/utils/shallowEqual.ts"],"sourcesContent":["import { shallowEqual } from '@makeswift/controls'\n\nexport default shallowEqual\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6B;AAE7B,IAAO,uBAAQ;","names":[]}
@@ -13,7 +13,7 @@ async function handler(...args) {
13
13
  const supportsPreviewMode = match(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
14
14
  const supportsDraftMode = match(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
15
15
  const body = {
16
- version: "0.20.3",
16
+ version: "0.20.4-canary.1",
17
17
  previewMode: supportsPreviewMode,
18
18
  draftMode: supportsDraftMode,
19
19
  interactionMode: true,