@pkmn/engine 0.1.0-dev.8b83af6b → 0.1.0-dev.8cf7e679

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 (83) hide show
  1. package/LICENSE +1 -3
  2. package/README.md +100 -61
  3. package/build/pkg/addon/browser.d.ts +3 -0
  4. package/build/pkg/addon/browser.js +44 -0
  5. package/build/pkg/addon/browser.js.map +1 -0
  6. package/build/pkg/addon/node.d.ts +3 -0
  7. package/build/pkg/addon/node.js +97 -0
  8. package/build/pkg/addon/node.js.map +1 -0
  9. package/build/pkg/addon/wasm.d.ts +2 -0
  10. package/build/pkg/addon/wasm.js +44 -0
  11. package/build/pkg/addon/wasm.js.map +1 -0
  12. package/build/pkg/addon.d.ts +25 -3
  13. package/build/pkg/addon.js +39 -70
  14. package/build/pkg/addon.js.map +1 -1
  15. package/build/pkg/data/ids.json +12 -12
  16. package/build/pkg/data/layout.json +39 -4
  17. package/build/pkg/data/protocol.json +84 -13
  18. package/build/pkg/data.d.ts +27 -5
  19. package/build/pkg/data.js.map +1 -1
  20. package/build/pkg/gen1.d.ts +13 -17
  21. package/build/pkg/gen1.js +21 -28
  22. package/build/pkg/gen1.js.map +1 -1
  23. package/build/pkg/index.d.ts +40 -91
  24. package/build/pkg/index.js +6 -63
  25. package/build/pkg/index.js.map +1 -1
  26. package/build/pkg/protocol.d.ts +20 -1
  27. package/build/pkg/protocol.js +123 -102
  28. package/build/pkg/protocol.js.map +1 -1
  29. package/build/tools/debug.js +36 -69
  30. package/build/tools/debug.js.map +1 -1
  31. package/build/tools/display/debug.jsx +141 -0
  32. package/build/tools/display/debug.jsx.map +1 -0
  33. package/build/tools/display/index.js +141 -0
  34. package/build/tools/display/index.js.map +1 -0
  35. package/build/tools/display/ui.jsx +349 -0
  36. package/build/tools/display/ui.jsx.map +1 -0
  37. package/build/tools/display/util.js +18 -0
  38. package/build/tools/display/util.js.map +1 -0
  39. package/build.zig +332 -132
  40. package/package.json +66 -121
  41. package/src/bin/install-pkmn-engine +40 -25
  42. package/src/bin/pkmn-debug +1 -1
  43. package/src/lib/common/array.zig +77 -0
  44. package/src/lib/common/battle.zig +17 -0
  45. package/src/lib/common/data.zig +12 -24
  46. package/src/lib/common/debug.zig +58 -18
  47. package/src/lib/common/js.zig +120 -0
  48. package/src/lib/common/optional.zig +71 -0
  49. package/src/lib/common/options.zig +15 -0
  50. package/src/lib/common/protocol.zig +851 -327
  51. package/src/lib/common/rational.zig +449 -0
  52. package/src/lib/common/rng.zig +26 -19
  53. package/src/lib/common/util.zig +61 -0
  54. package/src/lib/gen1/calc.zig +953 -0
  55. package/src/lib/gen1/chance.zig +1185 -0
  56. package/src/lib/gen1/data/moves.zig +193 -183
  57. package/src/lib/gen1/data/species.zig +4 -6
  58. package/src/lib/gen1/data/types.zig +8 -9
  59. package/src/lib/gen1/data.zig +79 -73
  60. package/src/lib/gen1/helpers.zig +130 -30
  61. package/src/lib/gen1/mechanics.zig +1137 -779
  62. package/src/lib/gen2/calc.zig +153 -0
  63. package/src/lib/gen2/chance.zig +902 -0
  64. package/src/lib/gen2/data/items.zig +13 -21
  65. package/src/lib/gen2/data/moves.zig +664 -572
  66. package/src/lib/gen2/data/species.zig +2 -4
  67. package/src/lib/gen2/data/types.zig +135 -33
  68. package/src/lib/gen2/data.zig +121 -87
  69. package/src/lib/gen2/generated.zig +801 -0
  70. package/src/lib/gen2/helpers.zig +54 -39
  71. package/src/lib/gen2/mechanics.zig +3582 -30
  72. package/src/lib/node.zig +129 -0
  73. package/src/lib/pkmn.zig +85 -5
  74. package/src/lib/wasm.zig +48 -0
  75. package/src/tools/display/dom.ts +96 -0
  76. package/src/tools/display/ui.css +354 -0
  77. package/build/test/display.js +0 -400
  78. package/build/test/display.js.map +0 -1
  79. package/src/lib/binding/node.zig +0 -226
  80. package/src/lib/binding/wasm.zig +0 -10
  81. package/src/lib/gen1/README.md +0 -814
  82. package/src/lib/gen2/README.md +0 -309
  83. package/src/test/display/pkmn.html.tmpl +0 -368
