diff --git a/main.js b/main.js index c913f51..97b1a86 100644 --- a/main.js +++ b/main.js @@ -30,6 +30,16 @@ eval("\nexports.__esModule = true;\nexports.Outter = void 0;\nvar m = __webpack_ /***/ }), +/***/ "../dist/data/builder.js": +/*!*******************************!*\ + !*** ../dist/data/builder.js ***! + \*******************************/ +/***/ (function(__unused_webpack_module, exports) { + +eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nexports.__esModule = true;\nexports.buildAttr = void 0;\nvar buildAttr = function (base) {\n var build = function () { return base; };\n var set = function (key, value) {\n var _a;\n return (0, exports.buildAttr)(__assign(__assign({}, base), (_a = {}, _a[key] = value, _a)));\n };\n var setWhenLazy = function (cond, key, value) {\n if (cond()) {\n return set(key, value);\n }\n else {\n return (0, exports.buildAttr)(base);\n }\n };\n var setWhen = function (cond, key, value) {\n return setWhenLazy(function () { return cond; }, key, value);\n };\n var setJust = function (key, value) {\n return value.caseOf({\n Just: function (a) { return set(key, a); },\n Nothing: function () { return (0, exports.buildAttr)(base); }\n });\n };\n return {\n build: build,\n set: set,\n setWhenLazy: setWhenLazy,\n setWhen: setWhen,\n setJust: setJust\n };\n};\nexports.buildAttr = buildAttr;\n\n\n//# sourceURL=webpack:///../dist/data/builder.js?"); + +/***/ }), + /***/ "../dist/data/fn.js": /*!**************************!*\ !*** ../dist/data/fn.js ***! @@ -56,7 +66,7 @@ eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = \*****************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nexports.__esModule = true;\n__exportStar(__webpack_require__(/*! ./fn */ \"../dist/data/fn.js\"), exports);\n__exportStar(__webpack_require__(/*! ./lens */ \"../dist/data/lens.js\"), exports);\n\n\n//# sourceURL=webpack:///../dist/data/index.js?"); +eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nexports.__esModule = true;\n__exportStar(__webpack_require__(/*! ./fn */ \"../dist/data/fn.js\"), exports);\n__exportStar(__webpack_require__(/*! ./builder */ \"../dist/data/builder.js\"), exports);\n__exportStar(__webpack_require__(/*! ./lens */ \"../dist/data/lens.js\"), exports);\n\n\n//# sourceURL=webpack:///../dist/data/index.js?"); /***/ }), @@ -270,6 +280,16 @@ eval("\nexports.__esModule = true;\nexports.Segment = exports.SegmentShape = voi /***/ }), +/***/ "../dist/form.js": +/*!***********************!*\ + !*** ../dist/form.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nexports.__esModule = true;\n__exportStar(__webpack_require__(/*! ./element/input */ \"../dist/element/input.js\"), exports);\n__exportStar(__webpack_require__(/*! ./element/form */ \"../dist/element/form.js\"), exports);\n__exportStar(__webpack_require__(/*! ./widget/input */ \"../dist/widget/input/index.js\"), exports);\n__exportStar(__webpack_require__(/*! ./module/form */ \"../dist/module/form.js\"), exports);\n\n\n//# sourceURL=webpack:///../dist/form.js?"); + +/***/ }), + /***/ "../dist/internal/attr.js": /*!********************************!*\ !*** ../dist/internal/attr.js ***! @@ -320,13 +340,13 @@ eval("\nexports.__esModule = true;\nexports.Form = void 0;\nvar attr_1 = __webpa /***/ }), -/***/ "../dist/module/loading.js": -/*!*********************************!*\ - !*** ../dist/module/loading.js ***! - \*********************************/ +/***/ "../dist/module/loader.js": +/*!********************************!*\ + !*** ../dist/module/loader.js ***! + \********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nexports.__esModule = true;\nexports.waitting = void 0;\nvar m = __webpack_require__(/*! mithril */ \"../node_modules/mithril/index.js\");\nvar purify_ts_1 = __webpack_require__(/*! purify-ts */ \"../node_modules/purify-ts/index.js\");\nvar ref_1 = __webpack_require__(/*! ../data/ref */ \"../dist/data/ref.js\");\nvar placeholder_1 = __webpack_require__(/*! ../element/placeholder */ \"../dist/element/placeholder.js\");\nvar waitting = function () {\n var state = new ref_1.IORef({\n dom: purify_ts_1.Nothing,\n lastFn: purify_ts_1.Nothing\n });\n var update = function (f) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n state.put({\n dom: purify_ts_1.Nothing,\n lastFn: (0, purify_ts_1.Just)(f)\n });\n m.redraw();\n f().run()\n .then(function (dom) { return state.putAt(\"dom\", (0, purify_ts_1.Just)(dom)); })\n .then(m.redraw);\n return [2 /*return*/];\n });\n }); };\n var mretry = function () {\n return state.askAt(\"lastFn\").ap((0, purify_ts_1.Just)(update));\n };\n var comp = {\n view: function () { return state.askAt(\"dom\")\n .map(function (v) { return v.bimap(function (e) { return m(\"div.ui.icon.negative.message\", [\n m(\"i.icon.exclamation\"),\n m(\"div.content\", [\n m(\"div.header\", \"出现了错误!\"),\n m(\"p\", e),\n m(\"button.ui.negative.right.labeled.icon.button\", { onclick: mretry }, [\n m(\"i.right.icon.redo\"),\n \"重试\"\n ])\n ])\n ]); }, m); })\n .map(function (v) { return v.extract(); })\n .orDefault(m(placeholder_1.FluidPlaceholder)); }\n };\n return [update, comp];\n};\nexports.waitting = waitting;\n\n\n//# sourceURL=webpack:///../dist/module/loading.js?"); +eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nexports.__esModule = true;\nexports.useDefLoader = exports.useLoader = void 0;\nvar m = __webpack_require__(/*! mithril */ \"../node_modules/mithril/index.js\");\nvar purify_ts_1 = __webpack_require__(/*! purify-ts */ \"../node_modules/purify-ts/index.js\");\nvar data_1 = __webpack_require__(/*! ../data */ \"../dist/data/index.js\");\nvar placeholder_1 = __webpack_require__(/*! ../element/placeholder */ \"../dist/element/placeholder.js\");\nvar useLoader = function () {\n var state = (0, data_1.mutable)({\n dom: purify_ts_1.Nothing,\n lastFn: purify_ts_1.Nothing\n });\n var domLens = state.prop(\"dom\");\n var update = function (f) { return __awaiter(void 0, void 0, void 0, function () {\n var dom;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n domLens.set(purify_ts_1.Nothing);\n state.prop(\"lastFn\").set((0, purify_ts_1.Just)(f));\n m.redraw();\n return [4 /*yield*/, f().run()];\n case 1:\n dom = _a.sent();\n domLens.set((0, purify_ts_1.Just)(dom));\n m.redraw();\n return [2 /*return*/];\n }\n });\n }); };\n var comp = {\n view: function () {\n var dom = domLens.get();\n return dom\n .map(function (dom) { return dom.bimap(m, m).extract(); })\n .orDefault(m(placeholder_1.FluidPlaceholder));\n }\n };\n return [update, comp];\n};\nexports.useLoader = useLoader;\nvar useDefLoader = function () {\n var _a = (0, exports.useLoader)(), f = _a[0], comp = _a[1];\n var update = function (g) { return __awaiter(void 0, void 0, void 0, function () {\n var k;\n return __generator(this, function (_a) {\n k = g().mapLeft(function (msg) { return ({\n view: function () { return m(\"div.ui.icon.negative.message\", [\n m(\"i.icon.exclamation\"),\n m(\"div.content\", [\n m(\"div.header\", \"出现了错误!\"),\n m(\"p\", msg),\n m(\"button.ui.negative.right.labeled.icon.button\", { onclick: function () { return update(g); } }, [\n m(\"i.right.icon.redo\"),\n \"重试\"\n ])\n ])\n ]); }\n }); });\n f(function () { return k; });\n return [2 /*return*/];\n });\n }); };\n return [update, comp];\n};\nexports.useDefLoader = useDefLoader;\n\n\n//# sourceURL=webpack:///../dist/module/loader.js?"); /***/ }), @@ -836,7 +856,7 @@ eval("\nexports.__esModule = true;\nvar header_1 = __webpack_require__(/*! drifl \**************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -eval("\nexports.__esModule = true;\nvar var_1 = __webpack_require__(/*! drifloon/data/var */ \"../dist/data/var.js\");\nvar header_1 = __webpack_require__(/*! drifloon/element/header */ \"../dist/element/header.js\");\nvar m = __webpack_require__(/*! mithril */ \"../node_modules/mithril/index.js\");\nvar purify_ts_1 = __webpack_require__(/*! purify-ts */ \"../node_modules/purify-ts/index.js\");\nvar element_1 = __webpack_require__(/*! drifloon/element */ \"../dist/element/index.js\");\nvar modal_1 = __webpack_require__(/*! drifloon/module/modal */ \"../dist/module/modal.js\");\nvar form_1 = __webpack_require__(/*! drifloon/module/form */ \"../dist/module/form.js\");\nvar validate_1 = __webpack_require__(/*! drifloon/data/validate */ \"../dist/data/validate.js\");\nvar form_2 = __webpack_require__(/*! drifloon/data/form */ \"../dist/data/form.js\");\nvar FormS = {\n view: function () {\n return m(form_1.Form, [\n m(element_1.FieldGrid, { wide: var_1.Wide.Two }, [\n m(element_1.Field, [\n m(\"label\", \"用户名\"),\n m(\"input\")\n ]),\n m(element_1.RequireField, [\n m(\"label\", \"密码\"),\n m(\"input\", { type: \"password\" })\n ]),\n ]),\n m(element_1.FieldGrid, [\n m(element_1.Field, { wide: var_1.Wide.Twelve }, [\n m(\"label\", \"用户名\"),\n m(\"input\")\n ]),\n m(element_1.RequireField, { wide: var_1.Wide.Four }, [\n m(\"label\", \"密码\"),\n m(\"input\", { type: \"password\" })\n ])\n ]),\n m(element_1.Field, [\n m(element_1.Button, { em: var_1.EmLevel.Primary }, \"提交\")\n ])\n ]);\n }\n};\nvar ValidationS = function () {\n var mkOutput = function (name, address) { return ({\n name: name,\n address: address\n }); };\n var validateForm = function (user) {\n return (0, validate_1.must)(\"用户名\", (0, validate_1.isNotEmpty)(user.name))\n .option((0, purify_ts_1.Just)(user.address))\n .collect(mkOutput);\n };\n var user = (0, form_2.formMut)({\n name: \"\",\n address: \"一组默认地址!\"\n });\n return {\n view: function () {\n var attr = {\n formdata: user\n };\n var onsubmit = function () { return user.validate(validateForm)\n .ifRight(function (s) { return (0, modal_1.alertText)(JSON.stringify(s, null, 4)); }); };\n return m(form_1.Form, attr, [\n m(element_1.RequireField, [\n m(\"label\", \"用户名\"),\n m(element_1.TrimInput, { bindValue: user.prop(\"name\") })\n ]),\n m(element_1.Field, [\n m(\"label\", \"地址\"),\n m(element_1.TrimInput, { bindValue: user.prop(\"address\") })\n ]),\n m(element_1.Button, { connectClick: onsubmit, color: var_1.Color.Blue }, \"提交\")\n ]);\n }\n };\n};\nvar Main = {\n view: function () {\n return m(\"div.ui.pink.segment\", [\n m(header_1.Header, { size: var_1.Size.Huge, isDivid: true }, \"表单\"),\n (0, header_1.Header2)(\"表单外观\"),\n m(FormS),\n m(header_1.Header, { size: var_1.Size.Large }, \"表单基本验证\"),\n m(ValidationS)\n ]);\n }\n};\nexports[\"default\"] = Main;\n\n\n//# sourceURL=webpack:///./src/page/form.ts?"); +eval("\nexports.__esModule = true;\nvar var_1 = __webpack_require__(/*! drifloon/data/var */ \"../dist/data/var.js\");\nvar header_1 = __webpack_require__(/*! drifloon/element/header */ \"../dist/element/header.js\");\nvar m = __webpack_require__(/*! mithril */ \"../node_modules/mithril/index.js\");\nvar purify_ts_1 = __webpack_require__(/*! purify-ts */ \"../node_modules/purify-ts/index.js\");\nvar modal_1 = __webpack_require__(/*! drifloon/module/modal */ \"../dist/module/modal.js\");\nvar element_1 = __webpack_require__(/*! drifloon/element */ \"../dist/element/index.js\");\nvar form_1 = __webpack_require__(/*! drifloon/form */ \"../dist/form.js\");\nvar validate_1 = __webpack_require__(/*! drifloon/data/validate */ \"../dist/data/validate.js\");\nvar form_2 = __webpack_require__(/*! drifloon/data/form */ \"../dist/data/form.js\");\nvar FormS = {\n view: function () {\n return m(form_1.Form, [\n m(form_1.FieldGrid, { wide: var_1.Wide.Two }, [\n m(form_1.Field, [\n m(\"label\", \"用户名\"),\n m(\"input\")\n ]),\n m(form_1.RequireField, [\n m(\"label\", \"密码\"),\n m(\"input\", { type: \"password\" })\n ]),\n ]),\n m(form_1.FieldGrid, [\n m(form_1.Field, { wide: var_1.Wide.Twelve }, [\n m(\"label\", \"用户名\"),\n m(\"input\")\n ]),\n m(form_1.RequireField, { wide: var_1.Wide.Four }, [\n m(\"label\", \"密码\"),\n m(\"input\", { type: \"password\" })\n ])\n ]),\n m(form_1.Field, [\n m(element_1.Button, { em: var_1.EmLevel.Primary }, \"提交\")\n ])\n ]);\n }\n};\nvar ValidationS = function () {\n var mkOutput = function (name, address) { return ({\n name: name,\n address: address\n }); };\n var validateForm = function (user) {\n return (0, validate_1.must)(\"用户名\", (0, validate_1.isNotEmpty)(user.name))\n .option((0, purify_ts_1.Just)(user.address))\n .collect(mkOutput);\n };\n var user = (0, form_2.formMut)({\n name: \"\",\n address: \"一组默认地址!\"\n });\n return {\n view: function () {\n var attr = {\n formdata: user\n };\n var onsubmit = function () { return user.validate(validateForm)\n .ifRight(function (s) { return (0, modal_1.alertText)(JSON.stringify(s, null, 4)); }); };\n return m(form_1.Form, attr, [\n m(form_1.RequireField, [\n m(\"label\", \"用户名\"),\n m(form_1.TrimInput, { bindValue: user.prop(\"name\") })\n ]),\n m(form_1.Field, [\n m(\"label\", \"地址\"),\n m(form_1.TrimInput, { bindValue: user.prop(\"address\") })\n ]),\n m(element_1.Button, { connectClick: onsubmit, color: var_1.Color.Blue }, \"提交\")\n ]);\n }\n };\n};\nvar Main = {\n view: function () {\n return m(\"div.ui.pink.segment\", [\n m(header_1.Header, { size: var_1.Size.Huge, isDivid: true }, \"表单\"),\n (0, header_1.Header2)(\"表单外观\"),\n m(FormS),\n m(header_1.Header, { size: var_1.Size.Large }, \"表单基本验证\"),\n m(ValidationS)\n ]);\n }\n};\nexports[\"default\"] = Main;\n\n\n//# sourceURL=webpack:///./src/page/form.ts?"); /***/ }), @@ -876,7 +896,7 @@ eval("\nexports.__esModule = true;\nvar m = __webpack_require__(/*! mithril */ \ \*********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nexports.__esModule = true;\nvar var_1 = __webpack_require__(/*! drifloon/data/var */ \"../dist/data/var.js\");\nvar header_1 = __webpack_require__(/*! drifloon/element/header */ \"../dist/element/header.js\");\nvar segment_1 = __webpack_require__(/*! drifloon/element/segment */ \"../dist/element/segment.js\");\nvar placeholder_1 = __webpack_require__(/*! drifloon/element/placeholder */ \"../dist/element/placeholder.js\");\nvar message_1 = __webpack_require__(/*! drifloon/element/message */ \"../dist/element/message.js\");\nvar load_1 = __webpack_require__(/*! drifloon/widget/load */ \"../dist/widget/load.js\");\nvar m = __webpack_require__(/*! mithril */ \"../node_modules/mithril/index.js\");\nvar ref_1 = __webpack_require__(/*! drifloon/data/ref */ \"../dist/data/ref.js\");\nvar purify_ts_1 = __webpack_require__(/*! purify-ts */ \"../node_modules/purify-ts/index.js\");\nvar button_1 = __webpack_require__(/*! drifloon/element/button */ \"../dist/element/button.js\");\nvar loading_1 = __webpack_require__(/*! drifloon/module/loading */ \"../dist/module/loading.js\");\nvar delay = function () { return new Promise(function (resolve) { return setTimeout(resolve, 1000); }); };\nvar Timer = function () {\n var list = new ref_1.IORef(purify_ts_1.Nothing);\n var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, delay()];\n case 1:\n _a.sent();\n list.put((0, purify_ts_1.Just)([1, 2, 3, 4, 5]));\n m.redraw();\n return [2 /*return*/];\n }\n });\n }); };\n var startTimer = function () {\n list.ask()\n .ifJust(function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n list.put(purify_ts_1.Nothing);\n return [4 /*yield*/, fetchData()];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); });\n };\n var render = function (xs) {\n return m(\"ol\", xs.map(function (x) { return m(\"li\", x); }));\n };\n fetchData();\n return {\n view: function () {\n return m(\"div\", [\n m(button_1.Button, { connectClick: startTimer }, \"执行\"),\n (0, load_1.loading)(render, list.ask())\n ]);\n }\n };\n};\nvar WaitS = function () {\n var _a = (0, loading_1.waitting)(), update = _a[0], Wait = _a[1];\n var state = new ref_1.IORef(0);\n var f = function () { return purify_ts_1.EitherAsync.fromPromise(function () { return __awaiter(void 0, void 0, void 0, function () {\n var n;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, delay()];\n case 1:\n _a.sent();\n n = state.update(function (s) { return s + 1; }).ask();\n if (n % 2 === 0) {\n return [2 /*return*/, (0, purify_ts_1.Left)(\"偶数次必然出错!\")];\n }\n else {\n return [2 /*return*/, (0, purify_ts_1.Right)({\n view: function () { return m(message_1.Message, [\n m(\"div.header\", \"\\u4F60\\u4E00\\u5171\\u8BF7\\u6C42\\u4E86\".concat(n, \"\\u6B21\")),\n m(\"div\", [\n m(\"input\"),\n m(button_1.Button, { connectClick: function () { return update(f); } }, \"再请求一次!\")\n ])\n ]); }\n })];\n }\n return [2 /*return*/];\n }\n });\n }); }); };\n update(f);\n return {\n view: function () { return m(\"div\", [\n m(\"div\", \"偶数次会出现错误!\"),\n m(Wait)\n ]); }\n };\n};\nvar Main = {\n view: function () {\n return m(segment_1.Segment, [\n m(header_1.Header, { size: var_1.Size.Huge, isDivid: true }, \"普通样式\"),\n m(placeholder_1.FluidPlaceholder),\n m(header_1.Header, \"演示\"),\n m(Timer),\n (0, header_1.Header2)(\"延时性\"),\n m(WaitS)\n ]);\n }\n};\nexports[\"default\"] = Main;\n\n\n//# sourceURL=webpack:///./src/page/placeholder.ts?"); +eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nexports.__esModule = true;\nvar var_1 = __webpack_require__(/*! drifloon/data/var */ \"../dist/data/var.js\");\nvar header_1 = __webpack_require__(/*! drifloon/element/header */ \"../dist/element/header.js\");\nvar segment_1 = __webpack_require__(/*! drifloon/element/segment */ \"../dist/element/segment.js\");\nvar placeholder_1 = __webpack_require__(/*! drifloon/element/placeholder */ \"../dist/element/placeholder.js\");\nvar message_1 = __webpack_require__(/*! drifloon/element/message */ \"../dist/element/message.js\");\nvar load_1 = __webpack_require__(/*! drifloon/widget/load */ \"../dist/widget/load.js\");\nvar m = __webpack_require__(/*! mithril */ \"../node_modules/mithril/index.js\");\nvar ref_1 = __webpack_require__(/*! drifloon/data/ref */ \"../dist/data/ref.js\");\nvar purify_ts_1 = __webpack_require__(/*! purify-ts */ \"../node_modules/purify-ts/index.js\");\nvar button_1 = __webpack_require__(/*! drifloon/element/button */ \"../dist/element/button.js\");\nvar loader_1 = __webpack_require__(/*! drifloon/module/loader */ \"../dist/module/loader.js\");\nvar delay = function () { return new Promise(function (resolve) { return setTimeout(resolve, 1000); }); };\nvar Timer = function () {\n var list = new ref_1.IORef(purify_ts_1.Nothing);\n var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, delay()];\n case 1:\n _a.sent();\n list.put((0, purify_ts_1.Just)([1, 2, 3, 4, 5]));\n m.redraw();\n return [2 /*return*/];\n }\n });\n }); };\n var startTimer = function () {\n list.ask()\n .ifJust(function () { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n list.put(purify_ts_1.Nothing);\n return [4 /*yield*/, fetchData()];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); });\n };\n var render = function (xs) {\n return m(\"ol\", xs.map(function (x) { return m(\"li\", x); }));\n };\n fetchData();\n return {\n view: function () {\n return m(\"div\", [\n m(button_1.Button, { connectClick: startTimer }, \"执行\"),\n (0, load_1.loading)(render, list.ask())\n ]);\n }\n };\n};\nvar WaitS = function () {\n var _a = (0, loader_1.useDefLoader)(), update = _a[0], Wait = _a[1];\n var state = new ref_1.IORef(0);\n var f = function () { return purify_ts_1.EitherAsync.fromPromise(function () { return __awaiter(void 0, void 0, void 0, function () {\n var n;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, delay()];\n case 1:\n _a.sent();\n n = state.update(function (s) { return s + 1; }).ask();\n if (n % 2 === 0) {\n return [2 /*return*/, (0, purify_ts_1.Left)(\"偶数次必然出错!\")];\n }\n else {\n return [2 /*return*/, (0, purify_ts_1.Right)({\n view: function () { return m(message_1.Message, [\n m(\"div.header\", \"\\u4F60\\u4E00\\u5171\\u8BF7\\u6C42\\u4E86\".concat(n, \"\\u6B21\")),\n m(\"div\", [\n m(\"input\"),\n m(button_1.Button, { connectClick: function () { return update(f); } }, \"再请求一次!\")\n ])\n ]); }\n })];\n }\n return [2 /*return*/];\n }\n });\n }); }); };\n update(f);\n return {\n view: function () { return m(\"div\", [\n m(\"div\", \"偶数次会出现错误!\"),\n m(Wait)\n ]); }\n };\n};\nvar Main = {\n view: function () {\n return m(segment_1.Segment, [\n m(header_1.Header, { size: var_1.Size.Huge, isDivid: true }, \"普通样式\"),\n m(placeholder_1.FluidPlaceholder),\n m(header_1.Header, \"演示\"),\n m(Timer),\n (0, header_1.Header2)(\"延时性\"),\n m(WaitS)\n ]);\n }\n};\nexports[\"default\"] = Main;\n\n\n//# sourceURL=webpack:///./src/page/placeholder.ts?"); /***/ }),