Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core monorepo - @patternslib/core experiements #1070

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/core/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ Base.extend = function (patternProps) {
};

export default Base;
export { Base };
1 change: 1 addition & 0 deletions src/core/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ const dom = {
};

export default dom;
export { dom };
5 changes: 4 additions & 1 deletion src/core/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -175,3 +175,6 @@ export default {
scroll_event: scroll_event,
submit_event: submit_event,
};

export default events;
export { events };
2 changes: 2 additions & 0 deletions src/core/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
export default function translate(str) {
return str;
}

export { translate };
18 changes: 18 additions & 0 deletions src/core/index.js
Original file line number Diff line number Diff line change
@@ -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";
1 change: 1 addition & 0 deletions src/core/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,4 @@ var api = {
};

export default api;
export { api as logging };
1 change: 1 addition & 0 deletions src/core/mockup-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ var parser = {
};

export default parser;
export { parser as Parser };
19 changes: 19 additions & 0 deletions src/core/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
1 change: 1 addition & 0 deletions src/core/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,4 @@ class ArgumentParser {
ArgumentParser.prototype.add_argument = ArgumentParser.prototype.addArgument;

export default ArgumentParser;
export { ArgumentParser as Parser };
1 change: 1 addition & 0 deletions src/core/push_kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ const push_kit = {
push_kit.init();

export default push_kit;
export { push_kit as PushKit };
3 changes: 2 additions & 1 deletion src/core/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -230,3 +230,4 @@ const registry = {
};

export default registry;
export { registry as Registry, PATTERN_REGISTRY };
1 change: 1 addition & 0 deletions src/core/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ try {
}

export default store;
export { store as Store };
1 change: 1 addition & 0 deletions src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,3 +715,4 @@ var utils = {
};

export default utils;
export { utils };
9 changes: 2 additions & 7 deletions src/pat/validation/validation.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/pat/validation/validation.test.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down
1 change: 1 addition & 0 deletions src/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down