@@ -0,0 +1,129 @@
1
+ const js = @import("common/js.zig");
2
+ const pkmn = @import("pkmn.zig");
3
+ const std = @import("std");
4
+
5
+ const assert = std.debug.assert;
6
+
7
+ const c = @cImport({
8
+ @cDefine("NAPI_VERSION", "8");
9
+ @cInclude("node_api.h");
10
+ });
11
+
12
+ export fn napi_register_module_v1(env: c.napi_env, exports: c.napi_value) c.napi_value {
13
+ const properties = [_]c.napi_property_descriptor{
14
+ js.Property.init("engine", .{ .value = register(env) }),
15
+ };
16
+ assert(c.napi_define_properties(env, exports, properties.len, &properties) == c.napi_ok);
17
+ return exports;
18
+ }
19
+
20
+ pub fn register(env: c.napi_env) c.napi_value {
21
+ const object = js.Object.init(env);
22
+ const properties = [_]c.napi_property_descriptor{
23
+ js.Property.init("options", .{ .value = options(env) }),
24
+ js.Property.init("bindings", .{ .value = bindings(env) }),
25
+ };
26
+ assert(c.napi_define_properties(env, object, properties.len, &properties) == c.napi_ok);
27
+ return object;
28
+ }
29
+
30
+ fn options(env: c.napi_env) c.napi_value {
31
+ const object = js.Object.init(env);
32
+ const properties = [_]c.napi_property_descriptor{
33
+ js.Property.init("showdown", .{ .value = js.Boolean.init(env, pkmn.options.showdown) }),
34
+ js.Property.init("log", .{ .value = js.Boolean.init(env, pkmn.options.log) }),
35
+ js.Property.init("chance", .{ .value = js.Boolean.init(env, pkmn.options.chance) }),
36
+ js.Property.init("calc", .{ .value = js.Boolean.init(env, pkmn.options.calc) }),
37
+ };
38
+ assert(c.napi_define_properties(env, object, properties.len, &properties) == c.napi_ok);
39
+ return object;
40
+ }
41
+
42
+ fn bindings(env: c.napi_env) c.napi_value {
43
+ const array = js.Array.init(env, .{ .length = 1 });
44
+ js.Array.set(env, array, 0, bind(env, pkmn.gen1));
45
+ return array;
46
+ }
47
+
48
+ fn bind(env: c.napi_env, gen: anytype) c.napi_value {
49
+ const choices_size: u32 = @intCast(gen.CHOICES_SIZE);
50
+ const logs_size: u32 = @intCast(gen.LOGS_SIZE);
51
+ const object = js.Object.init(env);
52
+ const properties = [_]c.napi_property_descriptor{
53
+ js.Property.init("CHOICES_SIZE", .{ .value = js.Number.init(env, choices_size) }),
54
+ js.Property.init("LOGS_SIZE", .{ .value = js.Number.init(env, logs_size) }),
55
+ js.Property.init("update", .{ .method = update(gen) }),
56
+ js.Property.init("choices", .{ .method = choices(gen) }),
57
+ };
58
+ assert(c.napi_define_properties(env, object, properties.len, &properties) == c.napi_ok);
59
+ return object;
60
+ }
61
+
62
+ fn update(gen: anytype) c.napi_callback {
63
+ return struct {
64
+ fn call(env: c.napi_env, info: c.napi_callback_info) callconv(.C) c.napi_value {
65
+ var argc: usize = 4;
66
+ var argv: [4]c.napi_value = undefined;
67
+ assert(c.napi_get_cb_info(env, info, &argc, &argv, null, null) == c.napi_ok);
68
+ assert(argc == 4);
69
+
70
+ var data: ?*anyopaque = undefined;
71
+ var len: usize = 0;
72
+ assert(c.napi_get_arraybuffer_info(env, argv[0], &data, &len) == c.napi_ok);
73
+ assert(len == @sizeOf(gen.Battle(gen.PRNG)));
74
+
75
+ var battle: *gen.Battle(gen.PRNG) = @alignCast(@ptrCast(data.?));
76
+ const c1: pkmn.Choice = @bitCast(js.Number.get(env, argv[1], u8));
77
+ const c2: pkmn.Choice = @bitCast(js.Number.get(env, argv[2], u8));
78
+
79
+ var vtype: c.napi_valuetype = undefined;
80
+ assert(c.napi_typeof(env, argv[3], &vtype) == c.napi_ok);
81
+ const result = switch (vtype) {
82
+ c.napi_undefined, c.napi_null => battle.update(c1, c2, &gen.NULL),
83
+ else => result: {
84
+ assert(c.napi_get_arraybuffer_info(env, argv[3], &data, &len) == c.napi_ok);
85
+ assert(len == gen.LOGS_SIZE);
86
+
87
+ const buf = @as([*]u8, @ptrCast(data.?))[0..gen.LOGS_SIZE];
88
+ var stream: pkmn.protocol.ByteStream = .{ .buffer = buf };
89
+ // TODO: extract out
90
+ var opts = pkmn.battle.options(
91
+ pkmn.protocol.FixedLog{ .writer = stream.writer() },
92
+ gen.chance.NULL,
93
+ gen.calc.NULL,
94
+ );
95
+ break :result battle.update(c1, c2, &opts);
96
+ },
97
+ } catch unreachable;
98
+
99
+ return js.Number.init(env, @as(u8, @bitCast(result)));
100
+ }
101
+ }.call;
102
+ }
103
+
104
+ fn choices(gen: anytype) c.napi_callback {
105
+ return struct {
106
+ fn call(env: c.napi_env, info: c.napi_callback_info) callconv(.C) c.napi_value {
107
+ var argc: usize = 4;
108
+ var argv: [4]c.napi_value = undefined;
109
+ assert(c.napi_get_cb_info(env, info, &argc, &argv, null, null) == c.napi_ok);
110
+ assert(argc == 4);
111
+
112
+ var data: ?*anyopaque = undefined;
113
+ var len: usize = 0;
114
+ assert(c.napi_get_arraybuffer_info(env, argv[0], &data, &len) == c.napi_ok);
115
+ assert(len == @sizeOf(gen.Battle(gen.PRNG)));
116
+
117
+ var battle: *gen.Battle(gen.PRNG) = @alignCast(@ptrCast(data.?));
118
+ const player: pkmn.Player = @enumFromInt(js.Number.get(env, argv[1], u8));
119
+ const request: pkmn.Choice.Type = @enumFromInt(js.Number.get(env, argv[2], u8));
120
+
121
+ assert(c.napi_get_arraybuffer_info(env, argv[3], &data, &len) == c.napi_ok);
122
+ assert(len == gen.CHOICES_SIZE);
123
+
124
+ const out = @as([*]pkmn.Choice, @ptrCast(data.?))[0..gen.CHOICES_SIZE];
125
+ const n = battle.choices(player, request, out);
126
+ return js.Number.init(env, @as(u8, @bitCast(n)));
127
+ }
128
+ }.call;
129
+ }
package/src/lib/pkmn.zig CHANGED
@@ -1,4 +1,4 @@
1
- /// Configurated Options for the pkmn package.
1
+ /// Configured Options for the pkmn package.
2
2
  pub const options = @import("common/options.zig");
