diff --git a/package.json b/package.json index c750667a4..ec8031c83 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "description": "Patternslib is a JavaScript library that enables designers to build rich interactive prototypes without the need for writing any Javascript. All events are triggered by classes and other attributes in the HTML, without abusing the HTML as a programming language. Accessibility, SEO and well structured HTML are core values of Patterns.", "license": "BSD-3-Clause", "dependencies": { + "@patternslib/core": "file:./src/core", "@fullcalendar/adaptive": "^5.11.3", "@fullcalendar/core": "^5.11.3", "@fullcalendar/daygrid": "^5.11.3", diff --git a/src/core/base.js b/src/core/base.js index 285a6107e..0077f77d1 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -144,3 +144,4 @@ Base.extend = function (patternProps) { }; export default Base; +export { Base }; diff --git a/src/core/dom.js b/src/core/dom.js index 1bed430d0..ad59a29bc 100644 --- a/src/core/dom.js +++ b/src/core/dom.js @@ -315,3 +315,4 @@ const dom = { }; export default dom; +export { dom }; diff --git a/src/core/events.js b/src/core/events.js index eaf7bbafe..48ae0d5e5 100644 --- a/src/core/events.js +++ b/src/core/events.js @@ -160,7 +160,7 @@ const submit_event = () => { }); }; -export default { +const events = { add_event_listener: add_event_listener, remove_event_listener: remove_event_listener, await_event: await_event, @@ -175,3 +175,6 @@ export default { scroll_event: scroll_event, submit_event: submit_event, }; + +export default events; +export { events }; diff --git a/src/core/i18n.js b/src/core/i18n.js index 754f21310..8437bc6ff 100644 --- a/src/core/i18n.js +++ b/src/core/i18n.js @@ -10,3 +10,5 @@ export default function translate(str) { return str; } + +export { translate }; diff --git a/src/core/index.js b/src/core/index.js new file mode 100644 index 000000000..c0e834f7a --- /dev/null +++ b/src/core/index.js @@ -0,0 +1,18 @@ +// @patternslib/core exports + +export * from "./polyfills"; +export { Base } from "./base"; +export { Parser } from "./parser"; +export { PushKit } from "./push_kit"; +export { Registry, PATTERN_REGISTRY } from "./registry"; +export { dom } from "./dom"; +export { events } from "./events"; +export { logging } from "./logging"; +export { utils } from "./utils"; + +//export * as i18n from "./i18n"; +//export * as jquery_ext from "./jquery-ext"; +//export * as mockup_parser from "./mockup-parser"; +//export * as remove from "./remove"; +//export * as store from "./store"; +//export * as url from "./url"; diff --git a/src/core/logging.js b/src/core/logging.js index e96477f7e..b1431543e 100644 --- a/src/core/logging.js +++ b/src/core/logging.js @@ -180,3 +180,4 @@ var api = { }; export default api; +export { api as logging }; diff --git a/src/core/mockup-parser.js b/src/core/mockup-parser.js index 65de6478a..11069414b 100644 --- a/src/core/mockup-parser.js +++ b/src/core/mockup-parser.js @@ -42,3 +42,4 @@ var parser = { }; export default parser; +export { parser as Parser }; diff --git a/src/core/package.json b/src/core/package.json new file mode 100644 index 000000000..6707a96ac --- /dev/null +++ b/src/core/package.json @@ -0,0 +1,19 @@ +{ + "name": "@patternslib/core", + "description": "Patternslib core library", + "version": "1.0.0", + "homepage": "https://patternslib.com", + "keywords": [ + "patternslib" + ], + "license": "BSD-3-Clause", + "main": "./index.js", + "dependencies": { + "@patternslib/dev": "^2.7.2" + }, + "repository": { + "type": "git", + "url": "https://github.com/patternslib/patterns.git", + "directory": "src" + } +} diff --git a/src/core/parser.js b/src/core/parser.js index 466c88fb2..92b4a7f32 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -476,3 +476,4 @@ class ArgumentParser { ArgumentParser.prototype.add_argument = ArgumentParser.prototype.addArgument; export default ArgumentParser; +export { ArgumentParser as Parser }; diff --git a/src/core/push_kit.js b/src/core/push_kit.js index 3cf448de0..7301be113 100644 --- a/src/core/push_kit.js +++ b/src/core/push_kit.js @@ -92,3 +92,4 @@ const push_kit = { push_kit.init(); export default push_kit; +export { push_kit as PushKit }; diff --git a/src/core/registry.js b/src/core/registry.js index 1f13c3b29..aa1a3f1ee 100644 --- a/src/core/registry.js +++ b/src/core/registry.js @@ -49,7 +49,7 @@ while ((match = dont_catch_re.exec(window.location.search)) !== null) { if (typeof window.__patternslib_registry === "undefined") { window.__patternslib_registry = {}; } -export const PATTERN_REGISTRY = window.__patternslib_registry; +const PATTERN_REGISTRY = window.__patternslib_registry; if (typeof window.__patternslib_registry_initialized === "undefined") { window.__patternslib_registry_initialized = false; } @@ -230,3 +230,4 @@ const registry = { }; export default registry; +export { registry as Registry, PATTERN_REGISTRY }; diff --git a/src/core/store.js b/src/core/store.js index adbde335d..b5edd2fb6 100644 --- a/src/core/store.js +++ b/src/core/store.js @@ -130,3 +130,4 @@ try { } export default store; +export { store as Store }; diff --git a/src/core/utils.js b/src/core/utils.js index fc3ea03dd..2c7f811c4 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -715,3 +715,4 @@ var utils = { }; export default utils; +export { utils }; diff --git a/src/pat/validation/validation.js b/src/pat/validation/validation.js index 4ee831c26..56f176339 100644 --- a/src/pat/validation/validation.js +++ b/src/pat/validation/validation.js @@ -1,11 +1,6 @@ // Patterns validate - Form vlidation -import "../../core/polyfills"; // SubmitEvent.submitter for Safari < 15.4 and jsDOM -import Base from "../../core/base"; -import Parser from "../../core/parser"; -import dom from "../../core/dom"; -import events from "../../core/events"; -import logging from "../../core/logging"; -import utils from "../../core/utils"; +import "@patternslib/core/polyfills"; // SubmitEvent.submitter for Safari < 15.4 and jsDOM +import { Base, Parser, dom, events, logging, utils } from "@patternslib/core"; const log = logging.getLogger("pat-validation"); //log.setLevel(logging.Level.DEBUG); diff --git a/src/pat/validation/validation.test.js b/src/pat/validation/validation.test.js index 07c260e72..77bcbeaa6 100644 --- a/src/pat/validation/validation.test.js +++ b/src/pat/validation/validation.test.js @@ -1,6 +1,6 @@ import Pattern, { parser } from "./validation"; -import events from "../../core/events"; -import utils from "../../core/utils"; +import events from "@patternslib/core/events"; +import utils from "@patternslib/core/utils"; import { jest } from "@jest/globals"; describe("pat-validation", function () { diff --git a/src/polyfills.js b/src/polyfills.js index 43e46e758..e4f789c3e 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -17,6 +17,7 @@ import "promise-polyfill/src/polyfill"; import "url-polyfill"; import "whatwg-fetch"; import { ResizeObserver as ResizeObserverPolyfill } from "@juggle/resize-observer"; +import "./core/polyfills"; if ("ResizeObserver" in window === false) { window.ResizeObserver = ResizeObserverPolyfill; diff --git a/yarn.lock b/yarn.lock index cb70c4f2f..7023e3418 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1949,6 +1949,11 @@ colorette "^2.0.16" ora "^5.4.1" +"@patternslib/core@file:./src/core": + version "1.0.0" + dependencies: + "@patternslib/dev" "^2.7.2" + "@patternslib/dev@^2.7.2": version "2.7.2" resolved "https://registry.yarnpkg.com/@patternslib/dev/-/dev-2.7.2.tgz#3c793ae25dc1b19880794ebbd2e4fe84cd9db9b7"