coveragebook_components 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/build/coco/app.css +28 -1
- data/app/assets/build/coco/app.js +24299 -26700
- data/app/assets/build/coco/book.css +28 -1
- data/app/assets/build/coco/book.js +15626 -17590
- data/app/assets/build/coco/coco.js +16543 -0
- data/app/assets/css/base/config.css +1 -1
- data/app/assets/js/app.js +9 -28
- data/app/assets/js/base/alpine/directives/options.js +1 -1
- data/app/assets/js/base/alpine/index.js +0 -4
- data/app/assets/js/base/components.js +42 -0
- data/app/assets/js/base/polyfills.js +1 -0
- data/app/assets/js/book.js +7 -6
- data/app/assets/js/coco/coco.js +39 -0
- data/app/assets/js/{base/coco.js → coco/component.js} +1 -0
- data/app/assets/js/coco.js +7 -0
- data/app/assets/js/helpers/dom.js +1 -14
- data/app/assets/js/helpers/index.js +7 -0
- data/app/assets/js/helpers/lang.js +15 -1
- data/app/components/coco/app/application_layout/application_layout.html.erb +3 -1
- data/app/components/coco/app/application_layout/application_layout.js +21 -1
- data/app/components/coco/app/header/header.js +1 -1
- data/app/components/coco/app/nav_drawer/nav_drawer.js +1 -1
- data/app/components/coco/app/plan_picker/plan_picker.js +1 -1
- data/app/components/coco/app/sidebar_nav/item/item.js +1 -1
- data/app/components/coco/app/sidebar_nav/menu/menu.js +1 -1
- data/app/components/coco/app/sidebar_nav/navbar/navbar.js +2 -2
- data/app/components/coco/app/slide_editor/slide_editor.js +1 -1
- data/app/components/coco/buttons/button/button.js +2 -2
- data/app/components/coco/buttons/button/button_dropdown.js +1 -1
- data/app/components/coco/buttons/button_group/button_group.js +1 -1
- data/app/components/coco/buttons/color_picker_button/color_picker_button.js +1 -1
- data/app/components/coco/buttons/confirm_panel/confirm_panel.js +1 -1
- data/app/components/coco/buttons/image_picker_button/image_picker_button.js +1 -1
- data/app/components/coco/buttons/layout_picker_button/layout_picker_button.js +1 -1
- data/app/components/coco/buttons/menu_button/menu_button.js +1 -1
- data/app/components/coco/buttons/toolbar/toolbar.js +1 -1
- data/app/components/coco/images/icon/icon.js +1 -1
- data/app/components/coco/images/image_uploader/image_uploader.js +1 -1
- data/app/components/coco/layout/page/page.js +1 -1
- data/app/components/coco/messaging/alert/alert.js +1 -1
- data/app/components/coco/messaging/notice/notice.js +1 -1
- data/app/components/coco/messaging/snackbar/snackbar.js +1 -1
- data/app/components/coco/messaging/system_banner/system_banner.js +1 -1
- data/app/components/coco/messaging/toast/toast.js +1 -1
- data/app/components/coco/modals/modal/modal.js +1 -1
- data/app/components/coco/modals/modal_dialog/modal_dialog.js +1 -1
- data/app/components/coco/modals/modal_lightbox/modal_lightbox.js +1 -1
- data/app/components/coco/pickers/color_picker/color_picker.js +1 -1
- data/app/components/coco/pickers/image_picker/image_picker.js +1 -1
- data/app/components/coco/utilities/dropdown/dropdown.js +1 -1
- data/app/components/coco/utilities/poll_controller/poll_controller.js +1 -1
- data/app/components/coco/utilities/seamless_textarea/seamless_textarea.js +1 -1
- data/app/helpers/coco/integration_helper.rb +2 -10
- data/config/{tailwind.config.cjs → tailwind.config.js} +2 -2
- data/config/{tokens.cjs → tokens.js} +14 -5
- data/lib/coco.rb +1 -1
- data/lib/scripts/{postcss-import-alias-glob.cjs → postcss-import-alias-glob.js} +1 -1
- data/lib/tasks/coco_tasks.rake +4 -1
- metadata +17 -12
- data/app/assets/js/base/setup.js +0 -8
- /data/config/{utils.cjs → utils.js} +0 -0
- /data/lib/scripts/{esbuild-plugin-build-icons.js → esbuild-plugin-build-icons.mjs} +0 -0
- /data/lib/scripts/{esbuild-plugin-clean.js → esbuild-plugin-clean.mjs} +0 -0
- /data/lib/scripts/{esbuild-plugin-import-glob.js → esbuild-plugin-import-glob.mjs} +0 -0
- /data/lib/scripts/{map-aliased-path.js → map-aliased-path.mjs} +0 -0
@@ -1 +1 @@
|
|
1
|
-
@config "../../../../config/tailwind.config.
|
1
|
+
@config "../../../../config/tailwind.config.js";
|
data/app/assets/js/app.js
CHANGED
@@ -1,30 +1,11 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import "./base/polyfills";
|
2
|
+
import Coco from "./coco/coco";
|
3
|
+
import baseComponents from "./base/components";
|
4
|
+
import bookComponents from "@bookComponents/**/*.js";
|
5
|
+
import appComponents from "@appComponents/**/*.js";
|
4
6
|
|
5
|
-
|
6
|
-
registerComponents(
|
7
|
+
Coco.registerComponents(baseComponents);
|
8
|
+
Coco.registerComponents(bookComponents);
|
9
|
+
Coco.registerComponents(appComponents);
|
7
10
|
|
8
|
-
|
9
|
-
// Optionally uses Turbo for the page navigation.
|
10
|
-
window.addEventListener("app:navigate", (event) => {
|
11
|
-
const url = event.detail.url;
|
12
|
-
if (url) {
|
13
|
-
delete event.detail.url;
|
14
|
-
navigateTo(url, event.detail);
|
15
|
-
}
|
16
|
-
});
|
17
|
-
|
18
|
-
// Uodate the value of the `--app-height` css variable
|
19
|
-
// when the viewport size changes. To help work around the
|
20
|
-
// issues when using 100vh on mobile safari (https://medium.com/quick-code/100vh-problem-with-ios-safari-92ab23c852a8)
|
21
|
-
function setAppHeightProperty() {
|
22
|
-
document.documentElement.style.setProperty(
|
23
|
-
"--app-height",
|
24
|
-
`${window.innerHeight}px`
|
25
|
-
);
|
26
|
-
}
|
27
|
-
window.addEventListener("resize", setAppHeightProperty);
|
28
|
-
setAppHeightProperty();
|
29
|
-
|
30
|
-
Alpine.start();
|
11
|
+
export default Coco;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import Alpine from "alpinejs";
|
2
2
|
|
3
3
|
import morph from "@alpinejs/morph";
|
4
|
-
import collapse from "@alpinejs/collapse";
|
5
|
-
import intersect from "@alpinejs/intersect";
|
6
4
|
import mask from "@alpinejs/mask";
|
7
5
|
import focus from "@alpinejs/focus";
|
8
6
|
|
@@ -21,8 +19,6 @@ window.Alpine = Alpine;
|
|
21
19
|
Alpine.plugin(mask);
|
22
20
|
Alpine.plugin(focus);
|
23
21
|
Alpine.plugin(morph);
|
24
|
-
Alpine.plugin(collapse);
|
25
|
-
Alpine.plugin(intersect);
|
26
22
|
|
27
23
|
// Coco directives
|
28
24
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import buttons from "@components/buttons/**/*.js";
|
2
|
+
import embeds from "@components/embeds/**/*.js";
|
3
|
+
import fields from "@components/fields/**/*.js";
|
4
|
+
import images from "@components/images/**/*.js";
|
5
|
+
import indicators from "@components/indicators/**/*.js";
|
6
|
+
import layout from "@components/layout/**/*.js";
|
7
|
+
import messaging from "@components/messaging/**/*.js";
|
8
|
+
import modals from "@components/modals/**/*.js";
|
9
|
+
import navigation from "@components/navigation/**/*.js";
|
10
|
+
import pickers from "@components/pickers/**/*.js";
|
11
|
+
import typography from "@components/typography/**/*.js";
|
12
|
+
import utilities from "@components/utilities/**/*.js";
|
13
|
+
|
14
|
+
export {
|
15
|
+
buttons,
|
16
|
+
embeds,
|
17
|
+
fields,
|
18
|
+
images,
|
19
|
+
indicators,
|
20
|
+
layout,
|
21
|
+
messaging,
|
22
|
+
modals,
|
23
|
+
navigation,
|
24
|
+
pickers,
|
25
|
+
typography,
|
26
|
+
utilities,
|
27
|
+
};
|
28
|
+
|
29
|
+
export default [
|
30
|
+
...buttons,
|
31
|
+
...embeds,
|
32
|
+
...fields,
|
33
|
+
...images,
|
34
|
+
...indicators,
|
35
|
+
...layout,
|
36
|
+
...messaging,
|
37
|
+
...modals,
|
38
|
+
...navigation,
|
39
|
+
...pickers,
|
40
|
+
...typography,
|
41
|
+
...utilities,
|
42
|
+
];
|
@@ -0,0 +1 @@
|
|
1
|
+
import "container-query-polyfill";
|
data/app/assets/js/book.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import "./base/polyfills";
|
2
|
+
import Coco from "./coco/coco";
|
3
|
+
import baseComponents from "./base/components";
|
4
|
+
import bookComponents from "@bookComponents/**/*.js";
|
3
5
|
|
4
|
-
|
6
|
+
Coco.registerComponents(baseComponents);
|
7
|
+
Coco.registerComponents(bookComponents);
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
Alpine.start();
|
9
|
+
export default Coco;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import Alpine from "../base/alpine";
|
2
|
+
import packageJSON from "@/package.json" assert { type: "json" };
|
3
|
+
import { registerComponents } from "@helpers/alpine.js";
|
4
|
+
import CocoComponent from "./component";
|
5
|
+
import * as helpers from "@helpers/index";
|
6
|
+
|
7
|
+
const Coco = {
|
8
|
+
version: packageJSON.version,
|
9
|
+
|
10
|
+
start() {
|
11
|
+
if (this._started) {
|
12
|
+
throw new Error("Coco has already been started!");
|
13
|
+
}
|
14
|
+
|
15
|
+
console.info("Initializing Coco JS", packageJSON.version);
|
16
|
+
|
17
|
+
registerComponents(this._components);
|
18
|
+
|
19
|
+
window.Alpine = Alpine;
|
20
|
+
Alpine.start();
|
21
|
+
},
|
22
|
+
|
23
|
+
registerComponents(components) {
|
24
|
+
this._components.push(...components);
|
25
|
+
},
|
26
|
+
|
27
|
+
component(...args) {
|
28
|
+
return CocoComponent(...args);
|
29
|
+
},
|
30
|
+
|
31
|
+
_components: [],
|
32
|
+
|
33
|
+
_started: false,
|
34
|
+
};
|
35
|
+
|
36
|
+
Coco.Component = CocoComponent;
|
37
|
+
Coco.helpers = helpers;
|
38
|
+
|
39
|
+
export default Coco;
|
@@ -1,18 +1,5 @@
|
|
1
1
|
import { isNumeric } from "@helpers/lang";
|
2
2
|
|
3
|
-
function getHiddenElementDimensions(el, display = "block") {
|
4
|
-
let size;
|
5
|
-
if (el.style.display === "none") {
|
6
|
-
el.style.display = display;
|
7
|
-
size = el.getBoundingClientRect();
|
8
|
-
el.style.display = "none";
|
9
|
-
} else {
|
10
|
-
size = el.getBoundingClientRect();
|
11
|
-
}
|
12
|
-
|
13
|
-
return size;
|
14
|
-
}
|
15
|
-
|
16
3
|
function castAttributeValue(value) {
|
17
4
|
if (value === "false") {
|
18
5
|
return false;
|
@@ -38,4 +25,4 @@ function isNode(o) {
|
|
38
25
|
typeof o.nodeName === "string";
|
39
26
|
}
|
40
27
|
|
41
|
-
export {
|
28
|
+
export { castAttributeValue, isNode };
|
@@ -1,3 +1,8 @@
|
|
1
|
+
import camelCase from "lodash.camelcase";
|
2
|
+
import kebabCase from "lodash.kebabcase";
|
3
|
+
import mapValues from "lodash.mapvalues";
|
4
|
+
import keyBy from "lodash.keyby";
|
5
|
+
|
1
6
|
function nameFunction(name, body) {
|
2
7
|
return {
|
3
8
|
[name](...args) {
|
@@ -43,4 +48,13 @@ function roughSizeOfObject(object) {
|
|
43
48
|
return bytes;
|
44
49
|
}
|
45
50
|
|
46
|
-
export {
|
51
|
+
export {
|
52
|
+
nameFunction,
|
53
|
+
isObject,
|
54
|
+
isNumeric,
|
55
|
+
roughSizeOfObject,
|
56
|
+
camelCase,
|
57
|
+
kebabCase,
|
58
|
+
keyBy,
|
59
|
+
mapValues,
|
60
|
+
};
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<%= render component_tag(
|
2
2
|
x: {
|
3
3
|
data: x_data("appLayout", banner: banner? && banner_content?),
|
4
|
-
":class": "{'with-banner': banner}"
|
4
|
+
":class": "{'with-banner': banner}",
|
5
|
+
"@app:navigate.window": "handleNavigation",
|
6
|
+
"@resize.window": "setAppHeight"
|
5
7
|
},
|
6
8
|
class: {
|
7
9
|
"with-sidebar-nav": sidebar_nav?,
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
1
|
+
import { CocoComponent } from "@assets/js/coco/component";
|
2
|
+
import { navigateTo } from "@helpers/location";
|
2
3
|
|
3
4
|
export default CocoComponent("appLayout", (opts) => {
|
4
5
|
return {
|
@@ -6,6 +7,25 @@ export default CocoComponent("appLayout", (opts) => {
|
|
6
7
|
|
7
8
|
init() {
|
8
9
|
this.banner = opts.banner;
|
10
|
+
this.setAppHeight();
|
11
|
+
},
|
12
|
+
|
13
|
+
handleNavigation(event) {
|
14
|
+
const url = event.detail.url;
|
15
|
+
if (url) {
|
16
|
+
delete event.detail.url;
|
17
|
+
navigateTo(url, event.detail);
|
18
|
+
}
|
19
|
+
},
|
20
|
+
|
21
|
+
// Update the value of the `--app-height` css variable
|
22
|
+
// when the viewport size changes. To help work around the
|
23
|
+
// issues when using 100vh on mobile safari (https://medium.com/quick-code/100vh-problem-with-ios-safari-92ab23c852a8)
|
24
|
+
setAppHeight() {
|
25
|
+
document.documentElement.style.setProperty(
|
26
|
+
"--app-height",
|
27
|
+
`${window.innerHeight}px`
|
28
|
+
);
|
9
29
|
},
|
10
30
|
|
11
31
|
hideBanner() {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
2
|
-
import { camelCase } from "
|
1
|
+
import { CocoComponent } from "@assets/js/coco/component.js";
|
2
|
+
import { camelCase } from "@helpers/lang";
|
3
3
|
|
4
4
|
export default CocoComponent("button", (data = {}) => {
|
5
5
|
return {
|
@@ -1,19 +1,11 @@
|
|
1
1
|
module Coco
|
2
2
|
module IntegrationHelper
|
3
|
-
def coco_javascript_tag(context, dev: ENV["COCO_PATH"], **)
|
4
|
-
javascript_include_tag("coco/#{context}#{".dev" if dev}", **)
|
5
|
-
end
|
6
|
-
|
7
|
-
def coco_javascript_file_path(context, dev: ENV["COCO_PATH"])
|
8
|
-
File.join(Coco::Engine.root, "app/assets/build/coco/#{context}#{".dev" if dev}.js")
|
9
|
-
end
|
10
|
-
|
11
3
|
def coco_stylesheet_tag(context, dev: ENV["COCO_PATH"], **)
|
12
|
-
stylesheet_link_tag("coco
|
4
|
+
stylesheet_link_tag("coco#{"/dev" if dev}/#{context}", **)
|
13
5
|
end
|
14
6
|
|
15
7
|
def coco_stylesheet_file_path(context, dev: ENV["COCO_PATH"], **opts)
|
16
|
-
File.join(Coco::Engine.root, "app/assets/build/coco
|
8
|
+
File.join(Coco::Engine.root, "app/assets/build/coco#{"/dev" if dev}/#{context}.css")
|
17
9
|
end
|
18
10
|
end
|
19
11
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/** @type {import('tailwindcss').Config} */
|
2
2
|
|
3
3
|
const defaultTheme = require("tailwindcss/defaultTheme");
|
4
|
-
const { cocoPath } = require("./utils.
|
5
|
-
const { fontSize, fontFamily, colors, screens } = require("./tokens.
|
4
|
+
const { cocoPath } = require("./utils.js");
|
5
|
+
const { fontSize, fontFamily, colors, screens } = require("./tokens.js");
|
6
6
|
|
7
7
|
module.exports = {
|
8
8
|
content: [
|
@@ -1,10 +1,8 @@
|
|
1
|
-
const tailwindColors = require("tailwindcss/colors");
|
2
|
-
|
3
1
|
const colors = {
|
4
2
|
transparent: "transparent",
|
5
3
|
current: "currentColor",
|
6
|
-
black:
|
7
|
-
white:
|
4
|
+
black: "#000000",
|
5
|
+
white: "#FFFFFF",
|
8
6
|
gray: {
|
9
7
|
50: "#F9FAFB",
|
10
8
|
100: "#F3F4F6",
|
@@ -70,7 +68,18 @@ const colors = {
|
|
70
68
|
800: "#075985",
|
71
69
|
900: "#0C4A6E",
|
72
70
|
},
|
73
|
-
teal:
|
71
|
+
teal: {
|
72
|
+
50: "#F0FDFA",
|
73
|
+
100: "#CCFBF1",
|
74
|
+
200: "#99F6E4",
|
75
|
+
300: "#5EEAD4",
|
76
|
+
400: "#2DD4BF",
|
77
|
+
500: "#14B8A6",
|
78
|
+
600: "#0D9488",
|
79
|
+
700: "#0F766E",
|
80
|
+
800: "#115E59",
|
81
|
+
900: "#134E4A",
|
82
|
+
},
|
74
83
|
};
|
75
84
|
|
76
85
|
const colorAliases = {
|
data/lib/coco.rb
CHANGED
@@ -3,7 +3,7 @@ const valueParser = require("postcss-value-parser");
|
|
3
3
|
const path = require("path");
|
4
4
|
const fg = require("fast-glob");
|
5
5
|
const { sort } = require("fast-sort");
|
6
|
-
const { cocoPath } = require("../../config/utils.
|
6
|
+
const { cocoPath } = require("../../config/utils.js");
|
7
7
|
|
8
8
|
const SORTERS = ["asc", "desc"];
|
9
9
|
const DEFAULT_SORTER = "asc";
|