3
3
  /// Configures the behavior of the pkmn package.
4
4
  pub const Options = options.Options;
@@ -22,13 +22,16 @@ pub const Choice = @import("common/data.zig").Choice;
22
22
  /// considered terminal.
23
23
  pub const Result = @import("common/data.zig").Result;
24
24
 
25
+ // TODO
26
+ pub const Array = @import("common/array.zig").Array;
27
+ // TODO
28
+ pub const Optional = @import("common/optional.zig").Optional;
29
+
25
30
  /// Pokémon Showdown's RNG (backed by a Generation V & VI RNG).
26
31
  pub const PSRNG = @import("common/rng.zig").PSRNG;
27
32
 
28
33
  /// Namespace for helpers related to protocol message logging.
29
- pub const protocol = if (options.internal) struct {
30
- pub usingnamespace @import("common/protocol.zig");
31
- } else struct {
34
+ pub const protocol = if (options.internal) @import("common/protocol.zig") else struct {
32
35
  /// Logs protocol information to its `Writer` during a battle update when
33
36
  /// `options.log` is enabled.
34
37
  pub const Log = @import("common/protocol.zig").Log;
@@ -46,9 +49,86 @@ pub const protocol = if (options.internal) struct {
46
49
  pub const NULL = @import("common/protocol.zig").NULL;
47
50
  };
48
51
 
49
- /// Namespace for Generation I Pokémon
52
+ pub usingnamespace @import("common/rational.zig");
53
+
54
+ /// Namespace for cross-generation battle-related types.
55
+ pub const battle = @import("common/battle.zig");
56
+
57
+ /// Namespace for Generation I Pokémon.
50
58
  pub const gen1 = struct {
51
59
  pub usingnamespace @import("gen1/data.zig");
60
+ /// Tracks chance actions and their associated probability during a
61
+ /// Generation I battle update when `options.chance` is enabled.
62
+ pub const Chance = @import("gen1/chance.zig").Chance;
63
+ /// Namespace for types associated with tracking Generation I Pokémon chance outcomes.
64
+ pub const chance = struct {
65
+ /// Actions taken by a hypothetical "chance player" that convey
66
+ /// information about which RNG events were observed during a Generation
67
+ /// I battle `update`. This can additionally be provided as input to the
68
+ /// `update` call via the `Calc` when `options.calc` is enabled to
69
+ /// override the normal behavior of the RNG in order to force specific
70
+ /// outcomes.
71
+ pub const Actions = @import("gen1/chance.zig").Actions;
72
+ /// Information about the RNG that was observed during a Generation I
73
+ /// battle `update` for a single player.
74
+ pub const Action = @import("gen1/chance.zig").Action;
75
+ /// TODO
76
+ pub const Durations = @import("gen1/chance.zig").Durations;
77
+ /// TODO
78
+ pub const Duration = @import("gen1/chance.zig").Duration;
79
+ /// Null object pattern implementation of Generation I `Chance` which
80
+ /// does nothing, though chance tracking should additionally be turned
81
+ /// off entirely via `options.chance`.
82
+ pub const NULL = @import("gen1/chance.zig").NULL;
83
+ };
84
+ /// Allows for forcing the value of specific RNG events during a Generation I battle `update`
85
+ /// via `overrides` and tracks `summaries` of information relevant to damage calculation.
86
+ pub const Calc = @import("gen1/calc.zig").Calc;
87
+ /// Namespace for types associated with supported Generation I Pokémon damage calc features.
88
+ pub const calc = if (options.internal) @import("gen1/calc.zig") else struct {
89
+ /// Information relevant to damage calculation that occured during a Generation I
90
+ /// battle `update`.
91
+ pub const Summaries = @import("gen1/calc.zig").Summaries;
92
+ /// Information relevant to damage calculation that occured during a Generation I
93
+ /// battle `update` for a single player.
94
+ pub const Summary = @import("gen1/calc.zig").Summary;
95
+ /// Null object pattern implementation of Generation I `Calc` which does nothing,
96
+ /// though damage calculator support should additionally be turned off
97
+ /// entirely via `options.calc`.
98
+ pub const NULL = @import("gen1/calc.zig").NULL;
99
+ /// TODO
100
+ pub const MAX_FRONTIER = @import("gen1/calc.zig").MAX_FRONTIER;
101
+ /// TODO
102
+ pub const Rolls = @import("gen1/calc.zig").Rolls;
103
+ };
52
104
  /// Provides helpers for initializing Generation I Pokémon battles.
53
105
  pub const helpers = @import("gen1/helpers.zig");
54
106
  };
107
+
108
+ /// TODO
109
+ pub const gen2 = struct {
110
+ pub usingnamespace @import("gen2/data.zig");
111
+ pub const Chance = @import("gen2/chance.zig").Chance;
112
+ pub const chance = struct {
113
+ pub const Actions = @import("gen2/chance.zig").Actions;
114
+ pub const Action = @import("gen2/chance.zig").Action;
115
+ pub const Durations = @import("gen2/chance.zig").Durations;
116
+ pub const Duration = @import("gen2/chance.zig").Duration;
117
+ pub const NULL = @import("gen2/chance.zig").NULL;
118
+ };
119
+ pub const Calc = @import("gen2/calc.zig").Calc;
120
+ pub const calc = if (options.internal) @import("gen2/calc.zig") else struct {
121
+ pub const Summaries = @import("gen2/calc.zig").Summaries;
122
+ pub const Summary = @import("gen2/calc.zig").Summary;
123
+ pub const NULL = @import("gen2/calc.zig").NULL;
124
+ };
125
+ pub const helpers = @import("gen2/helpers.zig");
126
+ };
127
+
128
+ // Internal APIs used by other pkmn libraries, not actually part of the public API.
129
+ // NOTE: `pub usingnamespace struct { ... }` here results in a (false?) dependency loop
130
+ pub const js = if (options.internal) @import("common/js.zig") else {};
131
+ pub const bindings = if (options.internal) struct {
132
+ pub const node = @import("node.zig");
133
+ pub const wasm = @import("wasm.zig");
134
+ } else {};
@@ -0,0 +1,48 @@
1
+ const pkmn = @import("pkmn.zig");
2
+ const std = @import("std");
3
+
4
+ const assert = std.debug.assert;
5
+
6
+ const Enum = if (@hasField(std.builtin.Type, "enum")) .@"enum" else .Enum;
7
+
8
+ export const SHOWDOWN = pkmn.options.showdown;
9
+ export const LOG = pkmn.options.log;
10
+ export const CHANCE = pkmn.options.chance;
11
+ export const CALC = pkmn.options.calc;
12
+
13
+ export const GEN1_CHOICES_SIZE =
14
+ std.math.ceilPowerOfTwo(u32, @as(u32, @intCast(pkmn.gen1.CHOICES_SIZE))) catch unreachable;
15
+ export const GEN1_LOGS_SIZE =
16
+ std.math.ceilPowerOfTwo(u32, @as(u32, @intCast(pkmn.gen1.LOGS_SIZE))) catch unreachable;
17
+
18
+ export fn GEN1_update(
19
+ battle: *pkmn.gen1.Battle(pkmn.gen1.PRNG),
20
+ c1: pkmn.Choice,
21
+ c2: pkmn.Choice,
22
+ options: ?[*]u8,
23
+ ) pkmn.Result {
24
+ return (if (options) |o| result: {
25
+ const buf = @as([*]u8, @ptrCast(o))[0..pkmn.gen1.LOGS_SIZE];
26
+ var stream: pkmn.protocol.ByteStream = .{ .buffer = buf };
27
+ // TODO: extract out
28
+ var opts = pkmn.battle.options(
29
+ pkmn.protocol.FixedLog{ .writer = stream.writer() },
30
+ pkmn.gen1.chance.NULL,
31
+ pkmn.gen1.calc.NULL,
32
+ );
33
+ break :result battle.update(c1, c2, &opts);
34
+ } else battle.update(c1, c2, &pkmn.gen1.NULL)) catch unreachable;
35
+ }
36
+
37
+ export fn GEN1_choices(
38
+ battle: *pkmn.gen1.Battle(pkmn.gen1.PRNG),
39
+ player: u8,
40
+ request: u8,
41
+ buf: [*]u8,
42
+ ) u8 {
43
+ assert(player <= @field(@typeInfo(pkmn.Player), @tagName(Enum)).fields.len);
44
+ assert(request <= @field(@typeInfo(pkmn.Choice.Type), @tagName(Enum)).fields.len);
45
+
46
+ const len = GEN1_CHOICES_SIZE;
47
+ return battle.choices(@enumFromInt(player), @enumFromInt(request), @ptrCast(buf[0..len]));
48
+ }
@@ -0,0 +1,96 @@
1
+ /** @license MIT modified from Vadim Demedes's https://github.com/vadimdemedes/dom-chef */
2
+ type Attributes = JSX.IntrinsicElements['div'];
3
+ type DocumentFragmentConstructor = typeof DocumentFragment;
4
+ type ElementFunction = (props?: any) => HTMLElement;
5
+
6
+ declare global {
7
+ namespace JSX {
8
+ interface Element extends HTMLElement, DocumentFragment {
9
+ addEventListener: HTMLElement['addEventListener'];
10
+ removeEventListener: HTMLElement['removeEventListener'];
11
+ className: HTMLElement['className'];
12
+ }
13
+ }
14
+ }
15
+
16
+ interface JSXElementClassDocumentFragment extends DocumentFragment, JSX.ElementClass { }
17
+ interface Fragment {
18
+ prototype: JSXElementClassDocumentFragment;
19
+ new(): JSXElementClassDocumentFragment;
20
+ }
21
+
22
+ // https://github.com/preactjs/preact/blob/1bbd687c/src/constants.js#L3
23
+ const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
24
+
25
+ const isFragment = (type: DocumentFragmentConstructor | ElementFunction):
26
+ type is DocumentFragmentConstructor => type === DocumentFragment;
27
+
28
+ const setCSSProps = (element: HTMLElement, style: CSSStyleDeclaration) => {
29
+ for (const [name, value] of Object.entries(style)) {
30
+ if (name.startsWith('-')) {
31
+ element.style.setProperty(name, value);
32
+ } else if (typeof value === 'number' && !IS_NON_DIMENSIONAL.test(name)) {
33
+ element.style[name as any] = `${value as string}px`;
34
+ } else {
35
+ element.style[name as any] = value;
36
+ }
37
+ }
38
+ };
39
+
40
+ const setAttribute = (element: HTMLElement, name: string, value: string) => {
41
+ if (value !== undefined && value !== null) element.setAttribute(name, value);
42
+ };
43
+
44
+ const addChildren = (parent: Element | DocumentFragment, children: Node[]) => {
45
+ for (const child of children) {
46
+ if (child instanceof Node) {
47
+ parent.appendChild(child);
48
+ } else if (Array.isArray(child)) {
49
+ addChildren(parent, child);
50
+ } else if (typeof child !== 'boolean' && typeof child !== 'undefined' && child !== null) {
51
+ parent.appendChild(document.createTextNode(child));
52
+ }
53
+ }
54
+ };
55
+
56
+ // https://github.com/facebook/react/blob/3f899089/packages/react-dom/src/shared/DOMProperty.js#L288-L322
57
+ const FALSIFIABLE_ATTRIBUTES = ['contentEditable', 'draggable', 'spellCheck', 'value'];
58
+
59
+ export const h = (
60
+ type: DocumentFragmentConstructor | ElementFunction | string,
61
+ attributes?: Attributes,
62
+ ...children: Node[]
63
+ ) => {
64
+ if (typeof type !== 'string') {
65
+ const element = isFragment(type) ? document.createDocumentFragment() : type(attributes);
66
+ addChildren(element, children);
67
+ return element;
68
+ }
69
+
70
+ const element = document.createElement(type);
71
+ addChildren(element, children);
72
+ if (!attributes) return element;
73
+
74
+ for (let [name, value] of Object.entries(attributes)) {
75
+ if (name === 'htmlFor') name = 'for';
76
+
77
+ if (name === 'class' || name === 'className') {
78
+ const existingClassname = element.getAttribute('class') ?? '';
79
+ setAttribute(element, 'class', (existingClassname + ' ' + String(value)).trim());
80
+ } else if (name === 'style') {
81
+ setCSSProps(element, value);
82
+ } else if (name.startsWith('on')) {
83
+ const eventName = name.slice(2).toLowerCase().replace(/^-/, '');
84
+ element.addEventListener(eventName, value);
85
+ } else if (name === 'dangerouslySetInnerHTML' && '__html' in value) {
86
+ element.innerHTML = value.__html;
87
+ } else if (name !== 'key' && (FALSIFIABLE_ATTRIBUTES.includes(name) || value !== false)) {
88
+ setAttribute(element, name, value === true ? '' : value);
89
+ }
90
+ }
91
+
92
+ return element;
93
+ };
94
+
95
+ export const Fragment =
96
+ (typeof DocumentFragment === 'function' ? DocumentFragment : () => {}) as Fragment;