From 9e579b93ed68971fab2bad02baf935a8024c1d23 Mon Sep 17 00:00:00 2001 From: Jingshao Chen Date: Sun, 3 Oct 2021 00:06:45 -0500 Subject: [PATCH 1/3] add animation in line color progress change --- src/lib/Steps.svelte | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/Steps.svelte b/src/lib/Steps.svelte index 84696df..19c03d4 100644 --- a/src/lib/Steps.svelte +++ b/src/lib/Steps.svelte @@ -31,6 +31,7 @@ @@ -82,7 +88,8 @@ >
@@ -125,7 +132,7 @@ {#if typeof step.text != 'undefined'}
Date: Sun, 3 Oct 2021 00:11:58 -0500 Subject: [PATCH 2/3] relese 1.0.0 and update package --- .svelte-kit/build/app.js | 24 +- .svelte-kit/build/runtime/app/stores.js | 4 +- .svelte-kit/build/runtime/internal/start.js | 177 ++- .svelte-kit/output/manifest.json | 23 +- .svelte-kit/output/server/app.js | 1531 ++++++++++++++++++- build/index.html | 11 +- package-lock.json | 1190 ++++++++++---- package.json | 2 +- package/README.md | 27 +- package/Steps.svelte | 13 +- package/package.json | 5 +- 11 files changed, 2535 insertions(+), 472 deletions(-) diff --git a/.svelte-kit/build/app.js b/.svelte-kit/build/app.js index 5e61236..2bb9684 100644 --- a/.svelte-kit/build/app.js +++ b/.svelte-kit/build/app.js @@ -22,9 +22,9 @@ export function init(settings = default_settings) { amp: false, dev: false, entry: { - file: assets + "/_app/start-6ee048f4.js", - css: [assets + "/_app/assets/start-61d1577b.css"], - js: [assets + "/_app/start-6ee048f4.js",assets + "/_app/chunks/vendor-8bd24f45.js"] + file: assets + "/_app/start-a2ef3d5b.js", + css: [assets + "/_app/assets/start-61d1577b.css",assets + "/_app/assets/vendor-03c6aa38.css"], + js: [assets + "/_app/start-a2ef3d5b.js",assets + "/_app/chunks/vendor-57e7c1f1.js"] }, fetched: undefined, floc: false, @@ -52,7 +52,21 @@ export function init(settings = default_settings) { }; } -const d = decodeURIComponent; +// input has already been decoded by decodeURI +// now handle the rest that decodeURIComponent would do +const d = s => s + .replace(/%23/g, '#') + .replace(/%3[Bb]/g, ';') + .replace(/%2[Cc]/g, ',') + .replace(/%2[Ff]/g, '/') + .replace(/%3[Ff]/g, '?') + .replace(/%3[Aa]/g, ':') + .replace(/%40/g, '@') + .replace(/%26/g, '&') + .replace(/%3[Dd]/g, '=') + .replace(/%2[Bb]/g, '+') + .replace(/%24/g, '$'); + const empty = () => ({}); const manifest = { @@ -83,7 +97,7 @@ const module_lookup = { ".svelte-kit/build/components/layout.svelte": () => import("./components/layout.svelte"),".svelte-kit/build/components/error.svelte": () => import("./components/error.svelte"),"src/routes/index.svelte": () => import("../../src/routes/index.svelte") }; -const metadata_lookup = {".svelte-kit/build/components/layout.svelte":{"entry":"layout.svelte-c46398ee.js","css":[],"js":["layout.svelte-c46398ee.js","chunks/vendor-8bd24f45.js"],"styles":[]},".svelte-kit/build/components/error.svelte":{"entry":"error.svelte-057bccf0.js","css":[],"js":["error.svelte-057bccf0.js","chunks/vendor-8bd24f45.js"],"styles":[]},"src/routes/index.svelte":{"entry":"pages/index.svelte-4230b66f.js","css":["assets/pages/index.svelte-f7c72b7f.css"],"js":["pages/index.svelte-4230b66f.js","chunks/vendor-8bd24f45.js"],"styles":[]}}; +const metadata_lookup = {".svelte-kit/build/components/layout.svelte":{"entry":"layout.svelte-2a73ad0e.js","css":["assets/vendor-03c6aa38.css"],"js":["layout.svelte-2a73ad0e.js","chunks/vendor-57e7c1f1.js"],"styles":[]},".svelte-kit/build/components/error.svelte":{"entry":"error.svelte-6146009c.js","css":["assets/vendor-03c6aa38.css"],"js":["error.svelte-6146009c.js","chunks/vendor-57e7c1f1.js"],"styles":[]},"src/routes/index.svelte":{"entry":"pages/index.svelte-48d49068.js","css":["assets/pages/index.svelte-f7c72b7f.css","assets/vendor-03c6aa38.css"],"js":["pages/index.svelte-48d49068.js","chunks/vendor-57e7c1f1.js"],"styles":[]}}; async function load_component(file) { const { entry, css, js, styles } = metadata_lookup[file]; diff --git a/.svelte-kit/build/runtime/app/stores.js b/.svelte-kit/build/runtime/app/stores.js index 20557cf..dcc2231 100644 --- a/.svelte-kit/build/runtime/app/stores.js +++ b/.svelte-kit/build/runtime/app/stores.js @@ -1,6 +1,8 @@ import { getContext } from 'svelte'; +import { browser } from './env.js'; +import '../env.js'; -const ssr = import.meta.env.SSR; +const ssr = !browser; // TODO remove this (for 1.0? after 1.0?) let warned = false; diff --git a/.svelte-kit/build/runtime/internal/start.js b/.svelte-kit/build/runtime/internal/start.js index 763d1e2..4410751 100644 --- a/.svelte-kit/build/runtime/internal/start.js +++ b/.svelte-kit/build/runtime/internal/start.js @@ -21,6 +21,16 @@ function find_anchor(node) { return /** @type {HTMLAnchorElement | SVGAElement} */ (node); } +/** + * @param {HTMLAnchorElement | SVGAElement} node + * @returns {URL} + */ +function get_href(node) { + return node instanceof SVGAElement + ? new URL(node.href.baseVal, document.baseURI) + : new URL(node.href); +} + class Router { /** * @param {{ @@ -88,7 +98,7 @@ class Router { const trigger_prefetch = (event) => { const a = find_anchor(/** @type {Node} */ (event.target)); if (a && a.href && a.hasAttribute('sveltekit:prefetch')) { - this.prefetch(new URL(/** @type {string} */ (a.href))); + this.prefetch(get_href(a)); } }; @@ -121,12 +131,8 @@ class Router { if (!a.href) return; - // check if link is inside an svg - // in this case, both href and target are always inside an object - const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString'; - const href = String(svg ? /** @type {SVGAElement} */ (a).href.baseVal : a.href); - - if (href === location.href) { + const url = get_href(a); + if (url.toString() === location.href) { if (!location.hash) event.preventDefault(); return; } @@ -141,9 +147,7 @@ class Router { } // Ignore if has a target - if (svg ? /** @type {SVGAElement} */ (a).target.baseVal : a.target) return; - - const url = new URL(href); + if (a instanceof SVGAElement ? a.target.baseVal : a.target) return; if (!this.owns(url)) return; @@ -267,26 +271,21 @@ class Router { query: info.query }); - await this.renderer.update(info, chain, false); - - if (!keepfocus) { - document.body.focus(); - } - - const deep_linked = hash && document.getElementById(hash.slice(1)); - if (scroll) { - scrollTo(scroll.x, scroll.y); - } else if (deep_linked) { - // Here we use `scrollIntoView` on the element instead of `scrollTo` - // because it natively supports the `scroll-margin` and `scroll-behavior` - // CSS properties. - deep_linked.scrollIntoView(); - } else { - scrollTo(0, 0); - } + await this.renderer.update(info, chain, false, { hash, scroll, keepfocus }); } } +/** + * @param {unknown} err + * @return {Error} + */ +function coalesce_to_error(err) { + return err instanceof Error || + (err && /** @type {any} */ (err).name && /** @type {any} */ (err).message) + ? /** @type {Error} */ (err) + : new Error(JSON.stringify(err)); +} + /** * Hash using djb2 * @param {import('types/hooks').StrictBody} value @@ -358,15 +357,15 @@ function normalize(loaded) { } } - return /** @type {import('types/internal').NormalizedLoadOutput} */ (loaded); -} + // TODO remove before 1.0 + if (/** @type {any} */ (loaded).context) { + throw new Error( + 'You are returning "context" from a load function. ' + + '"context" was renamed to "stuff", please adjust your code accordingly.' + ); + } -/** - * @param {unknown} err - * @return {Error} - */ -function coalesce_to_error(err) { - return err instanceof Error ? err : new Error(JSON.stringify(err)); + return /** @type {import('types/internal').NormalizedLoadOutput} */ (loaded); } /** @@ -413,7 +412,7 @@ function page_store(value) { function initial_fetch(resource, opts) { const url = typeof resource === 'string' ? resource : resource.url; - let selector = `script[data-type="svelte-data"][data-url="${url}"]`; + let selector = `script[data-type="svelte-data"][data-url=${JSON.stringify(url)}]`; if (opts && typeof opts.body === 'string') { selector += `[data-body="${hash(opts.body)}"]`; @@ -429,13 +428,15 @@ function initial_fetch(resource, opts) { } class Renderer { - /** @param {{ + /** + * @param {{ * Root: CSRComponent; * fallback: [CSRComponent, CSRComponent]; * target: Node; * session: any; * host: string; - * }} opts */ + * }} opts + */ constructor({ Root, fallback, target, session, host }) { this.Root = Root; this.fallback = fallback; @@ -505,7 +506,7 @@ class Renderer { const branch = []; /** @type {Record} */ - let context = {}; + let stuff = {}; /** @type {import('./types').NavigationResult | undefined} */ let result; @@ -519,7 +520,7 @@ class Renderer { const node = await this._load_node({ module: await nodes[i], page, - context, + stuff, status: is_leaf ? status : undefined, error: is_leaf ? error : undefined }); @@ -535,10 +536,10 @@ class Renderer { path: page.path, query: page.query }; - } else if (node.loaded.context) { - context = { - ...context, - ...node.loaded.context + } else if (node.loaded.stuff) { + stuff = { + ...stuff, + ...node.loaded.stuff }; } } @@ -547,7 +548,7 @@ class Renderer { result = error_args ? await this._load_error(error_args) : await this._get_navigation_result_from_branch({ page, branch }); - } catch (/** @type {unknown} */ e) { + } catch (e) { if (error) throw e; result = await this._load_error({ @@ -590,8 +591,9 @@ class Renderer { * @param {import('./types').NavigationInfo} info * @param {string[]} chain * @param {boolean} no_cache + * @param {{hash?: string, scroll: { x: number, y: number } | null, keepfocus: boolean}} [opts] */ - async update(info, chain, no_cache) { + async update(info, chain, no_cache, opts) { const token = (this.token = {}); let navigation_result = await this._get_navigation_result(info, no_cache); @@ -629,12 +631,31 @@ class Renderer { this.root.$set(navigation_result.props); this.stores.navigating.set(null); - - await 0; } else { this._init(navigation_result); } + if (opts) { + const { hash, scroll, keepfocus } = opts; + + if (!keepfocus) { + document.body.focus(); + } + + const deep_linked = hash && document.getElementById(hash.slice(1)); + if (scroll) { + scrollTo(scroll.x, scroll.y); + } else if (deep_linked) { + // Here we use `scrollIntoView` on the element instead of `scrollTo` + // because it natively supports the `scroll-margin` and `scroll-behavior` + // CSS properties. + deep_linked.scrollIntoView(); + } else { + scrollTo(0, 0); + } + } + + await 0; dispatchEvent(new CustomEvent('sveltekit:navigation-end')); this.loading.promise = null; this.loading.id = null; @@ -755,9 +776,11 @@ class Renderer { */ async _get_navigation_result_from_branch({ page, branch }) { const filtered = /** @type {import('./types').BranchNode[] } */ (branch.filter(Boolean)); + const redirect = filtered.find((f) => f.loaded && f.loaded.redirect); /** @type {import('./types').NavigationResult} */ const result = { + redirect: redirect && redirect.loaded ? redirect.loaded.redirect : undefined, state: { page, branch, @@ -770,7 +793,7 @@ class Renderer { for (let i = 0; i < filtered.length; i += 1) { const loaded = filtered[i].loaded; - if (loaded) result.props[`props_${i}`] = await loaded.props; + result.props[`props_${i}`] = loaded ? await loaded.props : null; } if ( @@ -817,11 +840,11 @@ class Renderer { * error?: Error; * module: CSRComponent; * page: import('types/page').Page; - * context: Record; + * stuff: Record; * }} options * @returns */ - async _load_node({ status, error, module, page, context }) { + async _load_node({ status, error, module, page, stuff }) { /** @type {import('./types').BranchNode} */ const node = { module, @@ -830,11 +853,11 @@ class Renderer { path: false, query: false, session: false, - context: false, + stuff: false, dependencies: [] }, loaded: null, - context + stuff }; /** @type {Record} */ @@ -872,9 +895,9 @@ class Renderer { node.uses.session = true; return session; }, - get context() { - node.uses.context = true; - return { ...context }; + get stuff() { + node.uses.stuff = true; + return { ...stuff }; }, fetch(resource, info) { const url = typeof resource === 'string' ? resource : resource.url; @@ -896,7 +919,7 @@ class Renderer { if (!loaded) return; node.loaded = normalize(loaded); - if (node.loaded.context) node.context = node.loaded.context; + if (node.loaded.stuff) node.stuff = node.loaded.stuff; } return node; @@ -932,11 +955,11 @@ class Renderer { const page = { host: this.host, path, query, params }; /** @type {Array} */ - const branch = []; + let branch = []; /** @type {Record} */ - let context = {}; - let context_changed = false; + let stuff = {}; + let stuff_changed = false; /** @type {number | undefined} */ let status = 200; @@ -965,13 +988,13 @@ class Renderer { (changed.query && previous.uses.query) || (changed.session && previous.uses.session) || previous.uses.dependencies.some((dep) => this.invalid.has(dep)) || - (context_changed && previous.uses.context); + (stuff_changed && previous.uses.stuff); if (changed_since_last_render) { node = await this._load_node({ module, page, - context + stuff }); const is_leaf = i === a.length - 1; @@ -990,8 +1013,8 @@ class Renderer { }; } - if (node.loaded.context) { - context_changed = true; + if (node.loaded.stuff) { + stuff_changed = true; } } else if (is_leaf && module.load) { // if the leaf node has a `load` function @@ -1003,7 +1026,7 @@ class Renderer { } } catch (e) { status = 500; - error = e; + error = coalesce_to_error(e); } if (error) { @@ -1024,14 +1047,14 @@ class Renderer { error, module: await b[i](), page, - context: node_loaded.context + stuff: node_loaded.stuff }); if (error_loaded && error_loaded.loaded && error_loaded.loaded.error) { continue; } - branch.push(error_loaded); + branch = branch.slice(0, j + 1).concat(error_loaded); break load; } catch (e) { continue; @@ -1046,10 +1069,10 @@ class Renderer { query }); } else { - if (node && node.loaded && node.loaded.context) { - context = { - ...context, - ...node.loaded.context + if (node && node.loaded && node.loaded.stuff) { + stuff = { + ...stuff, + ...node.loaded.stuff }; } @@ -1079,7 +1102,7 @@ class Renderer { const node = await this._load_node({ module: await this.fallback[0], page, - context: {} + stuff: {} }); const branch = [ @@ -1089,7 +1112,7 @@ class Renderer { error, module: await this.fallback[1], page, - context: (node && node.loaded && node.loaded.context) || {} + stuff: (node && node.loaded && node.loaded.stuff) || {} }) ]; @@ -1097,9 +1120,10 @@ class Renderer { } } -// @ts-ignore - value will be replaced on build step +// @ts-expect-error - value will be replaced on build step -/** @param {{ +/** + * @param {{ * paths: { * assets: string; * base: string; @@ -1116,7 +1140,8 @@ class Renderer { * nodes: Array>; * page: import('types/page').Page; * }; - * }} opts */ + * }} opts + */ async function start({ paths, target, session, host, route, spa, trailing_slash, hydrate }) { if (import.meta.env.DEV && !target) { throw new Error('Missing target element. See https://kit.svelte.dev/docs#configuration-target'); diff --git a/.svelte-kit/output/manifest.json b/.svelte-kit/output/manifest.json index c2cef29..7e69cd3 100644 --- a/.svelte-kit/output/manifest.json +++ b/.svelte-kit/output/manifest.json @@ -1,10 +1,10 @@ { ".svelte-kit/build/runtime/internal/start.js": { - "file": "start-6ee048f4.js", + "file": "start-a2ef3d5b.js", "src": ".svelte-kit/build/runtime/internal/start.js", "isEntry": true, "imports": [ - "_vendor-8bd24f45.js" + "_vendor-57e7c1f1.js" ], "dynamicImports": [ ".svelte-kit/build/components/layout.svelte", @@ -16,36 +16,39 @@ ] }, ".svelte-kit/build/components/layout.svelte": { - "file": "layout.svelte-c46398ee.js", + "file": "layout.svelte-2a73ad0e.js", "src": ".svelte-kit/build/components/layout.svelte", "isEntry": true, "isDynamicEntry": true, "imports": [ - "_vendor-8bd24f45.js" + "_vendor-57e7c1f1.js" ] }, ".svelte-kit/build/components/error.svelte": { - "file": "error.svelte-057bccf0.js", + "file": "error.svelte-6146009c.js", "src": ".svelte-kit/build/components/error.svelte", "isEntry": true, "isDynamicEntry": true, "imports": [ - "_vendor-8bd24f45.js" + "_vendor-57e7c1f1.js" ] }, "src/routes/index.svelte": { - "file": "pages/index.svelte-4230b66f.js", + "file": "pages/index.svelte-48d49068.js", "src": "src/routes/index.svelte", "isEntry": true, "isDynamicEntry": true, "imports": [ - "_vendor-8bd24f45.js" + "_vendor-57e7c1f1.js" ], "css": [ "assets/pages/index.svelte-f7c72b7f.css" ] }, - "_vendor-8bd24f45.js": { - "file": "chunks/vendor-8bd24f45.js" + "_vendor-57e7c1f1.js": { + "file": "chunks/vendor-57e7c1f1.js", + "css": [ + "assets/vendor-03c6aa38.css" + ] } } \ No newline at end of file diff --git a/.svelte-kit/output/server/app.js b/.svelte-kit/output/server/app.js index dde580f..5545503 100644 --- a/.svelte-kit/output/server/app.js +++ b/.svelte-kit/output/server/app.js @@ -1,8 +1,1300 @@ -import { respond } from "@sveltejs/kit/ssr"; +var __accessCheck = (obj, member, msg) => { + if (!member.has(obj)) + throw TypeError("Cannot " + msg); +}; +var __privateGet = (obj, member, getter) => { + __accessCheck(obj, member, "read from private field"); + return getter ? getter.call(obj) : member.get(obj); +}; +var __privateAdd = (obj, member, value) => { + if (member.has(obj)) + throw TypeError("Cannot add the same private member more than once"); + member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +}; +var __privateSet = (obj, member, value, setter) => { + __accessCheck(obj, member, "write to private field"); + setter ? setter.call(obj, value) : member.set(obj, value); + return value; +}; +var _map; import hljs from "highlight.js/lib/core"; import xml from "highlight.js/lib/languages/xml"; import javascript from "highlight.js/lib/languages/javascript"; -import css$3 from "highlight.js/lib/languages/css"; +import css$4 from "highlight.js/lib/languages/css"; +function get_single_valued_header(headers, key) { + const value = headers[key]; + if (Array.isArray(value)) { + if (value.length === 0) { + return void 0; + } + if (value.length > 1) { + throw new Error(`Multiple headers provided for ${key}. Multiple may be provided only for set-cookie`); + } + return value[0]; + } + return value; +} +function coalesce_to_error(err) { + return err instanceof Error || err && err.name && err.message ? err : new Error(JSON.stringify(err)); +} +function lowercase_keys(obj) { + const clone = {}; + for (const key in obj) { + clone[key.toLowerCase()] = obj[key]; + } + return clone; +} +function error$1(body) { + return { + status: 500, + body, + headers: {} + }; +} +function is_string(s2) { + return typeof s2 === "string" || s2 instanceof String; +} +function is_content_type_textual(content_type) { + if (!content_type) + return true; + const [type] = content_type.split(";"); + return type === "text/plain" || type === "application/json" || type === "application/x-www-form-urlencoded" || type === "multipart/form-data"; +} +async function render_endpoint(request, route, match) { + const mod = await route.load(); + const handler = mod[request.method.toLowerCase().replace("delete", "del")]; + if (!handler) { + return; + } + const params = route.params(match); + const response = await handler({ ...request, params }); + const preface = `Invalid response from route ${request.path}`; + if (!response) { + return; + } + if (typeof response !== "object") { + return error$1(`${preface}: expected an object, got ${typeof response}`); + } + let { status = 200, body, headers = {} } = response; + headers = lowercase_keys(headers); + const type = get_single_valued_header(headers, "content-type"); + const is_type_textual = is_content_type_textual(type); + if (!is_type_textual && !(body instanceof Uint8Array || is_string(body))) { + return error$1(`${preface}: body must be an instance of string or Uint8Array if content-type is not a supported textual content-type`); + } + let normalized_body; + if ((typeof body === "object" || typeof body === "undefined") && !(body instanceof Uint8Array) && (!type || type.startsWith("application/json"))) { + headers = { ...headers, "content-type": "application/json; charset=utf-8" }; + normalized_body = JSON.stringify(typeof body === "undefined" ? {} : body); + } else { + normalized_body = body; + } + return { status, body: normalized_body, headers }; +} +var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$"; +var unsafeChars = /[<>\b\f\n\r\t\0\u2028\u2029]/g; +var reserved = /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/; +var escaped$1 = { + "<": "\\u003C", + ">": "\\u003E", + "/": "\\u002F", + "\\": "\\\\", + "\b": "\\b", + "\f": "\\f", + "\n": "\\n", + "\r": "\\r", + " ": "\\t", + "\0": "\\0", + "\u2028": "\\u2028", + "\u2029": "\\u2029" +}; +var objectProtoOwnPropertyNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0"); +function devalue(value) { + var counts = new Map(); + function walk(thing) { + if (typeof thing === "function") { + throw new Error("Cannot stringify a function"); + } + if (counts.has(thing)) { + counts.set(thing, counts.get(thing) + 1); + return; + } + counts.set(thing, 1); + if (!isPrimitive(thing)) { + var type = getType(thing); + switch (type) { + case "Number": + case "String": + case "Boolean": + case "Date": + case "RegExp": + return; + case "Array": + thing.forEach(walk); + break; + case "Set": + case "Map": + Array.from(thing).forEach(walk); + break; + default: + var proto = Object.getPrototypeOf(thing); + if (proto !== Object.prototype && proto !== null && Object.getOwnPropertyNames(proto).sort().join("\0") !== objectProtoOwnPropertyNames) { + throw new Error("Cannot stringify arbitrary non-POJOs"); + } + if (Object.getOwnPropertySymbols(thing).length > 0) { + throw new Error("Cannot stringify POJOs with symbolic keys"); + } + Object.keys(thing).forEach(function(key) { + return walk(thing[key]); + }); + } + } + } + walk(value); + var names = new Map(); + Array.from(counts).filter(function(entry) { + return entry[1] > 1; + }).sort(function(a, b) { + return b[1] - a[1]; + }).forEach(function(entry, i) { + names.set(entry[0], getName(i)); + }); + function stringify(thing) { + if (names.has(thing)) { + return names.get(thing); + } + if (isPrimitive(thing)) { + return stringifyPrimitive(thing); + } + var type = getType(thing); + switch (type) { + case "Number": + case "String": + case "Boolean": + return "Object(" + stringify(thing.valueOf()) + ")"; + case "RegExp": + return "new RegExp(" + stringifyString(thing.source) + ', "' + thing.flags + '")'; + case "Date": + return "new Date(" + thing.getTime() + ")"; + case "Array": + var members = thing.map(function(v, i) { + return i in thing ? stringify(v) : ""; + }); + var tail = thing.length === 0 || thing.length - 1 in thing ? "" : ","; + return "[" + members.join(",") + tail + "]"; + case "Set": + case "Map": + return "new " + type + "([" + Array.from(thing).map(stringify).join(",") + "])"; + default: + var obj = "{" + Object.keys(thing).map(function(key) { + return safeKey(key) + ":" + stringify(thing[key]); + }).join(",") + "}"; + var proto = Object.getPrototypeOf(thing); + if (proto === null) { + return Object.keys(thing).length > 0 ? "Object.assign(Object.create(null)," + obj + ")" : "Object.create(null)"; + } + return obj; + } + } + var str = stringify(value); + if (names.size) { + var params_1 = []; + var statements_1 = []; + var values_1 = []; + names.forEach(function(name, thing) { + params_1.push(name); + if (isPrimitive(thing)) { + values_1.push(stringifyPrimitive(thing)); + return; + } + var type = getType(thing); + switch (type) { + case "Number": + case "String": + case "Boolean": + values_1.push("Object(" + stringify(thing.valueOf()) + ")"); + break; + case "RegExp": + values_1.push(thing.toString()); + break; + case "Date": + values_1.push("new Date(" + thing.getTime() + ")"); + break; + case "Array": + values_1.push("Array(" + thing.length + ")"); + thing.forEach(function(v, i) { + statements_1.push(name + "[" + i + "]=" + stringify(v)); + }); + break; + case "Set": + values_1.push("new Set"); + statements_1.push(name + "." + Array.from(thing).map(function(v) { + return "add(" + stringify(v) + ")"; + }).join(".")); + break; + case "Map": + values_1.push("new Map"); + statements_1.push(name + "." + Array.from(thing).map(function(_a) { + var k = _a[0], v = _a[1]; + return "set(" + stringify(k) + ", " + stringify(v) + ")"; + }).join(".")); + break; + default: + values_1.push(Object.getPrototypeOf(thing) === null ? "Object.create(null)" : "{}"); + Object.keys(thing).forEach(function(key) { + statements_1.push("" + name + safeProp(key) + "=" + stringify(thing[key])); + }); + } + }); + statements_1.push("return " + str); + return "(function(" + params_1.join(",") + "){" + statements_1.join(";") + "}(" + values_1.join(",") + "))"; + } else { + return str; + } +} +function getName(num) { + var name = ""; + do { + name = chars[num % chars.length] + name; + num = ~~(num / chars.length) - 1; + } while (num >= 0); + return reserved.test(name) ? name + "_" : name; +} +function isPrimitive(thing) { + return Object(thing) !== thing; +} +function stringifyPrimitive(thing) { + if (typeof thing === "string") + return stringifyString(thing); + if (thing === void 0) + return "void 0"; + if (thing === 0 && 1 / thing < 0) + return "-0"; + var str = String(thing); + if (typeof thing === "number") + return str.replace(/^(-)?0\./, "$1."); + return str; +} +function getType(thing) { + return Object.prototype.toString.call(thing).slice(8, -1); +} +function escapeUnsafeChar(c) { + return escaped$1[c] || c; +} +function escapeUnsafeChars(str) { + return str.replace(unsafeChars, escapeUnsafeChar); +} +function safeKey(key) { + return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escapeUnsafeChars(JSON.stringify(key)); +} +function safeProp(key) { + return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? "." + key : "[" + escapeUnsafeChars(JSON.stringify(key)) + "]"; +} +function stringifyString(str) { + var result = '"'; + for (var i = 0; i < str.length; i += 1) { + var char = str.charAt(i); + var code = char.charCodeAt(0); + if (char === '"') { + result += '\\"'; + } else if (char in escaped$1) { + result += escaped$1[char]; + } else if (code >= 55296 && code <= 57343) { + var next = str.charCodeAt(i + 1); + if (code <= 56319 && (next >= 56320 && next <= 57343)) { + result += char + str[++i]; + } else { + result += "\\u" + code.toString(16).toUpperCase(); + } + } else { + result += char; + } + } + result += '"'; + return result; +} +function noop$1() { +} +function safe_not_equal$1(a, b) { + return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function"); +} +Promise.resolve(); +const subscriber_queue$1 = []; +function writable$1(value, start = noop$1) { + let stop; + const subscribers = new Set(); + function set(new_value) { + if (safe_not_equal$1(value, new_value)) { + value = new_value; + if (stop) { + const run_queue = !subscriber_queue$1.length; + for (const subscriber of subscribers) { + subscriber[1](); + subscriber_queue$1.push(subscriber, value); + } + if (run_queue) { + for (let i = 0; i < subscriber_queue$1.length; i += 2) { + subscriber_queue$1[i][0](subscriber_queue$1[i + 1]); + } + subscriber_queue$1.length = 0; + } + } + } + } + function update(fn) { + set(fn(value)); + } + function subscribe2(run2, invalidate = noop$1) { + const subscriber = [run2, invalidate]; + subscribers.add(subscriber); + if (subscribers.size === 1) { + stop = start(set) || noop$1; + } + run2(value); + return () => { + subscribers.delete(subscriber); + if (subscribers.size === 0) { + stop(); + stop = null; + } + }; + } + return { set, update, subscribe: subscribe2 }; +} +function hash(value) { + let hash2 = 5381; + let i = value.length; + if (typeof value === "string") { + while (i) + hash2 = hash2 * 33 ^ value.charCodeAt(--i); + } else { + while (i) + hash2 = hash2 * 33 ^ value[--i]; + } + return (hash2 >>> 0).toString(36); +} +const escape_json_string_in_html_dict = { + '"': '\\"', + "<": "\\u003C", + ">": "\\u003E", + "/": "\\u002F", + "\\": "\\\\", + "\b": "\\b", + "\f": "\\f", + "\n": "\\n", + "\r": "\\r", + " ": "\\t", + "\0": "\\0", + "\u2028": "\\u2028", + "\u2029": "\\u2029" +}; +function escape_json_string_in_html(str) { + return escape$1(str, escape_json_string_in_html_dict, (code) => `\\u${code.toString(16).toUpperCase()}`); +} +const escape_html_attr_dict = { + "<": "<", + ">": ">", + '"': """ +}; +function escape_html_attr(str) { + return '"' + escape$1(str, escape_html_attr_dict, (code) => `&#${code};`) + '"'; +} +function escape$1(str, dict, unicode_encoder) { + let result = ""; + for (let i = 0; i < str.length; i += 1) { + const char = str.charAt(i); + const code = char.charCodeAt(0); + if (char in dict) { + result += dict[char]; + } else if (code >= 55296 && code <= 57343) { + const next = str.charCodeAt(i + 1); + if (code <= 56319 && next >= 56320 && next <= 57343) { + result += char + str[++i]; + } else { + result += unicode_encoder(code); + } + } else { + result += char; + } + } + return result; +} +const s$1 = JSON.stringify; +async function render_response({ + branch, + options: options2, + $session, + page_config, + status, + error: error2, + page +}) { + const css2 = new Set(options2.entry.css); + const js = new Set(options2.entry.js); + const styles = new Set(); + const serialized_data = []; + let rendered; + let is_private = false; + let maxage; + if (error2) { + error2.stack = options2.get_stack(error2); + } + if (page_config.ssr) { + branch.forEach(({ node, loaded, fetched, uses_credentials }) => { + if (node.css) + node.css.forEach((url) => css2.add(url)); + if (node.js) + node.js.forEach((url) => js.add(url)); + if (node.styles) + node.styles.forEach((content) => styles.add(content)); + if (fetched && page_config.hydrate) + serialized_data.push(...fetched); + if (uses_credentials) + is_private = true; + maxage = loaded.maxage; + }); + const session = writable$1($session); + const props = { + stores: { + page: writable$1(null), + navigating: writable$1(null), + session + }, + page, + components: branch.map(({ node }) => node.module.default) + }; + for (let i = 0; i < branch.length; i += 1) { + props[`props_${i}`] = await branch[i].loaded.props; + } + let session_tracking_active = false; + const unsubscribe = session.subscribe(() => { + if (session_tracking_active) + is_private = true; + }); + session_tracking_active = true; + try { + rendered = options2.root.render(props); + } finally { + unsubscribe(); + } + } else { + rendered = { head: "", html: "", css: { code: "", map: null } }; + } + const include_js = page_config.router || page_config.hydrate; + if (!include_js) + js.clear(); + const links = options2.amp ? styles.size > 0 || rendered.css.code.length > 0 ? `` : "" : [ + ...Array.from(js).map((dep) => ``), + ...Array.from(css2).map((dep) => ``) + ].join("\n "); + let init2 = ""; + if (options2.amp) { + init2 = ` + + + @@ -30,9 +33,9 @@ npm install --saveDev svelte-steps ```javascript let steps = [ - { text: 'step one', icon: IconMoney }, - { text: 'step two', icon: IconPaperClip }, - { text: 'the last step', icon: IconPerson } + { text: 'step one', icon: IconMoney }, + { text: 'step two', icon: IconPaperClip }, + { text: 'the last step', icon: IconPerson } ] ``` @@ -58,9 +61,9 @@ let steps = [ ```javascript let steps = [ - { icon: IconMoney }, - { icon: IconPaperClip }, - { icon: IconPerson } + { icon: IconMoney }, + { icon: IconPaperClip }, + { icon: IconPerson } ] ``` @@ -120,4 +123,4 @@ It by default uses `--bs-primary`, `--bs-secondary`, `--bs-light`, and `--bs-dar - `on:click(e)`: click event with arg as the clicked step index as `e.detail.current` and last step index as `e.detail.last` - + diff --git a/package/Steps.svelte b/package/Steps.svelte index 84696df..19c03d4 100644 --- a/package/Steps.svelte +++ b/package/Steps.svelte @@ -31,6 +31,7 @@ @@ -82,7 +88,8 @@ >
@@ -125,7 +132,7 @@ {#if typeof step.text != 'undefined'}
Date: Sun, 3 Oct 2021 00:34:27 -0500 Subject: [PATCH 3/3] gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index fa44129..e25acd5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ node_modules /build .svelte-kit/build .svelte-kit/output +.svelte-kit/dev +.firebase/ \ No newline at end of file