@maplat/ui 0.11.10 → 0.12.0

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/README.ja.md CHANGED
@@ -20,6 +20,7 @@ Maplatは古地図/絵地図を歪める事なくGPSや正確な地図と連携
20
20
  - [ブラウザでのCDN利用](#ブラウザでのcdn利用)
21
21
  - [利用方法](#利用方法)
22
22
  - [ESM (EcmaScript Modules)](#esm-ecmascript-modules)
23
+ - [ライフサイクル](#ライフサイクル)
23
24
  - [APIドキュメント](#apiドキュメント)
24
25
  - [MaplatUi](#maplatui)
25
26
  - [静的メソッド](#静的メソッド)
@@ -97,6 +98,9 @@ pnpm add ol
97
98
 
98
99
  ## 利用方法
99
100
 
101
+ ## ライフサイクル
102
+ - フェーズや uiHooks については `docs/ui-core-lifecycle.ja.md` を参照してください。
103
+
100
104
  ### ESM (EcmaScript Modules)
101
105
  ```javascript
102
106
  import { MaplatUi } from '@maplat/ui';
package/README.md CHANGED
@@ -22,6 +22,7 @@ This project won Grand Prize / Educational Effectiveness Prize / Visitors Select
22
22
  - [Using CDN in Browser](#using-cdn-in-browser)
23
23
  - [Usage](#usage)
24
24
  - [ESM (EcmaScript Modules)](#esm-ecmascript-modules)
25
+ - [Lifecycle](#lifecycle)
25
26
  - [API Documentation](#api-documentation)
26
27
  - [MaplatUi](#maplatui)
27
28
  - [Static Methods](#static-methods)
@@ -99,6 +100,9 @@ For usage directly in the browser without a bundler, you must load OpenLayers be
99
100
 
100
101
  ## Usage
101
102
 
103
+ ## Lifecycle
104
+ - See `docs/ui-core-lifecycle.md` for lifecycle phases and uiHooks.
105
+
102
106
  ### ESM (EcmaScript Modules)
103
107
  ```javascript
104
108
  import { MaplatUi } from '@maplat/ui';
@@ -0,0 +1,342 @@
1
+ import { c as U, g as z } from "./index-CqW0y3m3.js";
2
+ function X(m, d) {
3
+ for (var b = 0; b < d.length; b++) {
4
+ const y = d[b];
5
+ if (typeof y != "string" && !Array.isArray(y)) {
6
+ for (const l in y)
7
+ if (l !== "default" && !(l in m)) {
8
+ const p = Object.getOwnPropertyDescriptor(y, l);
9
+ p && Object.defineProperty(m, l, p.get ? p : {
10
+ enumerable: !0,
11
+ get: () => y[l]
12
+ });
13
+ }
14
+ }
15
+ }
16
+ return Object.freeze(Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }));
17
+ }
18
+ var A = { exports: {} }, R;
19
+ function J() {
20
+ return R || (R = 1, (function(m, d) {
21
+ var b = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof U < "u" && U, y = (function() {
22
+ function p() {
23
+ this.fetch = !1, this.DOMException = b.DOMException;
24
+ }
25
+ return p.prototype = b, new p();
26
+ })();
27
+ (function(p) {
28
+ (function(u) {
29
+ var a = typeof p < "u" && p || typeof self < "u" && self || typeof a < "u" && a, f = {
30
+ searchParams: "URLSearchParams" in a,
31
+ iterable: "Symbol" in a && "iterator" in Symbol,
32
+ blob: "FileReader" in a && "Blob" in a && (function() {
33
+ try {
34
+ return new Blob(), !0;
35
+ } catch {
36
+ return !1;
37
+ }
38
+ })(),
39
+ formData: "FormData" in a,
40
+ arrayBuffer: "ArrayBuffer" in a
41
+ };
42
+ function M(e) {
43
+ return e && DataView.prototype.isPrototypeOf(e);
44
+ }
45
+ if (f.arrayBuffer)
46
+ var S = [
47
+ "[object Int8Array]",
48
+ "[object Uint8Array]",
49
+ "[object Uint8ClampedArray]",
50
+ "[object Int16Array]",
51
+ "[object Uint16Array]",
52
+ "[object Int32Array]",
53
+ "[object Uint32Array]",
54
+ "[object Float32Array]",
55
+ "[object Float64Array]"
56
+ ], F = ArrayBuffer.isView || function(e) {
57
+ return e && S.indexOf(Object.prototype.toString.call(e)) > -1;
58
+ };
59
+ function v(e) {
60
+ if (typeof e != "string" && (e = String(e)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e) || e === "")
61
+ throw new TypeError('Invalid character in header field name: "' + e + '"');
62
+ return e.toLowerCase();
63
+ }
64
+ function E(e) {
65
+ return typeof e != "string" && (e = String(e)), e;
66
+ }
67
+ function T(e) {
68
+ var t = {
69
+ next: function() {
70
+ var r = e.shift();
71
+ return { done: r === void 0, value: r };
72
+ }
73
+ };
74
+ return f.iterable && (t[Symbol.iterator] = function() {
75
+ return t;
76
+ }), t;
77
+ }
78
+ function s(e) {
79
+ this.map = {}, e instanceof s ? e.forEach(function(t, r) {
80
+ this.append(r, t);
81
+ }, this) : Array.isArray(e) ? e.forEach(function(t) {
82
+ this.append(t[0], t[1]);
83
+ }, this) : e && Object.getOwnPropertyNames(e).forEach(function(t) {
84
+ this.append(t, e[t]);
85
+ }, this);
86
+ }
87
+ s.prototype.append = function(e, t) {
88
+ e = v(e), t = E(t);
89
+ var r = this.map[e];
90
+ this.map[e] = r ? r + ", " + t : t;
91
+ }, s.prototype.delete = function(e) {
92
+ delete this.map[v(e)];
93
+ }, s.prototype.get = function(e) {
94
+ return e = v(e), this.has(e) ? this.map[e] : null;
95
+ }, s.prototype.has = function(e) {
96
+ return this.map.hasOwnProperty(v(e));
97
+ }, s.prototype.set = function(e, t) {
98
+ this.map[v(e)] = E(t);
99
+ }, s.prototype.forEach = function(e, t) {
100
+ for (var r in this.map)
101
+ this.map.hasOwnProperty(r) && e.call(t, this.map[r], r, this);
102
+ }, s.prototype.keys = function() {
103
+ var e = [];
104
+ return this.forEach(function(t, r) {
105
+ e.push(r);
106
+ }), T(e);
107
+ }, s.prototype.values = function() {
108
+ var e = [];
109
+ return this.forEach(function(t) {
110
+ e.push(t);
111
+ }), T(e);
112
+ }, s.prototype.entries = function() {
113
+ var e = [];
114
+ return this.forEach(function(t, r) {
115
+ e.push([r, t]);
116
+ }), T(e);
117
+ }, f.iterable && (s.prototype[Symbol.iterator] = s.prototype.entries);
118
+ function B(e) {
119
+ if (e.bodyUsed)
120
+ return Promise.reject(new TypeError("Already read"));
121
+ e.bodyUsed = !0;
122
+ }
123
+ function P(e) {
124
+ return new Promise(function(t, r) {
125
+ e.onload = function() {
126
+ t(e.result);
127
+ }, e.onerror = function() {
128
+ r(e.error);
129
+ };
130
+ });
131
+ }
132
+ function I(e) {
133
+ var t = new FileReader(), r = P(t);
134
+ return t.readAsArrayBuffer(e), r;
135
+ }
136
+ function q(e) {
137
+ var t = new FileReader(), r = P(t);
138
+ return t.readAsText(e), r;
139
+ }
140
+ function H(e) {
141
+ for (var t = new Uint8Array(e), r = new Array(t.length), n = 0; n < t.length; n++)
142
+ r[n] = String.fromCharCode(t[n]);
143
+ return r.join("");
144
+ }
145
+ function D(e) {
146
+ if (e.slice)
147
+ return e.slice(0);
148
+ var t = new Uint8Array(e.byteLength);
149
+ return t.set(new Uint8Array(e)), t.buffer;
150
+ }
151
+ function x() {
152
+ return this.bodyUsed = !1, this._initBody = function(e) {
153
+ this.bodyUsed = this.bodyUsed, this._bodyInit = e, e ? typeof e == "string" ? this._bodyText = e : f.blob && Blob.prototype.isPrototypeOf(e) ? this._bodyBlob = e : f.formData && FormData.prototype.isPrototypeOf(e) ? this._bodyFormData = e : f.searchParams && URLSearchParams.prototype.isPrototypeOf(e) ? this._bodyText = e.toString() : f.arrayBuffer && f.blob && M(e) ? (this._bodyArrayBuffer = D(e.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : f.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(e) || F(e)) ? this._bodyArrayBuffer = D(e) : this._bodyText = e = Object.prototype.toString.call(e) : this._bodyText = "", this.headers.get("content-type") || (typeof e == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : f.searchParams && URLSearchParams.prototype.isPrototypeOf(e) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
154
+ }, f.blob && (this.blob = function() {
155
+ var e = B(this);
156
+ if (e)
157
+ return e;
158
+ if (this._bodyBlob)
159
+ return Promise.resolve(this._bodyBlob);
160
+ if (this._bodyArrayBuffer)
161
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]));
162
+ if (this._bodyFormData)
163
+ throw new Error("could not read FormData body as blob");
164
+ return Promise.resolve(new Blob([this._bodyText]));
165
+ }, this.arrayBuffer = function() {
166
+ if (this._bodyArrayBuffer) {
167
+ var e = B(this);
168
+ return e || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
169
+ this._bodyArrayBuffer.buffer.slice(
170
+ this._bodyArrayBuffer.byteOffset,
171
+ this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
172
+ )
173
+ ) : Promise.resolve(this._bodyArrayBuffer));
174
+ } else
175
+ return this.blob().then(I);
176
+ }), this.text = function() {
177
+ var e = B(this);
178
+ if (e)
179
+ return e;
180
+ if (this._bodyBlob)
181
+ return q(this._bodyBlob);
182
+ if (this._bodyArrayBuffer)
183
+ return Promise.resolve(H(this._bodyArrayBuffer));
184
+ if (this._bodyFormData)
185
+ throw new Error("could not read FormData body as text");
186
+ return Promise.resolve(this._bodyText);
187
+ }, f.formData && (this.formData = function() {
188
+ return this.text().then(k);
189
+ }), this.json = function() {
190
+ return this.text().then(JSON.parse);
191
+ }, this;
192
+ }
193
+ var L = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
194
+ function C(e) {
195
+ var t = e.toUpperCase();
196
+ return L.indexOf(t) > -1 ? t : e;
197
+ }
198
+ function w(e, t) {
199
+ if (!(this instanceof w))
200
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
201
+ t = t || {};
202
+ var r = t.body;
203
+ if (e instanceof w) {
204
+ if (e.bodyUsed)
205
+ throw new TypeError("Already read");
206
+ this.url = e.url, this.credentials = e.credentials, t.headers || (this.headers = new s(e.headers)), this.method = e.method, this.mode = e.mode, this.signal = e.signal, !r && e._bodyInit != null && (r = e._bodyInit, e.bodyUsed = !0);
207
+ } else
208
+ this.url = String(e);
209
+ if (this.credentials = t.credentials || this.credentials || "same-origin", (t.headers || !this.headers) && (this.headers = new s(t.headers)), this.method = C(t.method || this.method || "GET"), this.mode = t.mode || this.mode || null, this.signal = t.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && r)
210
+ throw new TypeError("Body not allowed for GET or HEAD requests");
211
+ if (this._initBody(r), (this.method === "GET" || this.method === "HEAD") && (t.cache === "no-store" || t.cache === "no-cache")) {
212
+ var n = /([?&])_=[^&]*/;
213
+ if (n.test(this.url))
214
+ this.url = this.url.replace(n, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
215
+ else {
216
+ var i = /\?/;
217
+ this.url += (i.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
218
+ }
219
+ }
220
+ }
221
+ w.prototype.clone = function() {
222
+ return new w(this, { body: this._bodyInit });
223
+ };
224
+ function k(e) {
225
+ var t = new FormData();
226
+ return e.trim().split("&").forEach(function(r) {
227
+ if (r) {
228
+ var n = r.split("="), i = n.shift().replace(/\+/g, " "), o = n.join("=").replace(/\+/g, " ");
229
+ t.append(decodeURIComponent(i), decodeURIComponent(o));
230
+ }
231
+ }), t;
232
+ }
233
+ function N(e) {
234
+ var t = new s(), r = e.replace(/\r?\n[\t ]+/g, " ");
235
+ return r.split("\r").map(function(n) {
236
+ return n.indexOf(`
237
+ `) === 0 ? n.substr(1, n.length) : n;
238
+ }).forEach(function(n) {
239
+ var i = n.split(":"), o = i.shift().trim();
240
+ if (o) {
241
+ var _ = i.join(":").trim();
242
+ t.append(o, _);
243
+ }
244
+ }), t;
245
+ }
246
+ x.call(w.prototype);
247
+ function c(e, t) {
248
+ if (!(this instanceof c))
249
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
250
+ t || (t = {}), this.type = "default", this.status = t.status === void 0 ? 200 : t.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = t.statusText === void 0 ? "" : "" + t.statusText, this.headers = new s(t.headers), this.url = t.url || "", this._initBody(e);
251
+ }
252
+ x.call(c.prototype), c.prototype.clone = function() {
253
+ return new c(this._bodyInit, {
254
+ status: this.status,
255
+ statusText: this.statusText,
256
+ headers: new s(this.headers),
257
+ url: this.url
258
+ });
259
+ }, c.error = function() {
260
+ var e = new c(null, { status: 0, statusText: "" });
261
+ return e.type = "error", e;
262
+ };
263
+ var G = [301, 302, 303, 307, 308];
264
+ c.redirect = function(e, t) {
265
+ if (G.indexOf(t) === -1)
266
+ throw new RangeError("Invalid status code");
267
+ return new c(null, { status: t, headers: { location: e } });
268
+ }, u.DOMException = a.DOMException;
269
+ try {
270
+ new u.DOMException();
271
+ } catch {
272
+ u.DOMException = function(t, r) {
273
+ this.message = t, this.name = r;
274
+ var n = Error(t);
275
+ this.stack = n.stack;
276
+ }, u.DOMException.prototype = Object.create(Error.prototype), u.DOMException.prototype.constructor = u.DOMException;
277
+ }
278
+ function O(e, t) {
279
+ return new Promise(function(r, n) {
280
+ var i = new w(e, t);
281
+ if (i.signal && i.signal.aborted)
282
+ return n(new u.DOMException("Aborted", "AbortError"));
283
+ var o = new XMLHttpRequest();
284
+ function _() {
285
+ o.abort();
286
+ }
287
+ o.onload = function() {
288
+ var h = {
289
+ status: o.status,
290
+ statusText: o.statusText,
291
+ headers: N(o.getAllResponseHeaders() || "")
292
+ };
293
+ h.url = "responseURL" in o ? o.responseURL : h.headers.get("X-Request-URL");
294
+ var g = "response" in o ? o.response : o.responseText;
295
+ setTimeout(function() {
296
+ r(new c(g, h));
297
+ }, 0);
298
+ }, o.onerror = function() {
299
+ setTimeout(function() {
300
+ n(new TypeError("Network request failed"));
301
+ }, 0);
302
+ }, o.ontimeout = function() {
303
+ setTimeout(function() {
304
+ n(new TypeError("Network request failed"));
305
+ }, 0);
306
+ }, o.onabort = function() {
307
+ setTimeout(function() {
308
+ n(new u.DOMException("Aborted", "AbortError"));
309
+ }, 0);
310
+ };
311
+ function V(h) {
312
+ try {
313
+ return h === "" && a.location.href ? a.location.href : h;
314
+ } catch {
315
+ return h;
316
+ }
317
+ }
318
+ o.open(i.method, V(i.url), !0), i.credentials === "include" ? o.withCredentials = !0 : i.credentials === "omit" && (o.withCredentials = !1), "responseType" in o && (f.blob ? o.responseType = "blob" : f.arrayBuffer && i.headers.get("Content-Type") && i.headers.get("Content-Type").indexOf("application/octet-stream") !== -1 && (o.responseType = "arraybuffer")), t && typeof t.headers == "object" && !(t.headers instanceof s) ? Object.getOwnPropertyNames(t.headers).forEach(function(h) {
319
+ o.setRequestHeader(h, E(t.headers[h]));
320
+ }) : i.headers.forEach(function(h, g) {
321
+ o.setRequestHeader(g, h);
322
+ }), i.signal && (i.signal.addEventListener("abort", _), o.onreadystatechange = function() {
323
+ o.readyState === 4 && i.signal.removeEventListener("abort", _);
324
+ }), o.send(typeof i._bodyInit > "u" ? null : i._bodyInit);
325
+ });
326
+ }
327
+ return O.polyfill = !0, a.fetch || (a.fetch = O, a.Headers = s, a.Request = w, a.Response = c), u.Headers = s, u.Request = w, u.Response = c, u.fetch = O, u;
328
+ })({});
329
+ })(y), y.fetch.ponyfill = !0, delete y.fetch.polyfill;
330
+ var l = b.fetch ? b : y;
331
+ d = l.fetch, d.default = l.fetch, d.fetch = l.fetch, d.Headers = l.Headers, d.Request = l.Request, d.Response = l.Response, m.exports = d;
332
+ })(A, A.exports)), A.exports;
333
+ }
334
+ var j = J();
335
+ const K = /* @__PURE__ */ z(j), W = /* @__PURE__ */ X({
336
+ __proto__: null,
337
+ default: K
338
+ }, [j]);
339
+ typeof window < "u" && window.MaplatUi && window.MaplatUi.MaplatUi && (window.MaplatUi = window.MaplatUi.MaplatUi);
340
+ export {
341
+ W as b
342
+ };
@@ -0,0 +1,2 @@
1
+ declare const browserLanguage: () => string;
2
+ export default browserLanguage;