Aktueller Stand

This commit is contained in:
2026-01-23 01:33:35 +01:00
parent 082dc5e110
commit 2766dd12c5
10109 changed files with 1578841 additions and 77685 deletions

View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patch = exports.empty = exports.diff = exports.combine = exports.ChunkPatchTypeId = void 0;
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
var Equal = _interopRequireWildcard(require("../../Equal.js"));
var _Function = _interopRequireWildcard(require("../../Function.js"));
var Dual = _Function;
var Data = _interopRequireWildcard(require("../data.js"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/** @internal */
const ChunkPatchTypeId = exports.ChunkPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferChunkPatch");
function variance(a) {
return a;
}
const PatchProto = {
...Data.Structural.prototype,
[ChunkPatchTypeId]: {
_Value: variance,
_Patch: variance
}
};
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Empty"
});
const _empty = /*#__PURE__*/Object.create(EmptyProto);
/**
* @internal
*/
const empty = () => _empty;
exports.empty = empty;
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AndThen"
});
const makeAndThen = (first, second) => {
const o = Object.create(AndThenProto);
o.first = first;
o.second = second;
return o;
};
const AppendProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Append"
});
const makeAppend = values => {
const o = Object.create(AppendProto);
o.values = values;
return o;
};
const SliceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Slice"
});
const makeSlice = (from, until) => {
const o = Object.create(SliceProto);
o.from = from;
o.until = until;
return o;
};
const UpdateProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Update"
});
const makeUpdate = (index, patch) => {
const o = Object.create(UpdateProto);
o.index = index;
o.patch = patch;
return o;
};
/** @internal */
const diff = options => {
let i = 0;
let patch = empty();
while (i < options.oldValue.length && i < options.newValue.length) {
const oldElement = Chunk.unsafeGet(i)(options.oldValue);
const newElement = Chunk.unsafeGet(i)(options.newValue);
const valuePatch = options.differ.diff(oldElement, newElement);
if (!Equal.equals(valuePatch, options.differ.empty)) {
patch = (0, _Function.pipe)(patch, combine(makeUpdate(i, valuePatch)));
}
i = i + 1;
}
if (i < options.oldValue.length) {
patch = (0, _Function.pipe)(patch, combine(makeSlice(0, i)));
}
if (i < options.newValue.length) {
patch = (0, _Function.pipe)(patch, combine(makeAppend(Chunk.drop(i)(options.newValue))));
}
return patch;
};
/** @internal */
exports.diff = diff;
const combine = exports.combine = /*#__PURE__*/Dual.dual(2, (self, that) => makeAndThen(self, that));
/** @internal */
const patch = exports.patch = /*#__PURE__*/Dual.dual(3, (self, oldValue, differ) => {
if (self._tag === "Empty") {
return oldValue;
}
let chunk = oldValue;
let patches = Chunk.of(self);
while (Chunk.isNonEmpty(patches)) {
const head = Chunk.headNonEmpty(patches);
const tail = Chunk.tailNonEmpty(patches);
switch (head._tag) {
case "Empty":
{
patches = tail;
break;
}
case "AndThen":
{
patches = Chunk.prepend(head.first)(Chunk.prepend(head.second)(tail));
break;
}
case "Append":
{
chunk = Chunk.appendAll(head.values)(chunk);
patches = tail;
break;
}
case "Slice":
{
const array = Chunk.toReadonlyArray(chunk);
chunk = Chunk.unsafeFromArray(array.slice(head.from, head.until));
patches = tail;
break;
}
case "Update":
{
const array = Chunk.toReadonlyArray(chunk);
array[head.index] = differ.patch(head.patch, array[head.index]);
chunk = Chunk.unsafeFromArray(array);
patches = tail;
break;
}
}
}
return chunk;
});
//# sourceMappingURL=chunkPatch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,152 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patch = exports.empty = exports.diff = exports.combine = exports.ContextPatchTypeId = void 0;
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
var Equal = _interopRequireWildcard(require("../../Equal.js"));
var Dual = _interopRequireWildcard(require("../../Function.js"));
var _context = require("../context.js");
var _data = require("../data.js");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/** @internal */
const ContextPatchTypeId = exports.ContextPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferContextPatch");
function variance(a) {
return a;
}
/** @internal */
const PatchProto = {
..._data.Structural.prototype,
[ContextPatchTypeId]: {
_Value: variance,
_Patch: variance
}
};
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Empty"
});
const _empty = /*#__PURE__*/Object.create(EmptyProto);
/**
* @internal
*/
const empty = () => _empty;
exports.empty = empty;
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AndThen"
});
const makeAndThen = (first, second) => {
const o = Object.create(AndThenProto);
o.first = first;
o.second = second;
return o;
};
const AddServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AddService"
});
const makeAddService = (key, service) => {
const o = Object.create(AddServiceProto);
o.key = key;
o.service = service;
return o;
};
const RemoveServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "RemoveService"
});
const makeRemoveService = key => {
const o = Object.create(RemoveServiceProto);
o.key = key;
return o;
};
const UpdateServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "UpdateService"
});
const makeUpdateService = (key, update) => {
const o = Object.create(UpdateServiceProto);
o.key = key;
o.update = update;
return o;
};
/** @internal */
const diff = (oldValue, newValue) => {
const missingServices = new Map(oldValue.unsafeMap);
let patch = empty();
for (const [tag, newService] of newValue.unsafeMap.entries()) {
if (missingServices.has(tag)) {
const old = missingServices.get(tag);
missingServices.delete(tag);
if (!Equal.equals(old, newService)) {
patch = combine(makeUpdateService(tag, () => newService))(patch);
}
} else {
missingServices.delete(tag);
patch = combine(makeAddService(tag, newService))(patch);
}
}
for (const [tag] of missingServices.entries()) {
patch = combine(makeRemoveService(tag))(patch);
}
return patch;
};
/** @internal */
exports.diff = diff;
const combine = exports.combine = /*#__PURE__*/Dual.dual(2, (self, that) => makeAndThen(self, that));
/** @internal */
const patch = exports.patch = /*#__PURE__*/Dual.dual(2, (self, context) => {
if (self._tag === "Empty") {
return context;
}
let wasServiceUpdated = false;
let patches = Chunk.of(self);
const updatedContext = new Map(context.unsafeMap);
while (Chunk.isNonEmpty(patches)) {
const head = Chunk.headNonEmpty(patches);
const tail = Chunk.tailNonEmpty(patches);
switch (head._tag) {
case "Empty":
{
patches = tail;
break;
}
case "AddService":
{
updatedContext.set(head.key, head.service);
patches = tail;
break;
}
case "AndThen":
{
patches = Chunk.prepend(Chunk.prepend(tail, head.second), head.first);
break;
}
case "RemoveService":
{
updatedContext.delete(head.key);
patches = tail;
break;
}
case "UpdateService":
{
updatedContext.set(head.key, head.update(updatedContext.get(head.key)));
wasServiceUpdated = true;
patches = tail;
break;
}
}
}
if (!wasServiceUpdated) {
return (0, _context.makeContext)(updatedContext);
}
const map = new Map();
for (const [tag] of context.unsafeMap) {
if (updatedContext.has(tag)) {
map.set(tag, updatedContext.get(tag));
updatedContext.delete(tag);
}
}
for (const [tag, s] of updatedContext) {
map.set(tag, s);
}
return (0, _context.makeContext)(map);
});
//# sourceMappingURL=contextPatch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patch = exports.empty = exports.diff = exports.combine = exports.HashMapPatchTypeId = void 0;
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
var Equal = _interopRequireWildcard(require("../../Equal.js"));
var Dual = _interopRequireWildcard(require("../../Function.js"));
var HashMap = _interopRequireWildcard(require("../../HashMap.js"));
var _data = require("../data.js");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/** @internal */
const HashMapPatchTypeId = exports.HashMapPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferHashMapPatch");
function variance(a) {
return a;
}
/** @internal */
const PatchProto = {
..._data.Structural.prototype,
[HashMapPatchTypeId]: {
_Value: variance,
_Key: variance,
_Patch: variance
}
};
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Empty"
});
const _empty = /*#__PURE__*/Object.create(EmptyProto);
/** @internal */
const empty = () => _empty;
exports.empty = empty;
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AndThen"
});
const makeAndThen = (first, second) => {
const o = Object.create(AndThenProto);
o.first = first;
o.second = second;
return o;
};
const AddProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Add"
});
const makeAdd = (key, value) => {
const o = Object.create(AddProto);
o.key = key;
o.value = value;
return o;
};
const RemoveProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Remove"
});
const makeRemove = key => {
const o = Object.create(RemoveProto);
o.key = key;
return o;
};
const UpdateProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Update"
});
const makeUpdate = (key, patch) => {
const o = Object.create(UpdateProto);
o.key = key;
o.patch = patch;
return o;
};
/** @internal */
const diff = options => {
const [removed, patch] = HashMap.reduce([options.oldValue, empty()], ([map, patch], newValue, key) => {
const option = HashMap.get(key)(map);
switch (option._tag) {
case "Some":
{
const valuePatch = options.differ.diff(option.value, newValue);
if (Equal.equals(valuePatch, options.differ.empty)) {
return [HashMap.remove(key)(map), patch];
}
return [HashMap.remove(key)(map), combine(makeUpdate(key, valuePatch))(patch)];
}
case "None":
{
return [map, combine(makeAdd(key, newValue))(patch)];
}
}
})(options.newValue);
return HashMap.reduce(patch, (patch, _, key) => combine(makeRemove(key))(patch))(removed);
};
/** @internal */
exports.diff = diff;
const combine = exports.combine = /*#__PURE__*/Dual.dual(2, (self, that) => makeAndThen(self, that));
/** @internal */
const patch = exports.patch = /*#__PURE__*/Dual.dual(3, (self, oldValue, differ) => {
if (self._tag === "Empty") {
return oldValue;
}
let map = oldValue;
let patches = Chunk.of(self);
while (Chunk.isNonEmpty(patches)) {
const head = Chunk.headNonEmpty(patches);
const tail = Chunk.tailNonEmpty(patches);
switch (head._tag) {
case "Empty":
{
patches = tail;
break;
}
case "AndThen":
{
patches = Chunk.prepend(head.first)(Chunk.prepend(head.second)(tail));
break;
}
case "Add":
{
map = HashMap.set(head.key, head.value)(map);
patches = tail;
break;
}
case "Remove":
{
map = HashMap.remove(head.key)(map);
patches = tail;
break;
}
case "Update":
{
const option = HashMap.get(head.key)(map);
if (option._tag === "Some") {
map = HashMap.set(head.key, differ.patch(head.patch, option.value))(map);
}
patches = tail;
break;
}
}
}
return map;
});
//# sourceMappingURL=hashMapPatch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,113 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patch = exports.makeRemove = exports.makeAndThen = exports.makeAdd = exports.empty = exports.diff = exports.combine = exports.HashSetPatchTypeId = void 0;
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
var Dual = _interopRequireWildcard(require("../../Function.js"));
var HashSet = _interopRequireWildcard(require("../../HashSet.js"));
var _data = require("../data.js");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/** @internal */
const HashSetPatchTypeId = exports.HashSetPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferHashSetPatch");
function variance(a) {
return a;
}
/** @internal */
const PatchProto = {
..._data.Structural.prototype,
[HashSetPatchTypeId]: {
_Value: variance,
_Key: variance,
_Patch: variance
}
};
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Empty"
});
const _empty = /*#__PURE__*/Object.create(EmptyProto);
/** @internal */
const empty = () => _empty;
exports.empty = empty;
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AndThen"
});
/** @internal */
const makeAndThen = (first, second) => {
const o = Object.create(AndThenProto);
o.first = first;
o.second = second;
return o;
};
exports.makeAndThen = makeAndThen;
const AddProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Add"
});
/** @internal */
const makeAdd = value => {
const o = Object.create(AddProto);
o.value = value;
return o;
};
exports.makeAdd = makeAdd;
const RemoveProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Remove"
});
/** @internal */
const makeRemove = value => {
const o = Object.create(RemoveProto);
o.value = value;
return o;
};
/** @internal */
exports.makeRemove = makeRemove;
const diff = (oldValue, newValue) => {
const [removed, patch] = HashSet.reduce([oldValue, empty()], ([set, patch], value) => {
if (HashSet.has(value)(set)) {
return [HashSet.remove(value)(set), patch];
}
return [set, combine(makeAdd(value))(patch)];
})(newValue);
return HashSet.reduce(patch, (patch, value) => combine(makeRemove(value))(patch))(removed);
};
/** @internal */
exports.diff = diff;
const combine = exports.combine = /*#__PURE__*/Dual.dual(2, (self, that) => makeAndThen(self, that));
/** @internal */
const patch = exports.patch = /*#__PURE__*/Dual.dual(2, (self, oldValue) => {
if (self._tag === "Empty") {
return oldValue;
}
let set = oldValue;
let patches = Chunk.of(self);
while (Chunk.isNonEmpty(patches)) {
const head = Chunk.headNonEmpty(patches);
const tail = Chunk.tailNonEmpty(patches);
switch (head._tag) {
case "Empty":
{
patches = tail;
break;
}
case "AndThen":
{
patches = Chunk.prepend(head.first)(Chunk.prepend(head.second)(tail));
break;
}
case "Add":
{
set = HashSet.add(head.value)(set);
patches = tail;
break;
}
case "Remove":
{
set = HashSet.remove(head.value)(set);
patches = tail;
}
}
}
return set;
});
//# sourceMappingURL=hashSetPatch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,184 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patch = exports.makeUpdateRight = exports.makeUpdateLeft = exports.makeSetRight = exports.makeSetLeft = exports.makeAndThen = exports.empty = exports.diff = exports.combine = exports.OrPatchTypeId = void 0;
var Chunk = _interopRequireWildcard(require("../../Chunk.js"));
var E = _interopRequireWildcard(require("../../Either.js"));
var Equal = _interopRequireWildcard(require("../../Equal.js"));
var Dual = _interopRequireWildcard(require("../../Function.js"));
var _data = require("../data.js");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/** @internal */
const OrPatchTypeId = exports.OrPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferOrPatch");
function variance(a) {
return a;
}
/** @internal */
const PatchProto = {
..._data.Structural.prototype,
[OrPatchTypeId]: {
_Value: variance,
_Key: variance,
_Patch: variance
}
};
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Empty"
});
const _empty = /*#__PURE__*/Object.create(EmptyProto);
/** @internal */
const empty = () => _empty;
exports.empty = empty;
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AndThen"
});
/** @internal */
const makeAndThen = (first, second) => {
const o = Object.create(AndThenProto);
o.first = first;
o.second = second;
return o;
};
exports.makeAndThen = makeAndThen;
const SetLeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "SetLeft"
});
/** @internal */
const makeSetLeft = value => {
const o = Object.create(SetLeftProto);
o.value = value;
return o;
};
exports.makeSetLeft = makeSetLeft;
const SetRightProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "SetRight"
});
/** @internal */
const makeSetRight = value => {
const o = Object.create(SetRightProto);
o.value = value;
return o;
};
exports.makeSetRight = makeSetRight;
const UpdateLeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "UpdateLeft"
});
/** @internal */
const makeUpdateLeft = patch => {
const o = Object.create(UpdateLeftProto);
o.patch = patch;
return o;
};
exports.makeUpdateLeft = makeUpdateLeft;
const UpdateRightProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "UpdateRight"
});
/** @internal */
const makeUpdateRight = patch => {
const o = Object.create(UpdateRightProto);
o.patch = patch;
return o;
};
/** @internal */
exports.makeUpdateRight = makeUpdateRight;
const diff = options => {
switch (options.oldValue._tag) {
case "Left":
{
switch (options.newValue._tag) {
case "Left":
{
const valuePatch = options.left.diff(options.oldValue.left, options.newValue.left);
if (Equal.equals(valuePatch, options.left.empty)) {
return empty();
}
return makeUpdateLeft(valuePatch);
}
case "Right":
{
return makeSetRight(options.newValue.right);
}
}
}
case "Right":
{
switch (options.newValue._tag) {
case "Left":
{
return makeSetLeft(options.newValue.left);
}
case "Right":
{
const valuePatch = options.right.diff(options.oldValue.right, options.newValue.right);
if (Equal.equals(valuePatch, options.right.empty)) {
return empty();
}
return makeUpdateRight(valuePatch);
}
}
}
}
};
/** @internal */
exports.diff = diff;
const combine = exports.combine = /*#__PURE__*/Dual.dual(2, (self, that) => makeAndThen(self, that));
/** @internal */
const patch = exports.patch = /*#__PURE__*/Dual.dual(2, (self, {
left,
oldValue,
right
}) => {
if (self._tag === "Empty") {
return oldValue;
}
let patches = Chunk.of(self);
let result = oldValue;
while (Chunk.isNonEmpty(patches)) {
const head = Chunk.headNonEmpty(patches);
const tail = Chunk.tailNonEmpty(patches);
switch (head._tag) {
case "Empty":
{
patches = tail;
break;
}
case "AndThen":
{
patches = Chunk.prepend(head.first)(Chunk.prepend(head.second)(tail));
break;
}
case "UpdateLeft":
{
if (result._tag === "Left") {
result = E.left(left.patch(head.patch, result.left));
}
patches = tail;
break;
}
case "UpdateRight":
{
if (result._tag === "Right") {
result = E.right(right.patch(head.patch, result.right));
}
patches = tail;
break;
}
case "SetLeft":
{
result = E.left(head.value);
patches = tail;
break;
}
case "SetRight":
{
result = E.right(head.value);
patches = tail;
break;
}
}
}
return result;
});
//# sourceMappingURL=orPatch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,138 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patch = exports.empty = exports.diff = exports.combine = exports.ReadonlyArrayPatchTypeId = void 0;
var Arr = _interopRequireWildcard(require("../../Array.js"));
var Equal = _interopRequireWildcard(require("../../Equal.js"));
var Dual = _interopRequireWildcard(require("../../Function.js"));
var Data = _interopRequireWildcard(require("../data.js"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/** @internal */
const ReadonlyArrayPatchTypeId = exports.ReadonlyArrayPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferReadonlyArrayPatch");
function variance(a) {
return a;
}
const PatchProto = {
...Data.Structural.prototype,
[ReadonlyArrayPatchTypeId]: {
_Value: variance,
_Patch: variance
}
};
const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Empty"
});
const _empty = /*#__PURE__*/Object.create(EmptyProto);
/**
* @internal
*/
const empty = () => _empty;
exports.empty = empty;
const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "AndThen"
});
const makeAndThen = (first, second) => {
const o = Object.create(AndThenProto);
o.first = first;
o.second = second;
return o;
};
const AppendProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Append"
});
const makeAppend = values => {
const o = Object.create(AppendProto);
o.values = values;
return o;
};
const SliceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Slice"
});
const makeSlice = (from, until) => {
const o = Object.create(SliceProto);
o.from = from;
o.until = until;
return o;
};
const UpdateProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
_tag: "Update"
});
const makeUpdate = (index, patch) => {
const o = Object.create(UpdateProto);
o.index = index;
o.patch = patch;
return o;
};
/** @internal */
const diff = options => {
let i = 0;
let patch = empty();
while (i < options.oldValue.length && i < options.newValue.length) {
const oldElement = options.oldValue[i];
const newElement = options.newValue[i];
const valuePatch = options.differ.diff(oldElement, newElement);
if (!Equal.equals(valuePatch, options.differ.empty)) {
patch = combine(patch, makeUpdate(i, valuePatch));
}
i = i + 1;
}
if (i < options.oldValue.length) {
patch = combine(patch, makeSlice(0, i));
}
if (i < options.newValue.length) {
patch = combine(patch, makeAppend(Arr.drop(i)(options.newValue)));
}
return patch;
};
/** @internal */
exports.diff = diff;
const combine = exports.combine = /*#__PURE__*/Dual.dual(2, (self, that) => makeAndThen(self, that));
/** @internal */
const patch = exports.patch = /*#__PURE__*/Dual.dual(3, (self, oldValue, differ) => {
if (self._tag === "Empty") {
return oldValue;
}
let readonlyArray = oldValue.slice();
let patches = Arr.of(self);
while (Arr.isNonEmptyArray(patches)) {
const head = Arr.headNonEmpty(patches);
const tail = Arr.tailNonEmpty(patches);
switch (head._tag) {
case "Empty":
{
patches = tail;
break;
}
case "AndThen":
{
tail.unshift(head.first, head.second);
patches = tail;
break;
}
case "Append":
{
for (const value of head.values) {
readonlyArray.push(value);
}
patches = tail;
break;
}
case "Slice":
{
readonlyArray = readonlyArray.slice(head.from, head.until);
patches = tail;
break;
}
case "Update":
{
readonlyArray[head.index] = differ.patch(head.patch, readonlyArray[head.index]);
patches = tail;
break;
}
}
}
return readonlyArray;
});
//# sourceMappingURL=readonlyArrayPatch.js.map

File diff suppressed because one or more lines are too long