jaxs 0.3.2 → 0.4.2
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/jaxs.d.ts +648 -0
- package/dist/jaxs.js +810 -1071
- package/dist/jaxs.umd.cjs +1 -0
- package/package.json +41 -34
- package/.env +0 -1
- package/README.md +0 -15
- package/bun.lockb +0 -0
- package/bundle.ts +0 -5
- package/bunfig.toml +0 -0
- package/cypress/e2e/add-remove-nested-children.cy.js +0 -39
- package/cypress/e2e/add-remove-root-children.cy.js +0 -37
- package/cypress/e2e/svg-renders.cy.js +0 -10
- package/cypress/jaxs-apps/add-remove-nested-children.html +0 -12
- package/cypress/jaxs-apps/add-remove-nested-children.jsx +0 -85
- package/cypress/jaxs-apps/add-remove-root-children.html +0 -15
- package/cypress/jaxs-apps/add-remove-root-children.jsx +0 -54
- package/cypress/jaxs-apps/dist/add-remove-nested-children.afcab974.js +0 -1022
- package/cypress/jaxs-apps/dist/add-remove-nested-children.afcab974.js.map +0 -1
- package/cypress/jaxs-apps/dist/add-remove-nested-children.html +0 -12
- package/cypress/jaxs-apps/dist/add-remove-root-children.3bb9b3f5.js +0 -1665
- package/cypress/jaxs-apps/dist/add-remove-root-children.3bb9b3f5.js.map +0 -1
- package/cypress/jaxs-apps/dist/add-remove-root-children.fbb4ec9b.js +0 -1011
- package/cypress/jaxs-apps/dist/add-remove-root-children.fbb4ec9b.js.map +0 -1
- package/cypress/jaxs-apps/dist/add-remove-root-children.html +0 -15
- package/cypress/jaxs-apps/dist/svg.04290504.js +0 -644
- package/cypress/jaxs-apps/dist/svg.04290504.js.map +0 -1
- package/cypress/jaxs-apps/dist/svg.html +0 -11
- package/cypress/jaxs-apps/svg.html +0 -11
- package/cypress/jaxs-apps/svg.jsx +0 -15
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -20
- package/cypress.config.js +0 -10
- package/src/app.ts +0 -84
- package/src/debugging.js +0 -5
- package/src/jaxs.ts +0 -7
- package/src/jsx.js +0 -27
- package/src/messageBus.ts +0 -70
- package/src/navigation/findHref.js +0 -10
- package/src/navigation/routeState.js +0 -15
- package/src/navigation/setupHistory.js +0 -38
- package/src/navigation/setupNavigation.js +0 -25
- package/src/navigation.ts +0 -2
- package/src/rendering/change/compile.ts +0 -1
- package/src/rendering/change/instructions/attributes.ts +0 -81
- package/src/rendering/change/instructions/children.ts +0 -127
- package/src/rendering/change/instructions/element.ts +0 -49
- package/src/rendering/change/instructions/events.ts +0 -51
- package/src/rendering/change/instructions/generate.ts +0 -122
- package/src/rendering/change/instructions/idMap.js +0 -55
- package/src/rendering/change/instructions/node.ts +0 -55
- package/src/rendering/change/instructions/text.ts +0 -10
- package/src/rendering/change.ts +0 -139
- package/src/rendering/dom/attributesAndEvents.ts +0 -33
- package/src/rendering/dom/create.ts +0 -66
- package/src/rendering/dom/svg.ts +0 -18
- package/src/rendering/templates/bound.js +0 -56
- package/src/rendering/templates/children.ts +0 -99
- package/src/rendering/templates/root.ts +0 -55
- package/src/rendering/templates/tag.ts +0 -92
- package/src/rendering/templates/text.ts +0 -17
- package/src/state/equality.js +0 -36
- package/src/state/stores.js +0 -63
- package/src/state/testingTypes.js +0 -6
- package/src/state.js +0 -89
- package/src/types.ts +0 -160
- package/src/views/conditionals.jsx +0 -18
- package/src/views/link.jsx +0 -5
- package/src/views.js +0 -7
- package/tsconfig.json +0 -26
|
@@ -1,1011 +0,0 @@
|
|
|
1
|
-
// modules are defined as an array
|
|
2
|
-
// [ module function, map of requires ]
|
|
3
|
-
//
|
|
4
|
-
// map of requires is short require name -> numeric require
|
|
5
|
-
//
|
|
6
|
-
// anything defined in a previous bundle is accessed via the
|
|
7
|
-
// orig method which is the require for previous bundles
|
|
8
|
-
|
|
9
|
-
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
|
10
|
-
/* eslint-disable no-undef */
|
|
11
|
-
var globalObject =
|
|
12
|
-
typeof globalThis !== 'undefined'
|
|
13
|
-
? globalThis
|
|
14
|
-
: typeof self !== 'undefined'
|
|
15
|
-
? self
|
|
16
|
-
: typeof window !== 'undefined'
|
|
17
|
-
? window
|
|
18
|
-
: typeof global !== 'undefined'
|
|
19
|
-
? global
|
|
20
|
-
: {};
|
|
21
|
-
/* eslint-enable no-undef */
|
|
22
|
-
|
|
23
|
-
// Save the require from previous bundle to this closure if any
|
|
24
|
-
var previousRequire =
|
|
25
|
-
typeof globalObject[parcelRequireName] === 'function' &&
|
|
26
|
-
globalObject[parcelRequireName];
|
|
27
|
-
|
|
28
|
-
var cache = previousRequire.cache || {};
|
|
29
|
-
// Do not use `require` to prevent Webpack from trying to bundle this call
|
|
30
|
-
var nodeRequire =
|
|
31
|
-
typeof module !== 'undefined' &&
|
|
32
|
-
typeof module.require === 'function' &&
|
|
33
|
-
module.require.bind(module);
|
|
34
|
-
|
|
35
|
-
function newRequire(name, jumped) {
|
|
36
|
-
if (!cache[name]) {
|
|
37
|
-
if (!modules[name]) {
|
|
38
|
-
// if we cannot find the module within our internal map or
|
|
39
|
-
// cache jump to the current global require ie. the last bundle
|
|
40
|
-
// that was added to the page.
|
|
41
|
-
var currentRequire =
|
|
42
|
-
typeof globalObject[parcelRequireName] === 'function' &&
|
|
43
|
-
globalObject[parcelRequireName];
|
|
44
|
-
if (!jumped && currentRequire) {
|
|
45
|
-
return currentRequire(name, true);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// If there are other bundles on this page the require from the
|
|
49
|
-
// previous one is saved to 'previousRequire'. Repeat this as
|
|
50
|
-
// many times as there are bundles until the module is found or
|
|
51
|
-
// we exhaust the require chain.
|
|
52
|
-
if (previousRequire) {
|
|
53
|
-
return previousRequire(name, true);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Try the node require function if it exists.
|
|
57
|
-
if (nodeRequire && typeof name === 'string') {
|
|
58
|
-
return nodeRequire(name);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
var err = new Error("Cannot find module '" + name + "'");
|
|
62
|
-
err.code = 'MODULE_NOT_FOUND';
|
|
63
|
-
throw err;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
localRequire.resolve = resolve;
|
|
67
|
-
localRequire.cache = {};
|
|
68
|
-
|
|
69
|
-
var module = (cache[name] = new newRequire.Module(name));
|
|
70
|
-
|
|
71
|
-
modules[name][0].call(
|
|
72
|
-
module.exports,
|
|
73
|
-
localRequire,
|
|
74
|
-
module,
|
|
75
|
-
module.exports,
|
|
76
|
-
this
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return cache[name].exports;
|
|
81
|
-
|
|
82
|
-
function localRequire(x) {
|
|
83
|
-
var res = localRequire.resolve(x);
|
|
84
|
-
return res === false ? {} : newRequire(res);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function resolve(x) {
|
|
88
|
-
var id = modules[name][1][x];
|
|
89
|
-
return id != null ? id : x;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function Module(moduleName) {
|
|
94
|
-
this.id = moduleName;
|
|
95
|
-
this.bundle = newRequire;
|
|
96
|
-
this.exports = {};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
newRequire.isParcelRequire = true;
|
|
100
|
-
newRequire.Module = Module;
|
|
101
|
-
newRequire.modules = modules;
|
|
102
|
-
newRequire.cache = cache;
|
|
103
|
-
newRequire.parent = previousRequire;
|
|
104
|
-
newRequire.register = function (id, exports) {
|
|
105
|
-
modules[id] = [
|
|
106
|
-
function (require, module) {
|
|
107
|
-
module.exports = exports;
|
|
108
|
-
},
|
|
109
|
-
{},
|
|
110
|
-
];
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
Object.defineProperty(newRequire, 'root', {
|
|
114
|
-
get: function () {
|
|
115
|
-
return globalObject[parcelRequireName];
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
globalObject[parcelRequireName] = newRequire;
|
|
120
|
-
|
|
121
|
-
for (var i = 0; i < entry.length; i++) {
|
|
122
|
-
newRequire(entry[i]);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (mainEntry) {
|
|
126
|
-
// Expose entry point to Node, AMD or browser globals
|
|
127
|
-
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
|
128
|
-
var mainExports = newRequire(mainEntry);
|
|
129
|
-
|
|
130
|
-
// CommonJS
|
|
131
|
-
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
|
132
|
-
module.exports = mainExports;
|
|
133
|
-
|
|
134
|
-
// RequireJS
|
|
135
|
-
} else if (typeof define === 'function' && define.amd) {
|
|
136
|
-
define(function () {
|
|
137
|
-
return mainExports;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// <script>
|
|
141
|
-
} else if (globalName) {
|
|
142
|
-
this[globalName] = mainExports;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
})({"b8Sd7":[function(require,module,exports) {
|
|
146
|
-
var global = arguments[3];
|
|
147
|
-
var HMR_HOST = null;
|
|
148
|
-
var HMR_PORT = null;
|
|
149
|
-
var HMR_SECURE = false;
|
|
150
|
-
var HMR_ENV_HASH = "d6ea1d42532a7575";
|
|
151
|
-
module.bundle.HMR_BUNDLE_ID = "30a85c10fbb4ec9b";
|
|
152
|
-
"use strict";
|
|
153
|
-
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*::
|
|
154
|
-
import type {
|
|
155
|
-
HMRAsset,
|
|
156
|
-
HMRMessage,
|
|
157
|
-
} from '@parcel/reporter-dev-server/src/HMRServer.js';
|
|
158
|
-
interface ParcelRequire {
|
|
159
|
-
(string): mixed;
|
|
160
|
-
cache: {|[string]: ParcelModule|};
|
|
161
|
-
hotData: {|[string]: mixed|};
|
|
162
|
-
Module: any;
|
|
163
|
-
parent: ?ParcelRequire;
|
|
164
|
-
isParcelRequire: true;
|
|
165
|
-
modules: {|[string]: [Function, {|[string]: string|}]|};
|
|
166
|
-
HMR_BUNDLE_ID: string;
|
|
167
|
-
root: ParcelRequire;
|
|
168
|
-
}
|
|
169
|
-
interface ParcelModule {
|
|
170
|
-
hot: {|
|
|
171
|
-
data: mixed,
|
|
172
|
-
accept(cb: (Function) => void): void,
|
|
173
|
-
dispose(cb: (mixed) => void): void,
|
|
174
|
-
// accept(deps: Array<string> | string, cb: (Function) => void): void,
|
|
175
|
-
// decline(): void,
|
|
176
|
-
_acceptCallbacks: Array<(Function) => void>,
|
|
177
|
-
_disposeCallbacks: Array<(mixed) => void>,
|
|
178
|
-
|};
|
|
179
|
-
}
|
|
180
|
-
interface ExtensionContext {
|
|
181
|
-
runtime: {|
|
|
182
|
-
reload(): void,
|
|
183
|
-
getURL(url: string): string;
|
|
184
|
-
getManifest(): {manifest_version: number, ...};
|
|
185
|
-
|};
|
|
186
|
-
}
|
|
187
|
-
declare var module: {bundle: ParcelRequire, ...};
|
|
188
|
-
declare var HMR_HOST: string;
|
|
189
|
-
declare var HMR_PORT: string;
|
|
190
|
-
declare var HMR_ENV_HASH: string;
|
|
191
|
-
declare var HMR_SECURE: boolean;
|
|
192
|
-
declare var chrome: ExtensionContext;
|
|
193
|
-
declare var browser: ExtensionContext;
|
|
194
|
-
declare var __parcel__import__: (string) => Promise<void>;
|
|
195
|
-
declare var __parcel__importScripts__: (string) => Promise<void>;
|
|
196
|
-
declare var globalThis: typeof self;
|
|
197
|
-
declare var ServiceWorkerGlobalScope: Object;
|
|
198
|
-
*/ var OVERLAY_ID = "__parcel__error__overlay__";
|
|
199
|
-
var OldModule = module.bundle.Module;
|
|
200
|
-
function Module(moduleName) {
|
|
201
|
-
OldModule.call(this, moduleName);
|
|
202
|
-
this.hot = {
|
|
203
|
-
data: module.bundle.hotData[moduleName],
|
|
204
|
-
_acceptCallbacks: [],
|
|
205
|
-
_disposeCallbacks: [],
|
|
206
|
-
accept: function(fn) {
|
|
207
|
-
this._acceptCallbacks.push(fn || function() {});
|
|
208
|
-
},
|
|
209
|
-
dispose: function(fn) {
|
|
210
|
-
this._disposeCallbacks.push(fn);
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
module.bundle.hotData[moduleName] = undefined;
|
|
214
|
-
}
|
|
215
|
-
module.bundle.Module = Module;
|
|
216
|
-
module.bundle.hotData = {};
|
|
217
|
-
var checkedAssets /*: {|[string]: boolean|} */ , assetsToDispose /*: Array<[ParcelRequire, string]> */ , assetsToAccept /*: Array<[ParcelRequire, string]> */ ;
|
|
218
|
-
function getHostname() {
|
|
219
|
-
return HMR_HOST || (location.protocol.indexOf("http") === 0 ? location.hostname : "localhost");
|
|
220
|
-
}
|
|
221
|
-
function getPort() {
|
|
222
|
-
return HMR_PORT || location.port;
|
|
223
|
-
}
|
|
224
|
-
// eslint-disable-next-line no-redeclare
|
|
225
|
-
var parent = module.bundle.parent;
|
|
226
|
-
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== "undefined") {
|
|
227
|
-
var hostname = getHostname();
|
|
228
|
-
var port = getPort();
|
|
229
|
-
var protocol = HMR_SECURE || location.protocol == "https:" && ![
|
|
230
|
-
"localhost",
|
|
231
|
-
"127.0.0.1",
|
|
232
|
-
"0.0.0.0"
|
|
233
|
-
].includes(hostname) ? "wss" : "ws";
|
|
234
|
-
var ws;
|
|
235
|
-
try {
|
|
236
|
-
ws = new WebSocket(protocol + "://" + hostname + (port ? ":" + port : "") + "/");
|
|
237
|
-
} catch (err) {
|
|
238
|
-
if (err.message) console.error(err.message);
|
|
239
|
-
ws = {};
|
|
240
|
-
}
|
|
241
|
-
// Web extension context
|
|
242
|
-
var extCtx = typeof browser === "undefined" ? typeof chrome === "undefined" ? null : chrome : browser;
|
|
243
|
-
// Safari doesn't support sourceURL in error stacks.
|
|
244
|
-
// eval may also be disabled via CSP, so do a quick check.
|
|
245
|
-
var supportsSourceURL = false;
|
|
246
|
-
try {
|
|
247
|
-
(0, eval)('throw new Error("test"); //# sourceURL=test.js');
|
|
248
|
-
} catch (err) {
|
|
249
|
-
supportsSourceURL = err.stack.includes("test.js");
|
|
250
|
-
}
|
|
251
|
-
// $FlowFixMe
|
|
252
|
-
ws.onmessage = async function(event /*: {data: string, ...} */ ) {
|
|
253
|
-
checkedAssets = {} /*: {|[string]: boolean|} */ ;
|
|
254
|
-
assetsToAccept = [];
|
|
255
|
-
assetsToDispose = [];
|
|
256
|
-
var data /*: HMRMessage */ = JSON.parse(event.data);
|
|
257
|
-
if (data.type === "update") {
|
|
258
|
-
// Remove error overlay if there is one
|
|
259
|
-
if (typeof document !== "undefined") removeErrorOverlay();
|
|
260
|
-
let assets = data.assets.filter((asset)=>asset.envHash === HMR_ENV_HASH);
|
|
261
|
-
// Handle HMR Update
|
|
262
|
-
let handled = assets.every((asset)=>{
|
|
263
|
-
return asset.type === "css" || asset.type === "js" && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
|
|
264
|
-
});
|
|
265
|
-
if (handled) {
|
|
266
|
-
console.clear();
|
|
267
|
-
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
|
268
|
-
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") window.dispatchEvent(new CustomEvent("parcelhmraccept"));
|
|
269
|
-
await hmrApplyUpdates(assets);
|
|
270
|
-
// Dispose all old assets.
|
|
271
|
-
let processedAssets = {} /*: {|[string]: boolean|} */ ;
|
|
272
|
-
for(let i = 0; i < assetsToDispose.length; i++){
|
|
273
|
-
let id = assetsToDispose[i][1];
|
|
274
|
-
if (!processedAssets[id]) {
|
|
275
|
-
hmrDispose(assetsToDispose[i][0], id);
|
|
276
|
-
processedAssets[id] = true;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
// Run accept callbacks. This will also re-execute other disposed assets in topological order.
|
|
280
|
-
processedAssets = {};
|
|
281
|
-
for(let i = 0; i < assetsToAccept.length; i++){
|
|
282
|
-
let id = assetsToAccept[i][1];
|
|
283
|
-
if (!processedAssets[id]) {
|
|
284
|
-
hmrAccept(assetsToAccept[i][0], id);
|
|
285
|
-
processedAssets[id] = true;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
} else fullReload();
|
|
289
|
-
}
|
|
290
|
-
if (data.type === "error") {
|
|
291
|
-
// Log parcel errors to console
|
|
292
|
-
for (let ansiDiagnostic of data.diagnostics.ansi){
|
|
293
|
-
let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
|
|
294
|
-
console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + "\n" + stack + "\n\n" + ansiDiagnostic.hints.join("\n"));
|
|
295
|
-
}
|
|
296
|
-
if (typeof document !== "undefined") {
|
|
297
|
-
// Render the fancy html overlay
|
|
298
|
-
removeErrorOverlay();
|
|
299
|
-
var overlay = createErrorOverlay(data.diagnostics.html);
|
|
300
|
-
// $FlowFixMe
|
|
301
|
-
document.body.appendChild(overlay);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
ws.onerror = function(e) {
|
|
306
|
-
if (e.message) console.error(e.message);
|
|
307
|
-
};
|
|
308
|
-
ws.onclose = function() {
|
|
309
|
-
console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost");
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
function removeErrorOverlay() {
|
|
313
|
-
var overlay = document.getElementById(OVERLAY_ID);
|
|
314
|
-
if (overlay) {
|
|
315
|
-
overlay.remove();
|
|
316
|
-
console.log("[parcel] \u2728 Error resolved");
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
function createErrorOverlay(diagnostics) {
|
|
320
|
-
var overlay = document.createElement("div");
|
|
321
|
-
overlay.id = OVERLAY_ID;
|
|
322
|
-
let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
|
|
323
|
-
for (let diagnostic of diagnostics){
|
|
324
|
-
let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{
|
|
325
|
-
return `${p}
|
|
326
|
-
<a href="/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a>
|
|
327
|
-
${frame.code}`;
|
|
328
|
-
}, "") : diagnostic.stack;
|
|
329
|
-
errorHTML += `
|
|
330
|
-
<div>
|
|
331
|
-
<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">
|
|
332
|
-
\u{1F6A8} ${diagnostic.message}
|
|
333
|
-
</div>
|
|
334
|
-
<pre>${stack}</pre>
|
|
335
|
-
<div>
|
|
336
|
-
${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + "</div>").join("")}
|
|
337
|
-
</div>
|
|
338
|
-
${diagnostic.documentation ? `<div>\u{1F4DD} <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ""}
|
|
339
|
-
</div>
|
|
340
|
-
`;
|
|
341
|
-
}
|
|
342
|
-
errorHTML += "</div>";
|
|
343
|
-
overlay.innerHTML = errorHTML;
|
|
344
|
-
return overlay;
|
|
345
|
-
}
|
|
346
|
-
function fullReload() {
|
|
347
|
-
if ("reload" in location) location.reload();
|
|
348
|
-
else if (extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload();
|
|
349
|
-
}
|
|
350
|
-
function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ {
|
|
351
|
-
var modules = bundle.modules;
|
|
352
|
-
if (!modules) return [];
|
|
353
|
-
var parents = [];
|
|
354
|
-
var k, d, dep;
|
|
355
|
-
for(k in modules)for(d in modules[k][1]){
|
|
356
|
-
dep = modules[k][1][d];
|
|
357
|
-
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([
|
|
358
|
-
bundle,
|
|
359
|
-
k
|
|
360
|
-
]);
|
|
361
|
-
}
|
|
362
|
-
if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id));
|
|
363
|
-
return parents;
|
|
364
|
-
}
|
|
365
|
-
function updateLink(link) {
|
|
366
|
-
var href = link.getAttribute("href");
|
|
367
|
-
if (!href) return;
|
|
368
|
-
var newLink = link.cloneNode();
|
|
369
|
-
newLink.onload = function() {
|
|
370
|
-
if (link.parentNode !== null) // $FlowFixMe
|
|
371
|
-
link.parentNode.removeChild(link);
|
|
372
|
-
};
|
|
373
|
-
newLink.setAttribute("href", // $FlowFixMe
|
|
374
|
-
href.split("?")[0] + "?" + Date.now());
|
|
375
|
-
// $FlowFixMe
|
|
376
|
-
link.parentNode.insertBefore(newLink, link.nextSibling);
|
|
377
|
-
}
|
|
378
|
-
var cssTimeout = null;
|
|
379
|
-
function reloadCSS() {
|
|
380
|
-
if (cssTimeout) return;
|
|
381
|
-
cssTimeout = setTimeout(function() {
|
|
382
|
-
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
|
383
|
-
for(var i = 0; i < links.length; i++){
|
|
384
|
-
// $FlowFixMe[incompatible-type]
|
|
385
|
-
var href /*: string */ = links[i].getAttribute("href");
|
|
386
|
-
var hostname = getHostname();
|
|
387
|
-
var servedFromHMRServer = hostname === "localhost" ? new RegExp("^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):" + getPort()).test(href) : href.indexOf(hostname + ":" + getPort());
|
|
388
|
-
var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer;
|
|
389
|
-
if (!absolute) updateLink(links[i]);
|
|
390
|
-
}
|
|
391
|
-
cssTimeout = null;
|
|
392
|
-
}, 50);
|
|
393
|
-
}
|
|
394
|
-
function hmrDownload(asset) {
|
|
395
|
-
if (asset.type === "js") {
|
|
396
|
-
if (typeof document !== "undefined") {
|
|
397
|
-
let script = document.createElement("script");
|
|
398
|
-
script.src = asset.url + "?t=" + Date.now();
|
|
399
|
-
if (asset.outputFormat === "esmodule") script.type = "module";
|
|
400
|
-
return new Promise((resolve, reject)=>{
|
|
401
|
-
var _document$head;
|
|
402
|
-
script.onload = ()=>resolve(script);
|
|
403
|
-
script.onerror = reject;
|
|
404
|
-
(_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script);
|
|
405
|
-
});
|
|
406
|
-
} else if (typeof importScripts === "function") {
|
|
407
|
-
// Worker scripts
|
|
408
|
-
if (asset.outputFormat === "esmodule") return import(asset.url + "?t=" + Date.now());
|
|
409
|
-
else return new Promise((resolve, reject)=>{
|
|
410
|
-
try {
|
|
411
|
-
importScripts(asset.url + "?t=" + Date.now());
|
|
412
|
-
resolve();
|
|
413
|
-
} catch (err) {
|
|
414
|
-
reject(err);
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
async function hmrApplyUpdates(assets) {
|
|
421
|
-
global.parcelHotUpdate = Object.create(null);
|
|
422
|
-
let scriptsToRemove;
|
|
423
|
-
try {
|
|
424
|
-
// If sourceURL comments aren't supported in eval, we need to load
|
|
425
|
-
// the update from the dev server over HTTP so that stack traces
|
|
426
|
-
// are correct in errors/logs. This is much slower than eval, so
|
|
427
|
-
// we only do it if needed (currently just Safari).
|
|
428
|
-
// https://bugs.webkit.org/show_bug.cgi?id=137297
|
|
429
|
-
// This path is also taken if a CSP disallows eval.
|
|
430
|
-
if (!supportsSourceURL) {
|
|
431
|
-
let promises = assets.map((asset)=>{
|
|
432
|
-
var _hmrDownload;
|
|
433
|
-
return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{
|
|
434
|
-
// Web extension fix
|
|
435
|
-
if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3 && typeof ServiceWorkerGlobalScope != "undefined" && global instanceof ServiceWorkerGlobalScope) {
|
|
436
|
-
extCtx.runtime.reload();
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
throw err;
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
scriptsToRemove = await Promise.all(promises);
|
|
443
|
-
}
|
|
444
|
-
assets.forEach(function(asset) {
|
|
445
|
-
hmrApply(module.bundle.root, asset);
|
|
446
|
-
});
|
|
447
|
-
} finally{
|
|
448
|
-
delete global.parcelHotUpdate;
|
|
449
|
-
if (scriptsToRemove) scriptsToRemove.forEach((script)=>{
|
|
450
|
-
if (script) {
|
|
451
|
-
var _document$head2;
|
|
452
|
-
(_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script);
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) {
|
|
458
|
-
var modules = bundle.modules;
|
|
459
|
-
if (!modules) return;
|
|
460
|
-
if (asset.type === "css") reloadCSS();
|
|
461
|
-
else if (asset.type === "js") {
|
|
462
|
-
let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
|
|
463
|
-
if (deps) {
|
|
464
|
-
if (modules[asset.id]) {
|
|
465
|
-
// Remove dependencies that are removed and will become orphaned.
|
|
466
|
-
// This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload.
|
|
467
|
-
let oldDeps = modules[asset.id][1];
|
|
468
|
-
for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
|
|
469
|
-
let id = oldDeps[dep];
|
|
470
|
-
let parents = getParents(module.bundle.root, id);
|
|
471
|
-
if (parents.length === 1) hmrDelete(module.bundle.root, id);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
if (supportsSourceURL) // Global eval. We would use `new Function` here but browser
|
|
475
|
-
// support for source maps is better with eval.
|
|
476
|
-
(0, eval)(asset.output);
|
|
477
|
-
// $FlowFixMe
|
|
478
|
-
let fn = global.parcelHotUpdate[asset.id];
|
|
479
|
-
modules[asset.id] = [
|
|
480
|
-
fn,
|
|
481
|
-
deps
|
|
482
|
-
];
|
|
483
|
-
} else if (bundle.parent) hmrApply(bundle.parent, asset);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function hmrDelete(bundle, id) {
|
|
487
|
-
let modules = bundle.modules;
|
|
488
|
-
if (!modules) return;
|
|
489
|
-
if (modules[id]) {
|
|
490
|
-
// Collect dependencies that will become orphaned when this module is deleted.
|
|
491
|
-
let deps = modules[id][1];
|
|
492
|
-
let orphans = [];
|
|
493
|
-
for(let dep in deps){
|
|
494
|
-
let parents = getParents(module.bundle.root, deps[dep]);
|
|
495
|
-
if (parents.length === 1) orphans.push(deps[dep]);
|
|
496
|
-
}
|
|
497
|
-
// Delete the module. This must be done before deleting dependencies in case of circular dependencies.
|
|
498
|
-
delete modules[id];
|
|
499
|
-
delete bundle.cache[id];
|
|
500
|
-
// Now delete the orphans.
|
|
501
|
-
orphans.forEach((id)=>{
|
|
502
|
-
hmrDelete(module.bundle.root, id);
|
|
503
|
-
});
|
|
504
|
-
} else if (bundle.parent) hmrDelete(bundle.parent, id);
|
|
505
|
-
}
|
|
506
|
-
function hmrAcceptCheck(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
|
507
|
-
if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true;
|
|
508
|
-
// Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
|
|
509
|
-
let parents = getParents(module.bundle.root, id);
|
|
510
|
-
let accepted = false;
|
|
511
|
-
while(parents.length > 0){
|
|
512
|
-
let v = parents.shift();
|
|
513
|
-
let a = hmrAcceptCheckOne(v[0], v[1], null);
|
|
514
|
-
if (a) // If this parent accepts, stop traversing upward, but still consider siblings.
|
|
515
|
-
accepted = true;
|
|
516
|
-
else {
|
|
517
|
-
// Otherwise, queue the parents in the next level upward.
|
|
518
|
-
let p = getParents(module.bundle.root, v[1]);
|
|
519
|
-
if (p.length === 0) {
|
|
520
|
-
// If there are no parents, then we've reached an entry without accepting. Reload.
|
|
521
|
-
accepted = false;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
parents.push(...p);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
return accepted;
|
|
528
|
-
}
|
|
529
|
-
function hmrAcceptCheckOne(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
|
530
|
-
var modules = bundle.modules;
|
|
531
|
-
if (!modules) return;
|
|
532
|
-
if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
|
|
533
|
-
// If we reached the root bundle without finding where the asset should go,
|
|
534
|
-
// there's nothing to do. Mark as "accepted" so we don't reload the page.
|
|
535
|
-
if (!bundle.parent) return true;
|
|
536
|
-
return hmrAcceptCheck(bundle.parent, id, depsByBundle);
|
|
537
|
-
}
|
|
538
|
-
if (checkedAssets[id]) return true;
|
|
539
|
-
checkedAssets[id] = true;
|
|
540
|
-
var cached = bundle.cache[id];
|
|
541
|
-
assetsToDispose.push([
|
|
542
|
-
bundle,
|
|
543
|
-
id
|
|
544
|
-
]);
|
|
545
|
-
if (!cached || cached.hot && cached.hot._acceptCallbacks.length) {
|
|
546
|
-
assetsToAccept.push([
|
|
547
|
-
bundle,
|
|
548
|
-
id
|
|
549
|
-
]);
|
|
550
|
-
return true;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
function hmrDispose(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
|
554
|
-
var cached = bundle.cache[id];
|
|
555
|
-
bundle.hotData[id] = {};
|
|
556
|
-
if (cached && cached.hot) cached.hot.data = bundle.hotData[id];
|
|
557
|
-
if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) {
|
|
558
|
-
cb(bundle.hotData[id]);
|
|
559
|
-
});
|
|
560
|
-
delete bundle.cache[id];
|
|
561
|
-
}
|
|
562
|
-
function hmrAccept(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
|
563
|
-
// Execute the module.
|
|
564
|
-
bundle(id);
|
|
565
|
-
// Run the accept callbacks in the new version of the module.
|
|
566
|
-
var cached = bundle.cache[id];
|
|
567
|
-
if (cached && cached.hot && cached.hot._acceptCallbacks.length) cached.hot._acceptCallbacks.forEach(function(cb) {
|
|
568
|
-
var assetsToAlsoAccept = cb(function() {
|
|
569
|
-
return getParents(module.bundle.root, id);
|
|
570
|
-
});
|
|
571
|
-
if (assetsToAlsoAccept && assetsToAccept.length) {
|
|
572
|
-
assetsToAlsoAccept.forEach(function(a) {
|
|
573
|
-
hmrDispose(a[0], a[1]);
|
|
574
|
-
});
|
|
575
|
-
// $FlowFixMe[method-unbinding]
|
|
576
|
-
assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept);
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
},{}],"faxFZ":[function(require,module,exports) {
|
|
582
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
583
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
584
|
-
parcelHelpers.export(exports, "MainContentTemplate", ()=>MainContentTemplate);
|
|
585
|
-
var _jaxsJs = require("../../dist/jaxs.js");
|
|
586
|
-
var _viewsJs = require("../../src/views.js");
|
|
587
|
-
const { If, Unless } = (0, _viewsJs.views);
|
|
588
|
-
const app = (0, _jaxsJs.createApp)();
|
|
589
|
-
const MainContentTemplate = ({ inMembers })=>{
|
|
590
|
-
return /*#__PURE__*/ (0, _jaxsJs.jsx)((0, _jaxsJs.jsx).fragment, null, /*#__PURE__*/ (0, _jaxsJs.jsx)(Unless, {
|
|
591
|
-
condition: inMembers,
|
|
592
|
-
__source: {
|
|
593
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
594
|
-
lineNumber: 10,
|
|
595
|
-
columnNumber: 7
|
|
596
|
-
},
|
|
597
|
-
__self: undefined
|
|
598
|
-
}, /*#__PURE__*/ (0, _jaxsJs.jsx)("form", {
|
|
599
|
-
__source: {
|
|
600
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
601
|
-
lineNumber: 11,
|
|
602
|
-
columnNumber: 9
|
|
603
|
-
},
|
|
604
|
-
__self: undefined
|
|
605
|
-
}, /*#__PURE__*/ (0, _jaxsJs.jsx)("p", {
|
|
606
|
-
class: "guest-content",
|
|
607
|
-
__source: {
|
|
608
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
609
|
-
lineNumber: 12,
|
|
610
|
-
columnNumber: 11
|
|
611
|
-
},
|
|
612
|
-
__self: undefined
|
|
613
|
-
}, "You are a guest, and I guess that is fine."), /*#__PURE__*/ (0, _jaxsJs.jsx)("input", {
|
|
614
|
-
type: "submit",
|
|
615
|
-
value: "Agree! or something",
|
|
616
|
-
__source: {
|
|
617
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
618
|
-
lineNumber: 15,
|
|
619
|
-
columnNumber: 11
|
|
620
|
-
},
|
|
621
|
-
__self: undefined
|
|
622
|
-
}))), /*#__PURE__*/ (0, _jaxsJs.jsx)(If, {
|
|
623
|
-
condition: inMembers,
|
|
624
|
-
__source: {
|
|
625
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
626
|
-
lineNumber: 18,
|
|
627
|
-
columnNumber: 7
|
|
628
|
-
},
|
|
629
|
-
__self: undefined
|
|
630
|
-
}, /*#__PURE__*/ (0, _jaxsJs.jsx)("h1", {
|
|
631
|
-
class: "member-content",
|
|
632
|
-
__source: {
|
|
633
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
634
|
-
lineNumber: 19,
|
|
635
|
-
columnNumber: 9
|
|
636
|
-
},
|
|
637
|
-
__self: undefined
|
|
638
|
-
}, "Oh great crickets!"), /*#__PURE__*/ (0, _jaxsJs.jsx)("p", {
|
|
639
|
-
class: "member-content",
|
|
640
|
-
__source: {
|
|
641
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
642
|
-
lineNumber: 20,
|
|
643
|
-
columnNumber: 9
|
|
644
|
-
},
|
|
645
|
-
__self: undefined
|
|
646
|
-
}, "Sing me a tale of private content.")));
|
|
647
|
-
};
|
|
648
|
-
const ProfileAreaTemplate = ({ inMembers })=>{
|
|
649
|
-
return /*#__PURE__*/ (0, _jaxsJs.jsx)(Unless, {
|
|
650
|
-
condition: inMembers,
|
|
651
|
-
__source: {
|
|
652
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
653
|
-
lineNumber: 27,
|
|
654
|
-
columnNumber: 5
|
|
655
|
-
},
|
|
656
|
-
__self: undefined
|
|
657
|
-
}, /*#__PURE__*/ (0, _jaxsJs.jsx)("a", {
|
|
658
|
-
href: "/members",
|
|
659
|
-
onClick: "goToHref",
|
|
660
|
-
class: "exclusive-link",
|
|
661
|
-
__source: {
|
|
662
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
663
|
-
lineNumber: 28,
|
|
664
|
-
columnNumber: 7
|
|
665
|
-
},
|
|
666
|
-
__self: undefined
|
|
667
|
-
}, "Go to members area"));
|
|
668
|
-
};
|
|
669
|
-
const viewModel = ({ route })=>{
|
|
670
|
-
return {
|
|
671
|
-
inMembers: route && route.path && route.path.match(/members/)
|
|
672
|
-
};
|
|
673
|
-
};
|
|
674
|
-
const MainContent = (0, _jaxsJs.bind)({
|
|
675
|
-
Template: MainContentTemplate,
|
|
676
|
-
viewModel,
|
|
677
|
-
subscriptions: [
|
|
678
|
-
"route"
|
|
679
|
-
]
|
|
680
|
-
});
|
|
681
|
-
const ProfileArea = (0, _jaxsJs.bind)({
|
|
682
|
-
Template: ProfileAreaTemplate,
|
|
683
|
-
viewModel,
|
|
684
|
-
subscriptions: [
|
|
685
|
-
"route"
|
|
686
|
-
]
|
|
687
|
-
});
|
|
688
|
-
app.render(/*#__PURE__*/ (0, _jaxsJs.jsx)(MainContent, {
|
|
689
|
-
__source: {
|
|
690
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
691
|
-
lineNumber: 53,
|
|
692
|
-
columnNumber: 12
|
|
693
|
-
},
|
|
694
|
-
__self: undefined
|
|
695
|
-
}), "#main-content");
|
|
696
|
-
app.render(/*#__PURE__*/ (0, _jaxsJs.jsx)(ProfileArea, {
|
|
697
|
-
__source: {
|
|
698
|
-
fileName: "cypress/jaxs-apps/add-remove-root-children.jsx",
|
|
699
|
-
lineNumber: 54,
|
|
700
|
-
columnNumber: 12
|
|
701
|
-
},
|
|
702
|
-
__self: undefined
|
|
703
|
-
}), "#profile-area");
|
|
704
|
-
|
|
705
|
-
},{"../../dist/jaxs.js":"bAfYR","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","../../src/views.js":"1F1Bq"}],"1F1Bq":[function(require,module,exports) {
|
|
706
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
707
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
708
|
-
parcelHelpers.export(exports, "views", ()=>views);
|
|
709
|
-
var _conditionalsJsx = require("./views/conditionals.jsx");
|
|
710
|
-
var _linkJsx = require("./views/link.jsx");
|
|
711
|
-
const views = {
|
|
712
|
-
..._conditionalsJsx,
|
|
713
|
-
Link: (0, _linkJsx.Link)
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
},{"./views/conditionals.jsx":"7Zl6n","./views/link.jsx":"4T9d8","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"7Zl6n":[function(require,module,exports) {
|
|
717
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
718
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
719
|
-
parcelHelpers.export(exports, "If", ()=>If);
|
|
720
|
-
parcelHelpers.export(exports, "Unless", ()=>Unless);
|
|
721
|
-
parcelHelpers.export(exports, "IfElse", ()=>IfElse);
|
|
722
|
-
var _jsx = require("../jsx");
|
|
723
|
-
var _jsxDefault = parcelHelpers.interopDefault(_jsx);
|
|
724
|
-
const If = ({ condition, children })=>{
|
|
725
|
-
if (!condition) return;
|
|
726
|
-
return /*#__PURE__*/ (0, _jsxDefault.default)((0, _jsxDefault.default).fragment, null, children);
|
|
727
|
-
};
|
|
728
|
-
const Unless = ({ condition, children })=>{
|
|
729
|
-
if (condition) return;
|
|
730
|
-
return /*#__PURE__*/ (0, _jsxDefault.default)((0, _jsxDefault.default).fragment, null, children);
|
|
731
|
-
};
|
|
732
|
-
const IfElse = ({ condition, children })=>{
|
|
733
|
-
const [first, ...rest] = children;
|
|
734
|
-
if (condition) return /*#__PURE__*/ (0, _jsxDefault.default)((0, _jsxDefault.default).fragment, null, first);
|
|
735
|
-
return /*#__PURE__*/ (0, _jsxDefault.default)((0, _jsxDefault.default).fragment, null, rest);
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
},{"../jsx":"ec42s","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"ec42s":[function(require,module,exports) {
|
|
739
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
740
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
741
|
-
var _tag = require("./rendering/templates/tag");
|
|
742
|
-
var _children = require("./rendering/templates/children");
|
|
743
|
-
const ensureChildrenArray = (maybeChildren, attributes)=>maybeChildren || attributes.children || [];
|
|
744
|
-
const packageAttributes = (maybeAttributes, maybeChildren)=>{
|
|
745
|
-
const attributes = maybeAttributes || {};
|
|
746
|
-
const children = ensureChildrenArray(maybeChildren, attributes);
|
|
747
|
-
attributes.children = attributes.children || children;
|
|
748
|
-
return attributes;
|
|
749
|
-
};
|
|
750
|
-
const jsx = (type, attributes, ...children)=>{
|
|
751
|
-
if (typeof type === "string") return new (0, _tag.Tag)(type, attributes, children);
|
|
752
|
-
return type(packageAttributes(attributes, children));
|
|
753
|
-
};
|
|
754
|
-
jsx.fragment = (attributes, maybeChildren)=>{
|
|
755
|
-
const children = ensureChildrenArray(maybeChildren, attributes);
|
|
756
|
-
return new (0, _children.Children)(children);
|
|
757
|
-
};
|
|
758
|
-
exports.default = jsx;
|
|
759
|
-
|
|
760
|
-
},{"./rendering/templates/tag":"3X63B","./rendering/templates/children":"gKMx0","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"3X63B":[function(require,module,exports) {
|
|
761
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
762
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
763
|
-
parcelHelpers.export(exports, "Tag", ()=>Tag);
|
|
764
|
-
var _create = require("../dom/create");
|
|
765
|
-
var _attributesAndEvents = require("../dom/attributesAndEvents");
|
|
766
|
-
var _svg = require("../dom/svg");
|
|
767
|
-
var _children = require("./children");
|
|
768
|
-
class Tag {
|
|
769
|
-
constructor(tagType, combinedAttributes, children, isSvg = false){
|
|
770
|
-
this.type = tagType;
|
|
771
|
-
const { events, attributes } = (0, _attributesAndEvents.separateAttrsAndEvents)(combinedAttributes);
|
|
772
|
-
this.events = events;
|
|
773
|
-
this.attributes = attributes;
|
|
774
|
-
this.isSvg = isSvg || (0, _svg.isSvgTag)(this.type);
|
|
775
|
-
this.children = new (0, _children.Children)(children, this.isSvg);
|
|
776
|
-
}
|
|
777
|
-
render(renderKit) {
|
|
778
|
-
const dom = this.generateDom(renderKit);
|
|
779
|
-
if (!dom) return [];
|
|
780
|
-
this.children.render(renderKit, dom);
|
|
781
|
-
return [
|
|
782
|
-
dom
|
|
783
|
-
];
|
|
784
|
-
}
|
|
785
|
-
generateDom(renderKit) {
|
|
786
|
-
if (this.isSvg) return this.generateSvnDom(renderKit);
|
|
787
|
-
else return this.generateHtmlDom(renderKit);
|
|
788
|
-
}
|
|
789
|
-
generateHtmlDom(renderKit) {
|
|
790
|
-
const node = (0, _create.createDecoratedNode)(this.type, this.attributes, this.events, renderKit);
|
|
791
|
-
node.__jsx = this.key();
|
|
792
|
-
return node;
|
|
793
|
-
}
|
|
794
|
-
generateSvnDom(renderKit) {
|
|
795
|
-
const node = (0, _svg.createSvgNode)(this.type, this.attributes, renderKit);
|
|
796
|
-
node.__jsx = this.key();
|
|
797
|
-
return node;
|
|
798
|
-
}
|
|
799
|
-
key() {
|
|
800
|
-
return this.attributes.key || this.source() || this.createKey();
|
|
801
|
-
}
|
|
802
|
-
source() {
|
|
803
|
-
if (this.attributes.__source) {
|
|
804
|
-
const { fileName, lineNumber, columnNumber } = this.attributes.__source;
|
|
805
|
-
return `${fileName}:${lineNumber}:${columnNumber}`;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
createKey() {
|
|
809
|
-
const id = this.attributes.id ? `#${this.attributes.id}` : "";
|
|
810
|
-
const type = this.attributes.type ? `[type=${this.attributes.type}]` : "";
|
|
811
|
-
const name = this.attributes.name ? `[name=${this.attributes.name}]` : "";
|
|
812
|
-
return `${this.type}${id}${type}${name}`;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
},{"../dom/create":"762Da","../dom/attributesAndEvents":"gUSxu","../dom/svg":"ipbm5","./children":"gKMx0","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"762Da":[function(require,module,exports) {
|
|
817
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
818
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
819
|
-
parcelHelpers.export(exports, "setAttributesOnElement", ()=>setAttributesOnElement);
|
|
820
|
-
parcelHelpers.export(exports, "setEventsOnElement", ()=>setEventsOnElement);
|
|
821
|
-
parcelHelpers.export(exports, "createNode", ()=>createNode);
|
|
822
|
-
parcelHelpers.export(exports, "createTextNode", ()=>createTextNode);
|
|
823
|
-
parcelHelpers.export(exports, "createDecoratedNode", ()=>createDecoratedNode);
|
|
824
|
-
const setAttributesOnElement = (element, attributes)=>{
|
|
825
|
-
for(const key in attributes){
|
|
826
|
-
if (key === "__self") continue;
|
|
827
|
-
if (key === "value") element.value = attributes[key];
|
|
828
|
-
else element.setAttribute(key, attributes[key]);
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
const setEventsOnElement = (element, events, publish)=>{
|
|
832
|
-
const eventMaps = {};
|
|
833
|
-
for(const domEvent in events){
|
|
834
|
-
const eventName = events[domEvent];
|
|
835
|
-
const listener = (event)=>publish(eventName, event);
|
|
836
|
-
element.addEventListener(domEvent, listener);
|
|
837
|
-
eventMaps[domEvent] = {
|
|
838
|
-
domEvent: domEvent,
|
|
839
|
-
busEvent: eventName,
|
|
840
|
-
listener: listener
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
element.eventMaps = eventMaps;
|
|
844
|
-
};
|
|
845
|
-
const createNode = (type, document)=>{
|
|
846
|
-
document = document || window.document;
|
|
847
|
-
return document.createElement(type);
|
|
848
|
-
};
|
|
849
|
-
const createTextNode = (value, document)=>{
|
|
850
|
-
document = document || window.document;
|
|
851
|
-
return document.createTextNode(value);
|
|
852
|
-
};
|
|
853
|
-
const createDecoratedNode = (type, attributes, events, renderKit)=>{
|
|
854
|
-
// deno-lint-ignore no-explicit-any
|
|
855
|
-
const dom = createNode(type, renderKit.document);
|
|
856
|
-
setAttributesOnElement(dom, attributes);
|
|
857
|
-
setEventsOnElement(dom, events, renderKit.publish);
|
|
858
|
-
return dom;
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"gUSxu":[function(require,module,exports) {
|
|
862
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
863
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
864
|
-
parcelHelpers.export(exports, "separateAttrsAndEvents", ()=>separateAttrsAndEvents);
|
|
865
|
-
const separateAttrsAndEvents = (combined, defaultValue = "")=>{
|
|
866
|
-
const attributes = {};
|
|
867
|
-
const events = {};
|
|
868
|
-
for(const key in combined){
|
|
869
|
-
const value = combined[key];
|
|
870
|
-
if (key.match(/^on.+/i)) {
|
|
871
|
-
const eventKey = key.slice(2).toLowerCase();
|
|
872
|
-
events[eventKey] = value;
|
|
873
|
-
} else attributes[key] = normalizeValueForKey(combined, key, defaultValue);
|
|
874
|
-
}
|
|
875
|
-
return {
|
|
876
|
-
attributes,
|
|
877
|
-
events
|
|
878
|
-
};
|
|
879
|
-
};
|
|
880
|
-
const normalizeValueForKey = (object, key, defaultValue = "")=>{
|
|
881
|
-
if (object[key] === undefined) return defaultValue;
|
|
882
|
-
return object[key];
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"ipbm5":[function(require,module,exports) {
|
|
886
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
887
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
888
|
-
parcelHelpers.export(exports, "namespace", ()=>namespace);
|
|
889
|
-
parcelHelpers.export(exports, "isSvgTag", ()=>isSvgTag);
|
|
890
|
-
parcelHelpers.export(exports, "isSvg", ()=>isSvg);
|
|
891
|
-
parcelHelpers.export(exports, "createSvgNode", ()=>createSvgNode);
|
|
892
|
-
const namespace = "http://www.w3.org/2000/svg";
|
|
893
|
-
const isSvgTag = (tagType)=>tagType === "svg";
|
|
894
|
-
const isSvg = (element)=>element.namespaceURI === namespace;
|
|
895
|
-
const createSvgNode = (type, attributes, renderKit)=>{
|
|
896
|
-
const document = renderKit && renderKit.document || window.document;
|
|
897
|
-
const node = document.createElementNS(namespace, type);
|
|
898
|
-
for(const key in attributes){
|
|
899
|
-
if (key === "__self" || key === "xmlns") continue;
|
|
900
|
-
// adding namespace in as first argument makes it not really render!
|
|
901
|
-
node.setAttributeNS(null, key, attributes[key]);
|
|
902
|
-
}
|
|
903
|
-
return node;
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"gKMx0":[function(require,module,exports) {
|
|
907
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
908
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
909
|
-
parcelHelpers.export(exports, "ensureArray", ()=>ensureArray);
|
|
910
|
-
parcelHelpers.export(exports, "Children", ()=>Children);
|
|
911
|
-
var _text = require("./text");
|
|
912
|
-
const ensureArray = (children)=>{
|
|
913
|
-
if (Array.isArray(children)) return children.flat();
|
|
914
|
-
if (!children) return [];
|
|
915
|
-
return [
|
|
916
|
-
children
|
|
917
|
-
];
|
|
918
|
-
};
|
|
919
|
-
/* three options for children
|
|
920
|
-
1. there is no view
|
|
921
|
-
2. view is an array, recurse
|
|
922
|
-
3. view is a renderable thing
|
|
923
|
-
*/ const recursiveRender = (children, renderKit, rendered = [])=>children.reduce(renderReducer(renderKit), rendered).flat();
|
|
924
|
-
const renderReducer = (renderKit)=>(aggregate, view)=>{
|
|
925
|
-
if (!view) return aggregate;
|
|
926
|
-
if (Array.isArray(view)) {
|
|
927
|
-
const dom = recursiveRender(view, renderKit, aggregate);
|
|
928
|
-
return dom;
|
|
929
|
-
}
|
|
930
|
-
view.render(renderKit).forEach((template)=>aggregate.push(template));
|
|
931
|
-
return aggregate;
|
|
932
|
-
};
|
|
933
|
-
const replaceTextNodes = (child)=>{
|
|
934
|
-
if (isTextNode(child)) return textNode(child);
|
|
935
|
-
return child;
|
|
936
|
-
};
|
|
937
|
-
const isTextNode = (child)=>{
|
|
938
|
-
return typeof child === "string" || typeof child === "number";
|
|
939
|
-
};
|
|
940
|
-
const textNode = (content)=>{
|
|
941
|
-
return new (0, _text.TextTemplate)(content);
|
|
942
|
-
};
|
|
943
|
-
const withSvgFlag = (isSvg)=>(template)=>{
|
|
944
|
-
template && (template.isSvg = template.isSvg || isSvg);
|
|
945
|
-
return template;
|
|
946
|
-
};
|
|
947
|
-
class Children {
|
|
948
|
-
constructor(jsxChildren, isSvg = false){
|
|
949
|
-
this.collection = ensureArray(jsxChildren);
|
|
950
|
-
this.collection = this.collection.map(replaceTextNodes);
|
|
951
|
-
this.collection = this.collection.flat();
|
|
952
|
-
this.collection = this.collection.map(withSvgFlag(isSvg));
|
|
953
|
-
this.isSvg = isSvg;
|
|
954
|
-
}
|
|
955
|
-
render(renderKit, parentElement) {
|
|
956
|
-
this.parentElement = parentElement;
|
|
957
|
-
const dom = this.generateDom(renderKit);
|
|
958
|
-
this.attachToParent(dom);
|
|
959
|
-
return dom;
|
|
960
|
-
}
|
|
961
|
-
generateDom(renderKit) {
|
|
962
|
-
return recursiveRender(this.collection, renderKit);
|
|
963
|
-
}
|
|
964
|
-
attachToParent(dom) {
|
|
965
|
-
if (this.parentElement === undefined) return;
|
|
966
|
-
const parent = this.parentElement;
|
|
967
|
-
dom.forEach((node)=>parent.appendChild(node));
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
},{"./text":"iqXAF","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"iqXAF":[function(require,module,exports) {
|
|
972
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
973
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
974
|
-
parcelHelpers.export(exports, "TextTemplate", ()=>TextTemplate);
|
|
975
|
-
var _create = require("../dom/create");
|
|
976
|
-
class TextTemplate {
|
|
977
|
-
constructor(content){
|
|
978
|
-
this.value = content.toString();
|
|
979
|
-
}
|
|
980
|
-
render(renderKit) {
|
|
981
|
-
const textNode = (0, _create.createTextNode)(this.value, renderKit.document);
|
|
982
|
-
if (!textNode) return [];
|
|
983
|
-
textNode.__jsx = "TextNode";
|
|
984
|
-
return [
|
|
985
|
-
textNode
|
|
986
|
-
];
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
},{"../dom/create":"762Da","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"4T9d8":[function(require,module,exports) {
|
|
991
|
-
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
|
992
|
-
parcelHelpers.defineInteropFlag(exports);
|
|
993
|
-
parcelHelpers.export(exports, "Link", ()=>Link);
|
|
994
|
-
var _jsx = require("../jsx");
|
|
995
|
-
var _jsxDefault = parcelHelpers.interopDefault(_jsx);
|
|
996
|
-
const Link = ({ children, ...props })=>{
|
|
997
|
-
return /*#__PURE__*/ (0, _jsxDefault.default)("a", {
|
|
998
|
-
...props,
|
|
999
|
-
onClick: "goToHref",
|
|
1000
|
-
__source: {
|
|
1001
|
-
fileName: "src/views/link.jsx",
|
|
1002
|
-
lineNumber: 4,
|
|
1003
|
-
columnNumber: 10
|
|
1004
|
-
},
|
|
1005
|
-
__self: undefined
|
|
1006
|
-
}, children);
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
},{"../jsx":"ec42s","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["b8Sd7","faxFZ"], "faxFZ", "parcelRequireee15")
|
|
1010
|
-
|
|
1011
|
-
//# sourceMappingURL=add-remove-root-children.fbb4ec9b.js.map
|